/* =============================================================================
   Colored — Painting Online Game
   Dark glass panels, same lime/forest language as the Studio.
   Layouts:  desktop  = tools | board | chat      (3 columns)
             portrait = board / tools / chat       (stacked)
             landscape phone = compact tools | board | chat
   ============================================================================= */
html { cursor: url("assets/brush-cursor.svg") 4 28, auto; }
input, textarea, select { cursor: text; }

.game {
  --g-panel: rgba(16, 23, 19, .88);
  --g-line: rgba(220, 235, 215, .16);
  --g-pr: #A8E063; --g-pr2: #83C944;
  --g-text: #F5F3E9; --g-mut: #B5B9AE; --g-bad: #ffb4a2; --g-warn: #FFB259;
  --g-surf: rgba(255, 255, 255, .07);
  --g-focus: #D8F58A;
  position: fixed; left: 0; right: 0; top: var(--gt, 0px); height: var(--gh, 100dvh); z-index: 30;
  display: flex; flex-direction: column; overflow: hidden;
  color: var(--g-text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  visibility: hidden; opacity: 0; pointer-events: none; transform: scale(.985);
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .35s;
  -webkit-tap-highlight-color: transparent;
}
html.gm-on .game { visibility: visible; opacity: 1; pointer-events: auto; transform: none; transition-delay: 0s; }
html[data-lang="fa"] .game { font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; }
.game [hidden] { display: none !important; }
.game *, .game *::before, .game *::after { box-sizing: border-box; }
:where(.game) button { font: inherit; color: inherit; }
.game :is(a, button, input, select, [tabindex]):focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; box-shadow: none; }
.g-scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 70% at 15% 0%, rgba(168, 224, 99, .12), transparent 60%),
    radial-gradient(80% 60% at 100% 100%, rgba(91, 184, 255, .10), transparent 60%),
    linear-gradient(160deg, #07100a, #0d1c12 55%, #08120c);
}

/* ---------- header ---------- */
.g-head { display: flex; align-items: center; gap: .8rem; padding: clamp(.45rem, 1.6dvh, .9rem) clamp(.7rem, 2vw, 1.6rem) .2rem; flex: none; }
.g-back {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; padding: .4rem .85rem .4rem .5rem; border-radius: 999px;
  background: var(--g-surf); border: 1px solid var(--g-line); font-weight: 600; font-size: .9rem; white-space: nowrap;
  transition: border-color .15s, background-color .15s;
}
.g-back:hover { border-color: rgba(168, 224, 99, .6); background: rgba(255, 255, 255, .1); }
.g-back__ico svg { width: 1.2rem; height: 1.2rem; display: block; }
.game[dir="rtl"] .g-back__ico { transform: scaleX(-1); }
.g-title { margin: 0; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: .55rem; font-size: clamp(1rem, 2.4vw, 1.35rem); font-weight: 800; letter-spacing: .01em; }
.g-title > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-title__ico svg { width: 1.5rem; height: 1.5rem; color: var(--g-pr); display: block; filter: drop-shadow(0 0 8px rgba(168, 224, 99, .5)); }
.g-head__r { display: flex; align-items: center; gap: .6rem; }
.g-conn { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--g-mut); }
.g-conn i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--g-warn); }
.g-conn[data-s="on"] i { background: var(--g-pr); box-shadow: 0 0 8px var(--g-pr); }
.game .g-lang {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px; font-size: .85rem;
  background: var(--g-surf); border: 1px solid var(--g-line); color: var(--g-text);
}
.game .g-lang button { all: unset; cursor: pointer; font-weight: 700; padding: 0 .15rem; border-radius: 6px; color: var(--g-text); }
.game .g-lang button[aria-pressed="true"] { color: var(--g-pr); }
.game .g-lang .bar { width: 1px; height: .9rem; background: var(--g-line); }
.game .g-lang button:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 3px; }

/* ---------- screens + shared bits ---------- */
.g-main { flex: 1; min-height: 0; position: relative; padding: .4rem clamp(.6rem, 2vw, 1.6rem) clamp(.6rem, 1.6dvh, 1.2rem); }
.g-screen { height: 100%; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(168, 224, 99, .35) transparent; animation: gIn .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes gIn { from { opacity: 0; transform: translateY(14px); } }
.g-card {
  background: var(--g-panel); border: 1px solid var(--g-line); border-radius: 22px; padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  display: flex; flex-direction: column; gap: .7rem;
}
.g-card__bar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.g-h { margin: 0; font-size: 1.1rem; font-weight: 800; }
.g-h--lg { font-size: clamp(1.25rem, 3vw, 1.7rem); }
.g-kicker { margin: 0 0 .1rem; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--g-pr); font-weight: 700; }
html[data-lang="fa"] .g-kicker { letter-spacing: 0; text-transform: none; }
.g-sub { margin: 0; color: var(--g-mut); font-size: .9rem; line-height: 1.55; }
.g-lbl { margin-top: .25rem; font-size: .86rem; font-weight: 700; display: block; }
.g-err { margin: 0; min-height: 0; font-size: .85rem; color: var(--g-bad); }
.g-err:empty { display: none; }
.g-pill { font-size: .78rem; padding: .2rem .65rem; border-radius: 999px; background: rgba(168, 224, 99, .14); color: var(--g-pr); font-weight: 700; }
.g-input {
  width: 100%; padding: .7rem .9rem; font: inherit; font-size: 1rem; color: var(--g-text); background: var(--g-surf);
  border: 1px solid var(--g-line); border-radius: 12px; color-scheme: dark;
}
.g-input::placeholder { color: rgba(181, 185, 174, .7); }
.g-go, .g-ghost, .g-join {
  cursor: pointer; font-weight: 800; border-radius: 14px; padding: .8rem 1.2rem; font-size: 1rem; transition: transform .15s, filter .15s, border-color .15s;
}
.g-go { border: 0; color: #14200a; background: linear-gradient(180deg, #B7EC72, var(--g-pr2)); box-shadow: 0 0 22px rgba(168, 224, 99, .38), inset 0 1px 0 rgba(255, 255, 255, .5); }
.g-go:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.g-ghost { color: var(--g-text); background: rgba(255, 255, 255, .05); border: 1px solid var(--g-line); }
.g-ghost:hover { border-color: rgba(168, 224, 99, .6); background: rgba(255, 255, 255, .1); }
.g-go:disabled, .g-join:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.g-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.g-row > .g-go, .g-row > .g-ghost { flex: 1 1 9rem; }
.g-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.g-chips em { font-style: normal; font-size: .74rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: rgba(255, 255, 255, .09); color: var(--g-text); }
.g-chips em.d-easy { background: rgba(168, 224, 99, .2); color: #c8f08f; }
.g-chips em.d-mid { background: rgba(255, 178, 89, .2); color: #ffd09b; }
.g-chips em.d-hard { background: rgba(255, 107, 107, .2); color: #ffb0b0; }
.g-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .3rem; padding: .25rem; border-radius: 14px; background: rgba(0, 0, 0, .28); border: 1px solid var(--g-line); }
.g-seg button { cursor: pointer; border: 0; padding: .55rem .4rem; border-radius: 10px; background: transparent; font-weight: 700; font-size: .92rem; color: var(--g-mut); }
.g-seg button[aria-checked="true"] { background: linear-gradient(180deg, #B7EC72, var(--g-pr2)); color: #14200a; }

.g-toast {
  position: absolute; left: 50%; bottom: 1rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 20;
  padding: .55rem 1rem; border-radius: 12px; background: #0e1611; border: 1px solid var(--g-pr); color: var(--g-text); font-size: .9rem; max-width: 92%;
  transition: opacity .25s, transform .3s;
}
.g-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.g-toast.is-bad { border-color: var(--g-bad); color: var(--g-bad); }

/* ---------- 1. profile ---------- */
.g-profile { width: min(100%, 31rem); margin: clamp(0rem, 3dvh, 2rem) auto; }
.g-avs { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.g-av { cursor: pointer; padding: 0; border: 2px solid var(--g-line); border-radius: 50%; background: var(--g-surf); aspect-ratio: 1; overflow: hidden; transition: transform .15s, border-color .15s, box-shadow .2s; }
.g-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-av:hover { transform: translateY(-2px); }
.g-av[aria-checked="true"] { border-color: var(--g-pr); box-shadow: 0 0 0 3px rgba(168, 224, 99, .35), 0 0 18px rgba(168, 224, 99, .45); transform: scale(1.06); }
.g-profile .g-go { margin-top: .4rem; }
@media (max-width: 440px) { .g-avs { grid-template-columns: repeat(3, 1fr); gap: .6rem; } .g-av { max-width: 5.6rem; margin-inline: auto; width: 100%; } }

/* ---------- 2. lobby browser ---------- */
.g-browse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 370px); gap: clamp(.7rem, 1.4vw, 1.2rem); align-items: start; }
.g-list { min-height: 0; max-height: 100%; }
.g-lobbies { display: flex; flex-direction: column; gap: .55rem; overflow-y: auto; min-height: 4rem; scrollbar-width: thin; scrollbar-color: rgba(168, 224, 99, .35) transparent; }
.g-empty { margin: 1.4rem 0; text-align: center; color: var(--g-mut); }
.g-lob { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; border-radius: 16px; background: var(--g-surf); border: 1px solid var(--g-line); transition: border-color .15s, background-color .15s; }
.g-lob:hover { border-color: rgba(168, 224, 99, .5); background: rgba(255, 255, 255, .1); }
.g-lob__av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--g-line); }
.g-lob__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.g-lob__info b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-lob__meta { font-size: .78rem; color: var(--g-mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-lob__r { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex: none; }
.g-count { font-size: .8rem; font-weight: 700; color: var(--g-pr); }
.g-count.is-full { color: var(--g-warn); }
.g-join { padding: .45rem 1rem; font-size: .88rem; border: 0; color: #14200a; background: linear-gradient(180deg, #B7EC72, var(--g-pr2)); border-radius: 12px; }
.g-join:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.game[dir="rtl"] .g-lob__r { align-items: flex-start; }
@media (max-width: 820px) { .g-browse { grid-template-columns: minmax(0, 1fr); } .g-create { order: -1; } .g-lobbies { max-height: none; } }

/* ---------- 3. waiting room ---------- */
.g-wait { width: min(100%, 52rem); margin: clamp(0rem, 2dvh, 1.2rem) auto; }
.g-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin: .3rem 0; }
.g-slot { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .8rem .5rem; border-radius: 18px; background: var(--g-surf); border: 1px solid var(--g-line); min-width: 0; animation: gIn .4s both; }
.g-slot img { width: clamp(52px, 9vw, 76px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 3px solid var(--g-pr); box-shadow: 0 0 16px rgba(168, 224, 99, .3); }
.g-slot b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.g-slot.is-me { border-color: var(--g-pr); background: rgba(168, 224, 99, .1); }
.g-slot.is-empty { border-style: dashed; opacity: .65; justify-content: center; min-height: 7.6rem; }
.g-slot.is-empty b { color: var(--g-mut); font-weight: 600; }
.g-slot__ph { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; color: var(--g-mut); border: 2px dashed var(--g-line); }
.g-slot__tag { display: flex; gap: .3rem; min-height: 1.2rem; flex-wrap: wrap; justify-content: center; }
.tag { display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; font-weight: 800; padding: .08rem .5rem; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.tag svg { width: .8rem; height: .8rem; }
.tag--host { background: rgba(255, 216, 77, .2); color: #ffd84d; }
@media (min-width: 760px) { .g-slots { grid-template-columns: repeat(6, minmax(0, 1fr)); } .g-slot.is-empty { min-height: 0; } }

/* ---------- 4. play ---------- */
.g-play {
  position: relative; overflow: hidden; display: grid; gap: clamp(.5rem, 1vw, .9rem);
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr) minmax(250px, 340px);
  grid-template-areas: "tools center chat";
  animation: none;
}
.game[dir="rtl"] .g-play { direction: ltr; }
.game[dir="rtl"] .g-play > * { direction: rtl; }
.g-center { grid-area: center; display: flex; flex-direction: column; gap: .5rem; min-width: 0; min-height: 0; }
.g-tools { grid-area: tools; }
.g-chat { grid-area: chat; }
.g-tools, .g-chat {
  min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: .7rem; overflow: hidden;
  background: var(--g-panel); border: 1px solid var(--g-line); border-radius: 20px; padding: .9rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.g-tools { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(168, 224, 99, .35) transparent; }

.g-bar { display: flex; align-items: center; gap: .7rem; padding: .45rem .8rem; border-radius: 16px; background: var(--g-panel); border: 1px solid var(--g-line); min-height: 3rem; }
.g-round { font-size: .82rem; font-weight: 800; color: var(--g-pr); white-space: nowrap; }
.g-word { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: .6rem; text-align: center; font-size: clamp(1.1rem, 2.6vw, 1.7rem); font-weight: 800; }
.gw-lbl { font-size: .78rem; font-weight: 600; color: var(--g-mut); white-space: nowrap; }
.gw-ok { color: var(--g-pr); display: inline-flex; } .gw-ok svg { width: 1.4rem; height: 1.4rem; }
.gw-word { color: var(--g-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-hint { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .12em; line-height: 1.25; direction: ltr; }
.hc { display: inline-block; min-width: .8em; text-align: center; border-bottom: 3px solid currentColor; padding: 0 .04em; line-height: 1.1; }
.hc--b { color: var(--g-mut); } .hc--b::after { content: "\00a0"; }
.hc--sp { border-color: transparent; min-width: .6em; }
.gw-n { font-size: .75rem; font-weight: 700; color: var(--g-mut); align-self: flex-end; }
.g-timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: .95rem; padding: .2rem .65rem; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 1px solid var(--g-line); }

.g-players { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; }
.pl { position: relative; display: flex; align-items: center; gap: .4rem; min-width: 0; padding: .25rem .5rem .25rem .3rem; border-radius: 14px; background: var(--g-panel); border: 1px solid var(--g-line); transition: border-color .2s, background-color .2s; }
.pl img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.pl__t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.pl__t b { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl__t span { font-size: .72rem; color: var(--g-pr); font-weight: 800; font-variant-numeric: tabular-nums; }
.pl.is-me { border-color: rgba(168, 224, 99, .55); }
.pl.is-draw { border-color: var(--g-warn); background: rgba(255, 178, 89, .14); }
.pl.is-ok { background: rgba(168, 224, 99, .16); border-color: var(--g-pr); }
.pl__st { position: absolute; top: -6px; inset-inline-end: -4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--g-warn); color: #1d1405; }
.pl__st svg { width: 12px; height: 12px; }
.pl__st--ok { background: var(--g-pr); color: #14200a; }

.g-stage { flex: 1; min-height: 0; position: relative; }
.g-board { position: absolute; inset: 0; margin: auto; background: #fff; border-radius: 16px; overflow: hidden; container-type: inline-size; box-shadow: 0 16px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .14); }
.g-board canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.is-drawer .g-board canvas { touch-action: none; }
.g-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 14, 10, .88); animation: gIn .3s both; padding: 2cqw; overflow: hidden; }
.ov { text-align: center; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.2cqw; }
.ov p { margin: 0; }
.ov__k { font-size: clamp(.7rem, 2.2cqw, .9rem); color: var(--g-mut); }
.ov__w { font-size: clamp(1.4rem, 7cqw, 3rem); font-weight: 800; color: var(--g-pr); line-height: 1.1; }
.ov__r { font-size: clamp(.75rem, 2.4cqw, 1rem); color: var(--g-text); }
.ov__n { font-size: clamp(.68rem, 2cqw, .85rem); color: var(--g-mut); }
.ov__l { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8cqw 3cqw; width: min(100%, 60cqw); }
.ov__l li, .gm__rest li { display: flex; align-items: center; gap: 1.2cqw; font-size: clamp(.72rem, 2.3cqw, .95rem); }
.ov__l img, .gm__rest img { width: clamp(20px, 4.4cqw, 30px); height: clamp(20px, 4.4cqw, 30px); border-radius: 50%; object-fit: cover; }
.ov__l b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ov__l span { color: var(--g-pr); font-weight: 800; }

/* tools */
.tl { display: flex; flex-direction: column; gap: .8rem; }
.tl-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.tl-mode, .tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer; padding: .6rem .4rem; border-radius: 12px; font-weight: 700; font-size: .88rem;
  background: var(--g-surf); border: 1px solid var(--g-line); transition: border-color .15s, background-color .15s, transform .12s;
}
.tl-mode svg, .tl-btn svg { width: 1.2rem; height: 1.2rem; flex: none; }
.tl-mode:hover, .tl-btn:hover { border-color: rgba(168, 224, 99, .6); }
.tl-mode:active, .tl-btn:active { transform: scale(.96); }
.tl-mode[aria-pressed="true"] { background: linear-gradient(180deg, #B7EC72, var(--g-pr2)); color: #14200a; border-color: transparent; }
.tl-size { display: flex; flex-direction: column; gap: .35rem; }
.tl-size__top { display: flex; align-items: center; gap: .5rem; font-size: .84rem; font-weight: 700; }
.tl-size__top label { flex: 1; min-width: 0; }
.tl-size__val { color: var(--g-pr); font-variant-numeric: tabular-nums; }
.tl-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.tl-dot i { display: block; border-radius: 50%; background: #111; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.g-tools input[type="range"] { direction: ltr; width: 100%; height: 2rem; margin: 0; accent-color: var(--g-pr); background: transparent; cursor: pointer; touch-action: pan-y; }
.tl-colors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; transition: opacity .2s; }
.tl-colors.is-off { opacity: .4; }
.gsw { position: relative; aspect-ratio: 1; width: 100%; min-width: 0; align-self: start; padding: 0; cursor: pointer; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .28); transition: transform .12s, box-shadow .15s; }
.gsw:hover { transform: scale(1.1); }
.gsw[aria-pressed="true"] { transform: scale(1.12); box-shadow: 0 0 0 2px #0d1610, 0 0 0 4px var(--g-pr); }
.gsw--custom { background: conic-gradient(#f44, #fd4, #4d4, #4df, #44f, #f4f, #f44); overflow: hidden; }
.gsw--custom input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; border: 0; padding: 0; }
.gsw--custom:focus-within { box-shadow: 0 0 0 2px #0d1610, 0 0 0 4px var(--g-focus); }
.tl-acts { display: grid; grid-template-columns: 1fr; gap: .4rem; margin-top: auto; }
.tl-btn--danger { color: #ffb4a2; border-color: rgba(255, 180, 162, .4); }
.tl-btn--danger:hover { background: rgba(255, 107, 107, .16); border-color: #ffb4a2; }

/* guesser info card (replaces the tools) */
.gi { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: .4rem .2rem; }
.gi__av { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--g-warn); box-shadow: 0 0 18px rgba(255, 178, 89, .4); }
.gi__who { margin: 0; font-weight: 800; font-size: 1.05rem; }
.gi__help { margin: 0; font-size: .85rem; color: var(--g-mut); line-height: 1.55; }
.gi .g-chips { justify-content: center; }
.is-drawer .gi, .is-guesser .tl { display: none; }

/* chat */
.g-chat__h { margin: 0; font-size: .95rem; font-weight: 800; flex: none; }
.g-msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: .25rem; padding-inline-end: .2rem; scrollbar-width: thin; scrollbar-color: rgba(168, 224, 99, .35) transparent; }
.cm { font-size: .88rem; line-height: 1.45; padding: .3rem .55rem; border-radius: 10px; background: rgba(255, 255, 255, .05); overflow-wrap: anywhere; animation: gIn .25s both; }
.cm b { color: var(--g-pr); margin-inline-end: .4em; }
.cm[data-me] b { color: #ffd84d; }
.cm--sys { background: none; color: var(--g-mut); font-style: normal; font-size: .8rem; padding-block: .1rem; }
.cm--ok { background: rgba(168, 224, 99, .18); color: #d6f5a4; font-weight: 700; }
.cm--private { background: rgba(124, 58, 237, .2); }
.cm--private svg { width: .8rem; height: .8rem; margin-inline-end: .3em; vertical-align: -1px; color: #c4b5fd; }
.g-send { display: flex; gap: .4rem; flex: none; }
.g-send input { flex: 1; min-width: 0; padding: .65rem .8rem; font: inherit; font-size: 16px; color: var(--g-text); background: var(--g-surf); border: 1px solid var(--g-line); border-radius: 12px; color-scheme: dark; }
.g-send input:disabled { opacity: .55; }
.g-sendbtn { width: 2.9rem; flex: none; cursor: pointer; border: 0; border-radius: 12px; display: grid; place-items: center; color: #14200a; background: linear-gradient(180deg, #B7EC72, var(--g-pr2)); }
.g-sendbtn svg { width: 1.2rem; height: 1.2rem; }
.game[dir="rtl"] .g-sendbtn svg { transform: scaleX(-1); }
.g-sendbtn:disabled { opacity: .5; cursor: not-allowed; }

/* game-over modal */
.g-modal { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; overflow: auto; padding: 1rem; background: rgba(6, 12, 8, .86); border-radius: 22px; animation: gIn .4s both; }
.gm { width: min(100%, 34rem); display: flex; flex-direction: column; align-items: center; gap: .8rem; text-align: center; }
.gm__win { margin: 0; display: inline-flex; align-items: center; gap: .5rem; color: #ffd84d; font-size: 1.05rem; }
.gm__win svg { width: 1.5rem; height: 1.5rem; }
.pod { display: flex; align-items: flex-end; justify-content: center; gap: .6rem; width: 100%; min-height: 9rem; }
.pod__c { position: relative; flex: 1; max-width: 9.5rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .7rem .4rem 1.6rem; border-radius: 16px 16px 6px 6px; background: var(--g-surf); border: 1px solid var(--g-line); min-width: 0; }
.pod__c img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 3px solid var(--g-line); }
.pod__c b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.pod__c span { font-size: .8rem; color: var(--g-pr); font-weight: 800; }
.pod__c i { position: absolute; bottom: .3rem; font-style: normal; font-weight: 800; font-size: 1rem; color: var(--g-mut); }
.pod__c--1 { padding-bottom: 2.4rem; background: rgba(255, 216, 77, .14); border-color: #ffd84d; } .pod__c--1 img { border-color: #ffd84d; width: 68px; height: 68px; } .pod__c--1 i { color: #ffd84d; }
.pod__c--2 { padding-bottom: 1.8rem; } .pod__c--2 img { border-color: #cbd5e1; }
.pod__c--3 { padding-bottom: 1.2rem; } .pod__c--3 img { border-color: #d6a66b; }
.gm__rest { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: .35rem; }
.gm__rest li { padding: .3rem .6rem; border-radius: 10px; background: var(--g-surf); font-size: .9rem; }
.gm__rest b { flex: 1; min-width: 0; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gm__rest span { color: var(--g-pr); font-weight: 800; }
.gm .g-row { width: 100%; }

/* ======================= portrait / narrow: board, tools, chat stacked ======================= */
@media (max-width: 820px) and (min-height: 501px) {
  .g-play { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(170px, 1fr); grid-template-areas: "center" "tools" "chat"; overflow-y: auto; scrollbar-width: none; }
  .g-center { min-height: auto; }
  .g-center .g-stage { flex: none; width: 100%; aspect-ratio: 3 / 2; }
  .g-bar { padding: .3rem .6rem; min-height: 2.6rem; gap: .5rem; }
  .g-word { font-size: clamp(1rem, 5vw, 1.4rem); }
  .gw-lbl { display: none; }
  .g-players { gap: .3rem; }
  .pl { flex-direction: column; gap: .1rem; padding: .3rem .2rem; border-radius: 12px; }
  .pl img { width: 28px; height: 28px; }
  .pl__t { align-items: center; max-width: 100%; }
  .pl__t b { font-size: .62rem; max-width: 100%; }
  .pl__t span { font-size: .68rem; }
  .pl__st { top: -5px; inset-inline-end: -2px; width: 17px; height: 17px; }
  .g-tools { padding: .6rem; border-radius: 16px; overflow: visible; }
  .is-guesser .g-tools { display: none; }
  .tl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "modes size acts" "colors colors colors"; gap: .5rem .6rem; align-items: center; }
  .tl-modes { grid-area: modes; display: flex; }
  .tl-size { grid-area: size; }
  .tl-size__top label, .tl-size__val { display: none; }
  .tl-size__top { order: 2; justify-content: flex-start; }
  .tl-size { flex-direction: row; align-items: center; gap: .5rem; }
  .tl-size input { order: 1; }
  .tl-dot { width: 30px; height: 30px; }
  .tl-colors { grid-area: colors; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: .35rem; }
  .tl-acts { grid-area: acts; display: flex; margin: 0; }
  .tl-mode span, .tl-btn span { display: none; }
  .tl-mode, .tl-btn { padding: .55rem .65rem; min-width: 2.6rem; }
  .g-chat { padding: .6rem; border-radius: 16px; min-height: 170px; }
  .g-chat__h { display: none; }
  .g-modal { position: fixed; inset: auto 0 0 0; top: 0; border-radius: 0; }
}
@media (max-width: 480px) { .g-title > span:last-child { display: none; } .g-conn > span { display: none; } }

/* ======================= landscape phone: three compact columns ======================= */
@media (max-height: 500px) {
  .g-head { padding: .3rem .8rem 0; gap: .5rem; }
  .g-back { padding: .25rem .65rem .25rem .35rem; font-size: .8rem; }
  .g-title { font-size: .95rem; } .g-title__ico svg { width: 1.1rem; height: 1.1rem; }
  .game .g-lang { padding: .2rem .55rem; font-size: .75rem; }
  .g-main { padding: .3rem .6rem .5rem; }
  .g-play { grid-template-columns: minmax(104px, 148px) minmax(0, 1fr) minmax(150px, 230px); gap: .45rem; }
  .g-bar { min-height: 2.1rem; padding: .15rem .6rem; border-radius: 12px; }
  .g-word { font-size: clamp(.9rem, 3.4vh, 1.2rem); } .gw-lbl { display: none; }
  .g-timer { font-size: .78rem; padding: .1rem .5rem; } .g-round { font-size: .72rem; }
  .g-players { gap: .25rem; }
  .pl { flex-direction: row; padding: .12rem .3rem .12rem .15rem; gap: .25rem; border-radius: 10px; }
  .pl img { width: 22px; height: 22px; } .pl__t b { display: none; } .pl__t span { font-size: .68rem; }
  .pl__st { width: 14px; height: 14px; top: -5px; } .pl__st svg { width: 9px; height: 9px; }
  .g-tools, .g-chat { padding: .45rem; border-radius: 14px; gap: .4rem; }
  .tl { gap: .4rem; }
  .tl-mode span, .tl-btn span { display: none; }
  .tl-mode, .tl-btn { padding: .4rem; }
  .tl-size__top { font-size: .7rem; } .tl-dot { width: 24px; height: 24px; }
  .g-tools input[type="range"] { height: 1.5rem; }
  .tl-colors { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; }
  .tl-acts { display: grid; grid-template-columns: 1fr 1fr; }
  .gi__av { width: 44px; height: 44px; } .gi__who { font-size: .8rem; } .gi__help { font-size: .7rem; line-height: 1.35; } .gi .g-chips { display: none; }
  .g-chat__h { display: none; }
  .cm { font-size: .78rem; padding: .2rem .4rem; }
  .g-send input { padding: .4rem .6rem; } .g-sendbtn { width: 2.3rem; }
  .g-board { border-radius: 10px; }
  .g-profile, .g-wait { margin-top: 0; } .g-card { padding: .8rem 1rem; gap: .5rem; border-radius: 16px; }
  .g-avs { grid-template-columns: repeat(6, 1fr); } .g-av { max-width: 3.4rem; }
  .g-slot { padding: .4rem; } .g-slot.is-empty { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .game, .g-screen, .g-slot, .cm, .g-overlay, .g-modal { animation: none !important; transition: opacity .2s !important; transform: none !important; }
}
