/* ---------- student ---------- */

.loading { margin-top: 30vh; }

.loading .title { font-size: clamp(26px, 7vw, 40px); }

.intro .hat, .index-hat .hat { margin-top: 6px; margin-bottom: 10px; }

.intro .bubble, .index-bubble { margin-top: 10px; min-height: 0; }

.intro form, .hall > * + * { margin-top: 16px; }

.small-title { font-size: clamp(30px, 8vw, 52px); }

.me-card { text-align: center; }

.me-card .hat { width: min(40vw, 170px); margin-bottom: 6px; }

.me-card .greet { font-family: var(--caps); font-weight: 700; font-size: clamp(20px, 6vw, 28px); color: var(--gold-1); letter-spacing: 0.04em; word-break: break-word; }

.me-card p { margin: 8px 0 0; }

.me-card .link-btn
{
    background: none;
    border: 0;
    color: var(--gold-2);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    padding: 6px;
}

.me-card.sorted
{
    background:
        radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--house) 70%, transparent), transparent 75%),
        linear-gradient(180deg, color-mix(in srgb, var(--house-deep) 90%, transparent), rgba(6, 8, 20, 0.92));
    border-color: color-mix(in srgb, var(--house-accent) 70%, transparent);
}

.me-card.sorted .crest { width: min(42vw, 180px); filter: drop-shadow(0 0 24px color-mix(in srgb, var(--house-accent) 60%, transparent)) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.6)); }

.me-card.sorted .you { font-family: var(--caps); font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; font-size: 13px; color: #fff; opacity: 0.8; margin-top: 6px; }

.me-card.sorted .hname-big { font-family: var(--title); font-weight: 700; font-size: clamp(38px, 11vw, 64px); line-height: 1.05; color: #fff; text-shadow: 0 0 22px color-mix(in srgb, var(--house-accent) 80%, transparent), 0 3px 0 rgba(0, 0, 0, 0.5); }

.me-card.sorted .traits { font-family: var(--caps); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 13px; color: var(--house-accent); }

.me-card.house-h.sorted .traits { color: #fff3c4; }

.me-card.sorted .tagline { font-style: italic; font-size: 19px; color: #fff; opacity: 0.9; }

.me-card .mates { margin-top: 14px; }

.me-card .mates .label { color: #fff; opacity: 0.85; }

.roll .chips { justify-content: center; }

.sound-hint
{
    font-size: 15px;
    color: var(--ink-dim);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px dashed rgba(233, 199, 102, 0.3);
    display: inline-block;
}

/* ---------- big screen ---------- */

.screen
{
    width: 100%;
    max-width: 1700px;
    display: grid;
    grid-template-columns: minmax(280px, 25%) 1fr;
    gap: 22px;
    align-items: start;
    margin-top: 10px;
}

.screen-side { text-align: center; position: sticky; top: 16px; }

.screen-side .title { font-size: clamp(26px, 2.6vw, 44px); }

.screen-side .qr { width: 100%; max-width: 300px; margin: 10px auto 12px; }

.screen-side .screen-join { font-size: 19px; }

.screen-side .screen-join b { color: var(--gold-1); word-break: break-all; }

.screen-side .big-code { font-size: 30px; margin-top: 10px; padding: 8px 20px; }

.screen-side .hat { width: min(80%, 220px); margin-top: 14px; }

.screen-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.house-cols
{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.house-col
{
    border-radius: 16px;
    padding: 12px 10px 14px;
    min-height: 220px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--house) 60%, transparent), color-mix(in srgb, var(--house-deep) 92%, transparent) 55%);
    border: 1px solid color-mix(in srgb, var(--house-accent) 55%, transparent);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35), 0 16px 34px rgba(0, 0, 0, 0.35);
    text-align: center;
    min-width: 0;
}

.house-col .col-head img { width: min(70%, 120px); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }

.house-col .col-name { font-family: var(--caps); font-weight: 700; font-size: clamp(13px, 1.4vw, 22px); color: #fff; letter-spacing: 0.06em; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }

.house-col .col-count { font-weight: 700; color: #fff; font-size: clamp(16px, 1.5vw, 22px); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }

.house-col .col-count small { opacity: 0.65; }

.house-col ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.house-col li
{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    font-weight: 700;
    font-size: clamp(16px, 1.5vw, 24px);
    min-width: 0;
}

.house-col li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.house-col li.pop { animation: chip-pop 0.7s cubic-bezier(.2, 1.6, .4, 1) both; }

.house-col.bump { animation: tile-bump 0.8s cubic-bezier(.2, 1.6, .4, 1); }

.house-col li .mini
{
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    line-height: 1;
}

.waiting .chips { justify-content: flex-start; }

/* ---------- host ---------- */

.host-head
{
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin: 4px 0 18px;
}

.host-h1 { font-size: clamp(28px, 5vw, 48px); margin: 4px 0 8px; word-break: break-word; }

.host-meta { gap: 10px; }

.mode-badge
{
    font-family: var(--caps);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(233, 199, 102, 0.16);
    color: var(--gold-1);
    border: 1px solid var(--panel-border);
}

.host-actions { gap: 8px; }

.host-grid
{
    display: grid;
    grid-template-columns: minmax(300px, 0.85fr) 1.6fr;
    gap: 18px;
    align-items: start;
    padding-bottom: 110px;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.card
{
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 10px 40px 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(233, 199, 102, 0.3);
    background: rgba(255, 255, 255, 0.06);
    text-align: left;
    cursor: pointer;
    font-weight: 700;
    font-size: 20px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    width: 100%;
}

.card .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.card .tag { font-size: 14px; opacity: 0.6; flex: none; }

.card:hover { background: rgba(255, 255, 255, 0.1); }

.card.selected
{
    background: linear-gradient(180deg, rgba(255, 236, 170, 0.28), rgba(233, 199, 102, 0.12));
    border-color: var(--gold-1);
    box-shadow: 0 0 0 2px var(--gold-2), 0 0 24px rgba(233, 199, 102, 0.5);
    transform: translateY(-1px);
}

.card.pop { animation: chip-pop 0.6s cubic-bezier(.2, 1.6, .4, 1) both; }

.card.busy { cursor: default; border-style: dashed; animation: in-hat 1.4s ease-in-out infinite alternate; }

.card.busy .tag { opacity: 1; color: var(--gold-1); font-style: italic; }

.card.busy .x { display: none; }

@keyframes in-hat { from { box-shadow: 0 0 0 rgba(233, 199, 102, 0); } to { box-shadow: 0 0 22px rgba(233, 199, 102, 0.45); } }

.card .x
{
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--ink-dim);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
}

.card .x:hover { color: var(--danger); background: rgba(255, 255, 255, 0.08); }

.empty { text-align: center; padding: 18px 8px; font-size: 18px; }

.add-row { margin-top: 14px; }

.small-field { min-height: 46px; font-size: 18px; padding: 8px 14px; }

.hall-panel .house-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.hall-panel .house-col { min-height: 180px; }

.hall-panel .house-col li { font-size: 17px; justify-content: space-between; padding: 4px 4px 4px 10px; }

.action-bar
{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(5, 7, 15, 0), rgba(5, 7, 15, 0.92) 30%);
}

.action-inner
{
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(12, 17, 42, 0.92);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.action-text { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.action-text b { color: var(--gold-1); }

.pick-house { display: flex; align-items: center; gap: 6px; flex: none; }

.pick-house .pick-label { font-size: 15px; color: var(--ink-dim); margin-right: 2px; }

.pick-house button
{
    width: 48px;
    height: 48px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: rgba(10, 14, 34, 0.6);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.pick-house button:hover { transform: translateY(-2px) scale(1.06); border-color: var(--gold-1); }

.pick-house button img { width: 100%; height: 100%; object-fit: contain; display: block; }

.pick-house button[disabled] { opacity: 0.35; cursor: default; transform: none; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.mode-card
{
    position: relative;
    display: block;
    padding: 14px 14px 14px 46px;
    border-radius: 14px;
    border: 1px solid rgba(233, 199, 102, 0.3);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    text-align: left;
}

.mode-card input { position: absolute; left: 16px; top: 18px; width: 18px; height: 18px; accent-color: var(--gold-2); }

.mode-card b { display: block; font-family: var(--caps); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-1); }

.mode-card span { display: block; font-size: 16px; color: var(--ink-dim); margin-top: 4px; line-height: 1.3; }

.mode-card:has(input:checked) { border-color: var(--gold-1); background: rgba(233, 199, 102, 0.14); box-shadow: 0 0 0 1px var(--gold-2); }

.steppers { display: flex; flex-direction: column; gap: 8px; }

.stepper
{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border-radius: 14px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--house) 45%, transparent), rgba(255, 255, 255, 0.03) 70%);
    border: 1px solid color-mix(in srgb, var(--house-accent) 40%, transparent);
}

.stepper img { width: 40px; flex: none; }

.stepper .sname { flex: 1 1 auto; font-family: var(--caps); font-weight: 700; font-size: 15px; letter-spacing: 0.06em; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }

.stepper .sname small { display: block; font-family: var(--body); letter-spacing: 0; font-size: 14px; opacity: 0.75; font-weight: 500; }

.num-ctrl { display: flex; align-items: center; gap: 6px; flex: none; }

.num-ctrl button
{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--panel-border);
    background: rgba(10, 14, 34, 0.7);
    color: var(--gold-1);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.num-ctrl input
{
    width: 64px;
    height: 44px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid #c9a75a;
    background: linear-gradient(180deg, #f8eed4, #eadbb3);
    color: var(--parchment-ink);
    font-weight: 700;
    font-size: 22px;
    -moz-appearance: textfield;
    appearance: textfield;
}

.num-ctrl input::-webkit-outer-spin-button, .num-ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.total-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 19px; flex-wrap: wrap; }

.total-line b { color: var(--gold-1); font-size: 22px; }

.danger-zone { border-top: 1px solid rgba(233, 199, 102, 0.2); padding-top: 14px; margin-top: 18px; }

.btn.danger { color: var(--danger); border-color: rgba(239, 138, 115, 0.5); }

.share-grid { display: grid; grid-template-columns: minmax(0, 280px) 1fr; gap: 18px; align-items: center; }

.share-grid .qr { width: 100%; }

.denied { margin-top: 20vh; }

/* ---------- index ---------- */

.index-hat .hat { width: min(62vw, 300px); }

.my-list { display: flex; flex-direction: column; gap: 8px; }

.my-row { display: flex; align-items: center; gap: 8px; }

.my-row .my-item { flex: 1 1 auto; min-width: 0; }

.my-item
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(233, 199, 102, 0.2);
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.my-item small { color: var(--ink-dim); font-weight: 500; }

/* ---------- responsive ---------- */

@media (max-width: 1000px)
{
    .host-grid { grid-template-columns: 1fr; }
    .screen { grid-template-columns: 1fr; }
    .screen-side { position: static; }
}

@media (max-width: 640px)
{
    .house-cols, .hall-panel .house-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .share-grid { grid-template-columns: 1fr; justify-items: center; }
    .segmented { grid-template-columns: 1fr; }
    .action-inner { border-radius: 22px; flex-wrap: wrap; padding: 10px; }
    .action-text { flex-basis: 100%; text-align: center; white-space: normal; }
    .action-inner .btn { flex: 1 1 0; }
    .pick-house { flex-basis: 100%; justify-content: center; }
    .panel { padding: 16px; }
    .host-actions { width: 100%; }
}

@media (max-width: 640px)
{
    body:has(.top-tools) .page { padding-top: max(66px, env(safe-area-inset-top)); }
}

/* ---------- games hub ---------- */

.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 18px; }

@media (max-width: 1100px) { .games { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.game-card
{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 22px 26px;
    border-radius: 22px;
    text-decoration: none;
    color: var(--ink);
    background: linear-gradient(180deg, color-mix(in srgb, var(--house) 28%, rgba(20, 27, 64, 0.86)), rgba(9, 12, 32, 0.92));
    border: 1px solid var(--panel-border);
    box-shadow: inset 0 0 0 5px rgba(8, 11, 28, 0.85), inset 0 0 0 6px rgba(233, 199, 102, 0.16), 0 22px 50px rgba(0, 0, 0, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.game-card:hover, .game-card:focus-visible
{
    transform: translateY(-4px);
    box-shadow: inset 0 0 0 5px rgba(8, 11, 28, 0.85), inset 0 0 0 6px rgba(233, 199, 102, 0.3), 0 26px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(233, 199, 102, 0.3);
}

.game-card img { height: min(32vh, 250px); width: auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.55)); transition: transform 0.4s ease; }

.game-card:hover img { transform: rotate(-3deg) scale(1.04); }

.game-name { font-family: var(--title); font-weight: 700; font-size: clamp(26px, 3vw, 38px); margin: 4px 0 0; }

.game-card p { margin: 0; font-size: 19px; color: var(--ink-dim); max-width: 420px; flex: 1 1 auto; }

@media (max-width: 760px)
{
    .games { grid-template-columns: 1fr; }
    .game-card img { height: 28vh; }
}
