/* ============================================
   حروف — Complete Game Styles
   TV-optimized, Red vs Green, Square + Hex
   ============================================ */
:root {
    --bg: #0a1020;
    --bg2: #111b30;
    --bg3: #1a2744;
    --t1: #e63946;
    --t1l: #ff6b6b;
    --t1d: #a8121e;
    --t1g: rgba(230, 57, 70, .35);
    --t1s: rgba(230, 57, 70, .1);
    --t2: #1b8a4a;
    --t2l: #2ecc71;
    --t2d: #14613a;
    --t2g: rgba(46, 204, 113, .35);
    --t2s: rgba(46, 204, 113, .1);
    --gold: #f1c40f;
    --goldd: #d4a800;
    --goldg: rgba(241, 196, 15, .35);
    --txt: #f0f2f5;
    --txt2: #7e8fa3;
    --dark: #1a2332;
    --gl: rgba(255, 255, 255, .05);
    --glb: rgba(255, 255, 255, .1);
    --ar: 'Amiri', serif;
    --ui: 'Cairo', sans-serif;
    --cell: 72px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html {
    font-size: 16px
}

body {
    font-family: var(--ui);
    background: var(--bg);
    color: var(--txt);
    min-height: 100vh;
    overflow-x: hidden
}

/* ---------- SCREENS ---------- */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(.96);
    transition: all .4s cubic-bezier(.4, 0, .2, 1);
    z-index: 1
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 10
}

/* ---------- OVERLAY ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .78);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all .3s
}

.overlay.show {
    opacity: 1;
    visibility: visible
}

/* ============ START SCREEN ============ */
#startScreen {
    background: linear-gradient(155deg, #0a1020, #142038, #0a1020);
    align-items: center;
    justify-content: center;
    overflow: auto
}

.deco-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden
}

.deco {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: .035;
    animation: df 11s ease-in-out infinite
}

.deco1 {
    width: 200px;
    height: 200px;
    background: var(--t1);
    top: -40px;
    right: -20px
}

.deco2 {
    width: 170px;
    height: 170px;
    background: var(--t2);
    bottom: -30px;
    left: -30px;
    animation-delay: 3s
}

.deco3 {
    width: 130px;
    height: 130px;
    background: var(--gold);
    top: 28%;
    left: -50px;
    animation-delay: 5s
}

.deco4 {
    width: 110px;
    height: 110px;
    background: var(--t1l);
    bottom: 18%;
    right: -35px;
    animation-delay: 7s
}

@keyframes df {

    0%,
    100% {
        transform: translate(0, 0)rotate(0)
    }

    50% {
        transform: translate(10px, -15px)rotate(6deg)
    }
}

.start-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 560px
}

.logo-row {
    display: flex;
    gap: 7px;
    margin-bottom: .2rem
}

.lh {
    width: 48px;
    height: 48px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lp .5s cubic-bezier(.34, 1.56, .64, 1) both
}

.lh:nth-child(1) {
    animation-delay: .1s
}

.lh:nth-child(2) {
    animation-delay: .2s
}

.lh:nth-child(3) {
    animation-delay: .3s
}

.lh:nth-child(4) {
    animation-delay: .4s
}

.lh::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)
}

.lh.red::before {
    background: linear-gradient(145deg, var(--t1), var(--t1d))
}

.lh.grn::before {
    background: linear-gradient(145deg, var(--t2), var(--t2d))
}

.lh::after {
    content: '';
    position: absolute;
    inset: 3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #fff
}

.lh span {
    position: relative;
    z-index: 2;
    font-family: var(--ar);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark)
}

@keyframes lp {
    from {
        opacity: 0;
        transform: scale(0)rotate(20deg)
    }

    to {
        opacity: 1;
        transform: scale(1)rotate(0)
    }
}

.main-title {
    font-family: var(--ar);
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--t1l), var(--gold), var(--t2l));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.main-sub {
    color: var(--txt2);
    font-size: .95rem;
    margin-top: -.3rem
}

/* Rules */
.rules-card {
    width: 100%;
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 12px;
    padding: .65rem .8rem;
    display: flex;
    flex-direction: column;
    gap: .3rem
}

.rl {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--txt2)
}

.rl strong {
    color: var(--txt)
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0
}

.dot-r {
    background: var(--t1)
}

.dot-g {
    background: var(--t2)
}

.rl-i {
    font-size: 1rem
}

/* Setup */
.setup-grid {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem
}

.setup-card {
    flex: 1;
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 12px;
    padding: .65rem;
    display: flex;
    flex-direction: column;
    gap: .3rem
}

.t1-card {
    border-color: rgba(230, 57, 70, .15)
}

.t2-card {
    border-color: rgba(46, 204, 113, .15)
}

.sc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%
}

.r-dot {
    background: var(--t1);
    box-shadow: 0 0 8px var(--t1g)
}

.g-dot {
    background: var(--t2);
    box-shadow: 0 0 8px var(--t2g)
}

.setup-card label {
    font-size: .72rem;
    color: var(--txt2)
}

.setup-card input {
    background: transparent;
    border: 1px solid var(--glb);
    border-radius: 7px;
    padding: .4rem .5rem;
    color: var(--txt);
    font-family: var(--ui);
    font-size: .88rem;
    outline: none
}

.setup-card input:focus {
    border-color: var(--gold)
}

.setup-vs {
    font-weight: 900;
    font-size: .7rem;
    color: var(--txt2);
    background: var(--gl);
    border: 1px solid var(--glb);
    padding: .2rem .5rem;
    border-radius: 6px;
    flex-shrink: 0
}

/* Config */
.config-row {
    width: 100%;
    display: flex;
    gap: .75rem
}

.config-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .3rem
}

.config-item label {
    font-size: .75rem;
    color: var(--txt2);
    font-weight: 600
}

.btn-group {
    display: flex;
    gap: .3rem
}

.gbtn {
    flex: 1;
    padding: .45rem;
    border: 1px solid var(--glb);
    background: var(--gl);
    color: var(--txt2);
    border-radius: 8px;
    font-family: var(--ui);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s
}

.gbtn.active {
    background: var(--t2);
    border-color: var(--t2l);
    color: #fff;
    box-shadow: 0 0 10px var(--t2g)
}

.gbtn:hover:not(.active) {
    border-color: var(--txt2);
    color: var(--txt)
}

/* Start buttons */
.start-btns {
    width: 100%;
    display: flex;
    gap: .5rem;
    margin-top: .3rem
}

.btn-play {
    flex: 2;
    padding: .85rem;
    background: linear-gradient(135deg, var(--t2d), var(--t2l));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: var(--ui);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px var(--t2g);
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px var(--t2g)
}

.btn-admin {
    flex: 1;
    padding: .85rem;
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 12px;
    color: var(--txt2);
    font-family: var(--ui);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s
}

.btn-admin:hover {
    border-color: var(--gold);
    color: var(--gold)
}

/* ============ ADMIN SCREEN ============ */
#adminScreen {
    background: var(--bg)
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--gl);
    border-bottom: 1px solid var(--glb)
}

.admin-header h2 {
    font-family: var(--ar);
    font-size: 1.3rem
}

.back-btn {
    background: none;
    border: 1px solid var(--glb);
    color: var(--txt);
    padding: .35rem .8rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--ui);
    font-size: .85rem;
    transition: all .2s
}

.back-btn:hover {
    border-color: var(--t1);
    color: var(--t1)
}

.admin-actions {
    display: flex;
    gap: .4rem
}

.adm-btn {
    padding: .4rem .8rem;
    border: 1px solid var(--glb);
    background: var(--gl);
    color: var(--txt2);
    border-radius: 8px;
    font-family: var(--ui);
    font-size: .82rem;
    cursor: pointer;
    transition: all .2s
}

.adm-btn:hover {
    border-color: var(--gold);
    color: var(--gold)
}

.adm-btn.primary {
    background: var(--t2);
    border-color: var(--t2l);
    color: #fff
}

.adm-btn.primary:hover {
    background: var(--t2l)
}

.admin-body {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .8rem
}

/* Question Form */
.q-form-card {
    background: var(--bg3);
    border: 1px solid var(--glb);
    border-radius: 14px;
    padding: 1rem
}

.q-form-card h3 {
    font-size: 1rem;
    margin-bottom: .7rem;
    color: var(--gold)
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem
}

.fg-item {
    display: flex;
    flex-direction: column;
    gap: .2rem
}

.fg-item label {
    font-size: .72rem;
    color: var(--txt2)
}

.fg-item input,
.fg-item select {
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 7px;
    padding: .4rem .5rem;
    color: var(--txt);
    font-family: var(--ui);
    font-size: .88rem;
    outline: none
}

.fg-item input:focus,
.fg-item select:focus {
    border-color: var(--gold)
}

.fg-item select {
    cursor: pointer
}

.fg-wide {
    grid-column: span 2
}

.form-actions {
    display: flex;
    gap: .4rem;
    margin-top: .6rem
}

/* Filter */
.q-filter {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap
}

.q-filter input {
    flex: 1;
    min-width: 150px;
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 8px;
    padding: .4rem .6rem;
    color: var(--txt);
    font-family: var(--ui);
    font-size: .85rem;
    outline: none
}

.q-filter select {
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 8px;
    padding: .4rem .5rem;
    color: var(--txt);
    font-family: var(--ui);
    font-size: .85rem;
    outline: none;
    cursor: pointer
}

.q-count {
    font-size: .8rem;
    color: var(--txt2);
    margin-right: auto
}

/* Questions Table */
.q-table-wrap {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--glb);
    border-radius: 12px
}

.q-table {
    width: 100%;
    border-collapse: collapse
}

.q-table thead {
    background: var(--bg3);
    position: sticky;
    top: 0;
    z-index: 2
}

.q-table th {
    padding: .55rem .6rem;
    text-align: right;
    font-size: .78rem;
    color: var(--txt2);
    font-weight: 600;
    border-bottom: 1px solid var(--glb)
}

.q-table td {
    padding: .5rem .6rem;
    font-size: .83rem;
    border-bottom: 1px solid rgba(255, 255, 255, .03)
}

.q-table tr:hover td {
    background: rgba(255, 255, 255, .02)
}

.q-table .td-letter {
    font-family: var(--ar);
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    width: 50px
}

.q-table .td-diff {
    font-size: .75rem
}

.q-table .td-acts {
    display: flex;
    gap: .25rem;
    justify-content: center
}

.q-table .td-acts button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--glb);
    background: var(--gl);
    border-radius: 6px;
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s
}

.q-table .td-acts button:hover {
    transform: scale(1.1)
}

.q-empty {
    padding: 2rem;
    text-align: center;
    color: var(--txt2);
    font-size: .9rem
}

/* ============ GAME SCREEN ============ */
#gameScreen {
    background: var(--bg)
}

/* Game Bar */
.game-bar {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--glb);
    background: var(--gl);
    backdrop-filter: blur(12px)
}

.gb-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .45rem .4rem;
    gap: .05rem;
    border-bottom: 3px solid transparent;
    transition: all .3s
}

.gb-t1.active {
    background: var(--t1s);
    border-bottom-color: var(--t1)
}

.gb-t2.active {
    background: var(--t2s);
    border-bottom-color: var(--t2)
}

.gb-ind {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all .3s
}

.gb-t1 .gb-ind {
    background: var(--t1)
}

.gb-t2 .gb-ind {
    background: var(--t2)
}

.gb-t1.active .gb-ind {
    box-shadow: 0 0 10px var(--t1g);
    animation: indPulse 1.2s ease-in-out infinite
}

.gb-t2.active .gb-ind {
    box-shadow: 0 0 10px var(--t2g);
    animation: indPulse 1.2s ease-in-out infinite
}

@keyframes indPulse {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.5)
    }
}

.gb-name {
    font-size: .82rem;
    font-weight: 700
}

.gb-dir {
    font-size: .6rem;
    color: var(--txt2)
}

.gb-score {
    font-size: 1.5rem;
    font-weight: 900
}

.gb-t1 .gb-score {
    color: var(--t1l)
}

.gb-t2 .gb-score {
    color: var(--t2l)
}

.gb-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .2rem .6rem;
    min-width: 85px
}

.gb-turn {
    font-size: .6rem;
    color: var(--txt2)
}

.gb-turn-name {
    font-size: .82rem;
    font-weight: 700
}

.gb-turn-name.t1c {
    color: var(--t1l)
}

.gb-turn-name.t2c {
    color: var(--t2l)
}

.gb-remain {
    font-size: .65rem;
    color: var(--txt2)
}

/* Board Area */
.board-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .4rem;
    overflow: auto
}

.edge-h {
    display: flex;
    justify-content: center;
    padding: .25rem 0;
    width: 100%
}

.edge-v {
    display: flex;
    align-items: center;
    padding: 0 .25rem
}

.ebar {
    border-radius: 3px
}

.ebar-g {
    background: var(--t2);
    height: 4px;
    width: 75%;
    max-width: 380px;
    opacity: .5
}

.ebar-r {
    background: var(--t1);
    width: 4px;
    height: 80%;
    opacity: .5
}

.board-mid-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%
}

/* Board Container */
.board-container {
    position: relative
}

/* ===== SQUARE CELLS ===== */
.sq-grid {
    display: grid;
    gap: 3px;
    padding: 4px;
    border: 2px solid var(--glb);
    border-radius: 12px;
    background: rgba(255, 255, 255, .015)
}

.sq-cell {
    width: var(--cell);
    height: var(--cell);
    border: 2px solid #3a4a5e;
    border-radius: 8px;
    background: linear-gradient(155deg, #fff, #eee);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .25s;
    user-select: none;
    position: relative
}

.sq-cell:hover:not(.taken) {
    transform: scale(1.12);
    box-shadow: 0 0 15px var(--goldg);
    border-color: var(--gold);
    z-index: 3
}

.sq-cell:active:not(.taken) {
    transform: scale(1.05)
}

.sq-cell .cell-char {
    font-family: var(--ar);
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c3e50;
    transition: all .25s;
    pointer-events: none
}

.sq-cell:hover:not(.taken) .cell-char {
    color: var(--goldd);
    transform: scale(1.1)
}

.sq-cell.taken {
    cursor: default
}

.sq-cell.t1 {
    background: linear-gradient(155deg, var(--t1l), var(--t1));
    border-color: var(--t1d)
}

.sq-cell.t2 {
    background: linear-gradient(155deg, var(--t2l), var(--t2));
    border-color: var(--t2d)
}

.sq-cell.t1 .cell-char,
.sq-cell.t2 .cell-char {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .3)
}

.sq-cell.bonus::after {
    content: '🎁';
    position: absolute;
    top: 1px;
    left: 1px;
    font-size: .6rem
}

.sq-cell.win-path {
    animation: wpulse .6s ease-in-out infinite alternate
}

@keyframes wpulse {
    from {
        filter: brightness(1);
        box-shadow: 0 0 5px rgba(255, 255, 255, .2)
    }

    to {
        filter: brightness(1.25);
        box-shadow: 0 0 18px rgba(255, 255, 255, .5)
    }
}

.sq-cell {
    animation: cellAppear .3s cubic-bezier(.34, 1.56, .64, 1) both
}

@keyframes cellAppear {
    from {
        opacity: 0;
        transform: scale(0)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

/* ===== HEX CELLS ===== */
.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px
}

.hx-row {
    display: flex;
    gap: 3px
}

.hx-row:not(:first-child) {
    margin-top: calc(var(--cell) * -.2)
}

.hx-row.offset {
    margin-left: calc(var(--cell) * .52 + 1.5px)
}

.hx-cell {
    width: var(--cell);
    height: var(--cell);
    position: relative;
    cursor: pointer;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
    transition: all .25s;
    user-select: none
}

.hx-cell:hover:not(.taken) {
    transform: scale(1.18);
    filter: drop-shadow(0 4px 12px var(--goldg));
    z-index: 5
}

.hx-cell:active:not(.taken) {
    transform: scale(1.08)
}

.hx-bg {
    position: absolute;
    inset: -2.5px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(145deg, #3d4f65, #2c3e50);
    transition: all .35s
}

.hx-cell:hover:not(.taken) .hx-bg {
    background: linear-gradient(145deg, var(--gold), var(--goldd))
}

.hx-face {
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(155deg, #fff, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .35s
}

.hx-cell:hover:not(.taken) .hx-face {
    background: linear-gradient(155deg, #fff9e6, #ffecb3)
}

.hx-cell .cell-char {
    font-family: var(--ar);
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c3e50;
    z-index: 2;
    pointer-events: none;
    transition: all .25s
}

.hx-cell:hover:not(.taken) .cell-char {
    transform: scale(1.1)
}

.hx-cell.taken {
    cursor: default
}

.hx-cell.t1 .hx-face {
    background: linear-gradient(155deg, var(--t1l), var(--t1))
}

.hx-cell.t1 .hx-bg {
    background: var(--t1d)
}

.hx-cell.t2 .hx-face {
    background: linear-gradient(155deg, var(--t2l), var(--t2))
}

.hx-cell.t2 .hx-bg {
    background: var(--t2d)
}

.hx-cell.t1 .cell-char,
.hx-cell.t2 .cell-char {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .3)
}

.hx-cell.win-path {
    animation: wpulse .6s ease-in-out infinite alternate
}

.hx-cell.bonus::before {
    content: '🎁';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: .55rem;
    z-index: 3
}

.hx-cell {
    animation: cellAppear .3s cubic-bezier(.34, 1.56, .64, 1) both
}

/* Game Footer */
.game-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .8rem;
    border-top: 1px solid var(--glb);
    background: var(--gl)
}

.ctrl-btn {
    padding: .35rem .8rem;
    border: 1px solid var(--glb);
    background: var(--gl);
    border-radius: 8px;
    font-size: .85rem;
    cursor: pointer;
    color: var(--txt2);
    font-family: var(--ui);
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: .3rem
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--txt)
}

/* ============ QUESTION MODAL ============ */
.q-modal {
    background: var(--bg3);
    border: 1px solid var(--glb);
    border-radius: 22px;
    padding: 1.6rem;
    width: 92%;
    max-width: 420px;
    text-align: center;
    transform: translateY(20px)scale(.92);
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1)
}

.overlay.show .q-modal {
    transform: translateY(0)scale(1)
}

.qm-hex {
    width: 85px;
    height: 85px;
    margin: 0 auto .7rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center
}

.qm-hex::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, var(--gold), var(--goldd))
}

.qm-hex::after {
    content: '';
    position: absolute;
    inset: 3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--bg)
}

.qm-hex span {
    position: relative;
    z-index: 2;
    font-family: var(--ar);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(241, 196, 15, .4)
}

.qm-letterinfo {
    font-size: .88rem;
    color: var(--txt2);
    margin-bottom: .7rem
}

.qm-letterinfo strong {
    color: var(--gold)
}

/* Question Box */
.qm-question-box {
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 12px;
    padding: .8rem;
    margin-bottom: .7rem
}

.qm-diff {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 600;
    margin-bottom: .4rem;
    background: var(--t2s);
    color: var(--t2l)
}

.qm-qtext {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: .5rem
}

.qm-reveal-btn {
    background: none;
    border: 1px dashed var(--glb);
    color: var(--txt2);
    padding: .3rem .8rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--ui);
    font-size: .82rem;
    transition: all .2s
}

.qm-reveal-btn:hover {
    border-color: var(--gold);
    color: var(--gold)
}

.qm-answer {
    margin-top: .5rem;
    padding: .5rem;
    background: rgba(46, 204, 113, .1);
    border: 1px solid rgba(46, 204, 113, .2);
    border-radius: 8px;
    color: var(--t2l);
    font-size: 1rem;
    font-weight: 700
}

.qm-manual {
    padding: .6rem;
    margin-bottom: .7rem;
    color: var(--txt2);
    font-size: .95rem
}

/* Turn */
.qm-turn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin-bottom: .8rem;
    font-size: 1rem;
    font-weight: 700;
    padding: .45rem .8rem;
    border-radius: 10px
}

.qm-turn.t1 {
    background: var(--t1s);
    color: var(--t1l)
}

.qm-turn.t2 {
    background: var(--t2s);
    color: var(--t2l)
}

.qm-turn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: dp 1.2s ease-in-out infinite
}

.qm-turn.t1 .qm-turn-dot {
    background: var(--t1);
    box-shadow: 0 0 8px var(--t1g)
}

.qm-turn.t2 .qm-turn-dot {
    background: var(--t2);
    box-shadow: 0 0 8px var(--t2g)
}

@keyframes dp {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.5)
    }
}

/* Modal Buttons */
.qm-btns {
    display: flex;
    gap: .5rem
}

.qm-btn {
    flex: 1;
    padding: .7rem;
    border: none;
    border-radius: 12px;
    font-family: var(--ui);
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem
}

.qm-btn:hover {
    transform: translateY(-2px)
}

.qm-btn:active {
    transform: scale(.97)
}

.qm-correct {
    background: var(--t2);
    color: #fff;
    box-shadow: 0 3px 12px var(--t2g)
}

.qm-wrong {
    background: #444;
    color: #fff
}

.qm-pass-btn {
    background: var(--gold);
    color: var(--dark);
    flex: none;
    padding: .6rem 1.8rem
}

.qm-next-btn {
    background: linear-gradient(135deg, var(--t2d), var(--t2l));
    color: #fff;
    flex: none;
    padding: .6rem 1.8rem
}

/* Pass / Result */
.hidden {
    display: none !important
}

.qm-pass {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem
}

.qm-pass-icon {
    font-size: 2.5rem;
    animation: sp .7s ease-in-out
}

@keyframes sp {
    from {
        transform: rotate(0)
    }

    to {
        transform: rotate(360deg)
    }
}

.qm-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem
}

.qm-res-icon {
    font-size: 3rem;
    animation: rp .5s cubic-bezier(.34, 1.56, .64, 1)
}

@keyframes rp {
    from {
        transform: scale(0)rotate(-10deg)
    }

    to {
        transform: scale(1)rotate(0)
    }
}

.qm-res-text {
    font-size: 1rem;
    font-weight: 700
}

.qm-res-text.t1c {
    color: var(--t1l)
}

.qm-res-text.t2c {
    color: var(--t2l)
}

.qm-res-text.draw {
    color: var(--txt2)
}

.qm-bonus {
    padding: .5rem;
    background: var(--goldg);
    border-radius: 10px;
    font-weight: 600;
    color: var(--gold)
}

.qm-bonus-icon {
    font-size: 1.5rem
}

/* ============ WIN MODAL ============ */
.win-modal {
    position: relative;
    width: 92%;
    max-width: 440px;
    background: var(--bg3);
    border: 1px solid var(--glb);
    border-radius: 24px;
    overflow: hidden;
    transform: translateY(20px)scale(.9);
    transition: transform .5s cubic-bezier(.34, 1.56, .64, 1)
}

.overlay.show .win-modal {
    transform: translateY(0)scale(1)
}

#confCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0
}

.win-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .8rem;
    padding: 2rem
}

.win-trophy {
    font-size: 4.5rem;
    animation: ti .8s cubic-bezier(.34, 1.56, .64, 1)
}

@keyframes ti {
    from {
        transform: scale(0)rotate(-10deg)
    }

    to {
        transform: scale(1)rotate(0)
    }
}

.win-title {
    font-family: var(--ar);
    font-size: 2rem
}

.win-title.t1w {
    color: var(--t1l)
}

.win-title.t2w {
    color: var(--t2l)
}

.win-title.draw {
    color: var(--gold)
}

.win-sub {
    font-size: .85rem;
    color: var(--txt2);
    margin-top: -.3rem
}

.win-scores {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%
}

.wsc {
    flex: 1;
    text-align: center;
    background: var(--gl);
    border: 1px solid var(--glb);
    border-radius: 14px;
    padding: .7rem
}

.wsc-n {
    font-size: .8rem;
    color: var(--txt2)
}

.wsc-v {
    font-size: 2rem;
    font-weight: 900
}

.wsc1 .wsc-v {
    color: var(--t1l)
}

.wsc2 .wsc-v {
    color: var(--t2l)
}

.wsc-sep {
    color: var(--txt2)
}

.win-btns {
    display: flex;
    gap: .5rem;
    width: 100%
}

.wbtn {
    flex: 1;
    padding: .75rem;
    border: none;
    border-radius: 12px;
    font-family: var(--ui);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem
}

.wbtn.primary {
    background: linear-gradient(135deg, var(--t2d), var(--t2l));
    color: #fff;
    box-shadow: 0 3px 12px var(--t2g)
}

.wbtn.primary:hover {
    transform: translateY(-2px)
}

.wbtn.secondary {
    background: var(--gl);
    border: 1px solid var(--glb);
    color: var(--txt2)
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 3px
}

/* ===== RESPONSIVE ===== */
@media(max-width:600px) {
    :root {
        --cell: 55px
    }

    .cell-char {
        font-size: 1.2rem !important
    }

    .main-title {
        font-size: 2.4rem
    }

    .setup-grid {
        flex-direction: column;
        gap: .3rem
    }

    .setup-vs {
        align-self: center
    }

    .config-row {
        flex-direction: column;
        gap: .5rem
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .fg-wide {
        grid-column: span 1
    }
}

@media(min-width:1200px) {
    :root {
        --cell: 90px
    }

    .cell-char {
        font-size: 2rem !important
    }

    .gb-name {
        font-size: 1.1rem
    }

    .gb-score {
        font-size: 2rem
    }
}

/* ============ LOBBY ============ */
#lobbyScreen{background:linear-gradient(155deg,#0a1020,#142038,#0a1020);align-items:center;justify-content:center;overflow:auto}
.lobby-wrap{position:relative;z-index:2;display:flex;flex-direction:column;align-items:center;gap:1.5rem;padding:2rem;width:100%;max-width:700px;margin:auto}
.lobby-wrap h2{font-family:var(--ar);font-size:2rem;color:var(--gold);margin-bottom:-.5rem}
.lobby-qr-box{background:#fff;padding:15px;border-radius:14px;box-shadow:0 10px 30px rgba(0,0,0,.5)}
.lobby-code-box{font-size:1.5rem;background:var(--gl);padding:.5rem 2rem;border-radius:20px;border:1px solid var(--glb);display:flex;align-items:center;gap:1rem}
.lobby-code-box span{color:var(--txt2);font-size:1.2rem}
.lobby-code-box strong{color:var(--gold);letter-spacing:6px;font-family:monospace;font-size:2.5rem}
.lobby-players-grid{display:flex;gap:1rem;width:100%}
.l-team{flex:1;background:var(--gl);border:1px solid var(--glb);border-radius:12px;padding:1rem;min-height:150px;display:flex;flex-direction:column;gap:.5rem}
.l-team.t1-box{border-color:rgba(230,57,70,.3)}
.l-team.t2-box{border-color:rgba(46,204,113,.3)}
.l-team h3{text-align:center;font-size:1.1rem;padding-bottom:.5rem;border-bottom:1px solid var(--glb)}
.l-team.t1-box h3{color:var(--t1l)}
.l-team.t2-box h3{color:var(--t2l)}
.l-team ul{list-style:none;display:flex;flex-wrap:wrap;gap:.4rem}
.l-team li{padding:.4rem .8rem;background:rgba(255,255,255,.05);border-radius:8px;font-size:.9rem;font-weight:600;display:inline-block}
.l-team.t1-box li{border-right:3px solid var(--t1)}
.l-team.t2-box li{border-right:3px solid var(--t2)}
.lobby-actions{display:flex;gap:1rem;width:100%;margin-top:1rem}