/* VIVE Game Feel V1 · room lobby + shared competition and drawer stage */
/* This stylesheet is used only by public/competition.html and public/draw.html. */

/* Rubik / Heebo load from the page, with system fallbacks for offline or blocked-font cases. */
body[data-page="competition"].competition-game-body,
body[data-page="draw"].competition-game-body {
  font-family: "Rubik", "Heebo", "Arial Hebrew", Arial, sans-serif;
}


body[data-page="competition"].competition-game-body,
body[data-page="draw"].competition-game-body {
  min-height: 100vh;
  overflow-x: hidden;
  color: #f7f8fb;
  background:
    radial-gradient(circle at 50% -18%, rgba(135, 99, 231, .18), transparent 42%),
    radial-gradient(circle at 6% 90%, rgba(34, 190, 151, .08), transparent 34%),
    #050608;
}

body[data-page="competition"].competition-game-body *,
body[data-page="draw"].competition-game-body * {
  box-sizing: border-box;
}

.competition-game-shell {
  width: min(1440px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 2.2vw, 34px) 0 clamp(28px, 4vw, 62px);
}

/* Short game-event toast. It never owns the word area and always fades away through JS. */
body[data-page="competition"] .correct-banner,
body[data-page="draw"] .correct-banner {
  position: fixed;
  z-index: 50;
  top: clamp(146px, 16vh, 214px);
  right: 50%;
  left: auto;
  width: min(78vw, 720px);
  max-width: calc(100% - 30px);
  transform: translate(50%, -10px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 17px;
  border: 1px solid rgba(255, 216, 222, .32);
  border-radius: 999px;
  background: rgba(45, 38, 46, .72);
  color: #fff8fa;
  box-shadow: 0 14px 42px rgba(0, 0, 0, .3);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  font-size: clamp(12px, 1.15vw, 17px);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .2s ease, transform .2s ease;
}

body[data-page="competition"] .correct-banner.show,
body[data-page="draw"] .correct-banner.show {
  transform: translate(50%, 0);
  opacity: 1;
}

/* ---------- The room ---------- */

.competition-room {
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  min-height: min(760px, calc(100vh - 54px));
  padding: clamp(16px, 2.4vw, 38px);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: clamp(24px, 3vw, 44px);
  background: rgba(12, 14, 18, .66);
  box-shadow: 0 28px 100px rgba(0, 0, 0, .32);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.room-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.room-logo {
  justify-self: start;
  color: rgba(247, 248, 251, .72);
  text-decoration: none;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 850;
}

.room-header-center {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: .42em;
  min-width: 0;
}

.room-header-center h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(34px, 6.4vw, 82px);
  line-height: .95;
  letter-spacing: -.08em;
}

.room-count,
.room-phase {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  color: rgba(255, 255, 255, .74);
  font-size: clamp(11px, .9vw, 14px);
  font-weight: 900;
  white-space: nowrap;
}

.room-phase {
  justify-self: end;
  color: #dbffe8;
  border-color: rgba(122, 245, 171, .22);
  background: rgba(92, 229, 140, .10);
}

.room-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  width: min(650px, 100%);
  margin: 0 auto;
}

.room-guest-join {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  width: min(650px, 100%);
  margin: 4px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
}

.room-guest-join[hidden] {
  display: none !important;
}

.room-guest-join input {
  height: 50px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(255, 255, 255, .07);
  color: #ffffff;
  box-shadow: none;
  text-align: center;
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 900;
}

.room-guest-join input::placeholder {
  color: rgba(255, 255, 255, .4);
}

.room-guest-join-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 950;
  border-color: rgba(133, 204, 255, .42);
  background: linear-gradient(135deg, rgba(50, 126, 214, .95), rgba(26, 92, 188, .95));
  color: #eff7ff;
}

.room-guest-join-button:hover {
  border-color: rgba(191, 227, 255, .92);
  background: linear-gradient(135deg, rgba(83, 150, 244, 1), rgba(38, 109, 216, 1));
}

.room-guest-note {
  color: rgba(232, 241, 248, .64);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.room-guest-note a {
  color: #d8f2ff;
  text-decoration: none;
}

.room-guest-note a:hover {
  text-decoration: underline;
}

.competition-player-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  margin-inline-end: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 212, 117, .16);
  border: 1px solid rgba(255, 212, 117, .24);
  color: #ffe9ab;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .02em;
}

body[data-page="host"] .competition-guest-toggle {
  display: grid;
  gap: 6px;
}

body[data-page="host"] .competition-guest-toggle input {
  width: 18px;
  height: 18px;
  margin-inline-start: 8px;
  vertical-align: middle;
}

body[data-page="host"] .competition-guest-toggle small {
  color: rgba(230, 239, 246, .65);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.room-entry input {
  height: 54px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 17px;
  background: rgba(255, 255, 255, .07);
  color: #ffffff;
  box-shadow: none;
  text-align: center;
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 900;
}

.room-entry input::placeholder {
  color: rgba(255, 255, 255, .4);
}

.room-join-button,
.room-leave-button {
  min-height: 54px;
  padding: 0 22px;
  border-radius: 17px;
  font-weight: 950;
  white-space: nowrap;
}

.room-join-button {
  border-color: rgba(138, 255, 184, .66);
  background: linear-gradient(135deg, rgba(82, 239, 140, .95), rgba(36, 181, 115, .95));
  color: #07130d;
}

.room-join-button:hover {
  border-color: rgba(214, 255, 229, .9);
  background: linear-gradient(135deg, rgba(113, 255, 166, 1), rgba(49, 211, 132, 1));
}

.room-leave-button {
  border-color: rgba(255, 183, 194, .28);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 231, 236, .9);
}

.room-self-status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: rgba(238, 245, 249, .62);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.room-seat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.3vw, 18px);
  width: min(1060px, 100%);
  margin: auto;
}

.room-seat {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  min-height: clamp(126px, 15vw, 178px);
  padding: 13px 8px;
  overflow: hidden;
  border: 1px solid hsla(var(--avatar-hue, 208), 75%, 78%, .28);
  border-radius: clamp(20px, 2vw, 30px);
  background:
    radial-gradient(circle at 50% 18%, hsla(var(--avatar-hue, 208), 75%, 62%, .16), transparent 54%),
    rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px rgba(255, 255, 255, .07);
  animation: room-seat-enter .36s cubic-bezier(.2,.9,.3,1) both;
}

.room-seat::after {
  content: "";
  position: absolute;
  inset: auto -22% -50% -22%;
  height: 74%;
  border-radius: 50%;
  background: hsla(var(--avatar-hue, 208), 80%, 65%, .10);
  filter: blur(16px);
  pointer-events: none;
}

.room-seat b,
.room-seat small,
.room-avatar,
.room-seat-badge {
  position: relative;
  z-index: 1;
}

.room-seat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 212, 117, .18);
  border: 1px solid rgba(255, 212, 117, .28);
  color: #ffe9ab;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .02em;
}

.room-seat b {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: clamp(12px, 1.1vw, 17px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-seat small {
  color: rgba(235, 244, 249, .61);
  font-size: 11px;
  font-weight: 850;
}

.room-seat.is-self {
  border-color: rgba(130, 255, 181, .72);
  box-shadow: 0 0 0 2px rgba(104, 255, 162, .10), 0 16px 42px rgba(44, 227, 127, .12);
}

.room-seat.is-drawing {
  border-color: rgba(255, 203, 108, .8);
  box-shadow: 0 0 0 2px rgba(255, 188, 72, .12), 0 15px 44px rgba(255, 161, 59, .12);
}

.room-seat-empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .02);
  box-shadow: none;
}

.room-seat-empty::after { display: none; }

.room-seat-plus {
  color: rgba(255, 255, 255, .18);
  font-size: clamp(25px, 3vw, 42px);
  font-weight: 300;
}

.room-avatar {
  display: grid;
  width: clamp(42px, 4.8vw, 66px);
  height: clamp(42px, 4.8vw, 66px);
  place-items: center;
  border: 1px solid hsla(var(--avatar-hue, 208), 82%, 87%, .36);
  border-radius: 50%;
  background: linear-gradient(135deg, hsla(var(--avatar-hue, 208), 82%, 66%, .92), hsla(calc(var(--avatar-hue, 208) + 42), 70%, 52%, .92));
  box-shadow: 0 9px 20px hsla(var(--avatar-hue, 208), 70%, 45%, .22);
  font-size: clamp(24px, 2.8vw, 39px);
  line-height: 1;
}

.room-avatar.mini {
  width: 28px;
  height: 28px;
  border-width: 1px;
  box-shadow: none;
  font-size: 17px;
}

.room-message {
  min-height: 22px;
  color: rgba(239, 243, 247, .52);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

/* ---------- Shared live game stage ---------- */

.competition-live-game {
  display: none;
  gap: 12px;
}

body[data-page="competition"].competition-playing-mode .competition-room {
  display: none;
}

body[data-page="competition"].competition-playing-mode .competition-live-game {
  display: grid;
}

.draw-game-shell {
  display: grid;
  gap: 12px;
}

.game-topline {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 104px;
  padding-top: 4px;
  text-align: center;
}

.game-word-area {
  min-width: min(92vw, 980px);
}

.game-word-mask {
  color: #ffffff;
  font-size: clamp(29px, 4vw, 74px);
  font-weight: 950;
  letter-spacing: clamp(.045em, .09vw, .12em);
  line-height: 1.04;
  text-shadow: 0 7px 26px rgba(255, 255, 255, .12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-word-answer {
  color: #fcfff7;
  letter-spacing: -.04em;
}

.game-word-meta {
  min-height: 14px;
  margin-top: 4px;
  color: rgba(237, 244, 251, .44);
  font-size: clamp(10px, .85vw, 13px);
  font-weight: 850;
}

.game-timer {
  display: inline-grid;
  place-items: center;
  min-width: clamp(96px, 9.4vw, 160px);
  min-height: clamp(40px, 4.2vw, 62px);
  padding: 6px 15px;
  border: 1px solid rgba(255, 187, 95, .34);
  border-radius: 18px;
  background: rgba(255, 132, 43, .14);
  color: #ffbd6f;
  box-shadow: inset 0 0 24px rgba(255, 162, 75, .08), 0 10px 28px rgba(0,0,0,.18);
  font-size: clamp(22px, 2.4vw, 39px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  transition: color .22s ease, background .22s ease, border-color .22s ease, transform .22s ease;
}

.timer-warning .game-timer {
  color: #ffd470;
  border-color: rgba(255, 217, 112, .52);
  background: rgba(255, 183, 50, .16);
}

.timer-critical .game-timer {
  color: #fff3ef;
  border-color: rgba(255, 122, 104, .74);
  background: rgba(190, 47, 35, .34);
  animation: timer-pulse .74s ease-in-out infinite alternate;
}

.timer-finished .game-timer {
  color: rgba(255, 255, 255, .54);
  background: rgba(255, 255, 255, .06);
}

.game-notification-space {
  min-height: clamp(18px, 2.2vh, 31px);
}

.competition-game-layout {
  display: grid;
  grid-template-columns: minmax(145px, 18%) minmax(0, 1fr);
  direction: ltr;
  align-items: start;
  gap: clamp(10px, 1.25vw, 19px);
  width: min(100%, 1380px);
  margin: 0 auto;
}

.game-scoreboard,
.game-canvas-column {
  direction: rtl;
}

.game-scoreboard {
  overflow: visible;
  display: grid;
  gap: 10px;
  padding: 10px 10px 8px;
  border: 1px solid rgba(201, 177, 255, .22);
  border-radius: 20px;
  background: rgba(73, 57, 100, .33);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 12px 38px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.game-scoreboard-title {
  margin: 1px 4px 6px;
  color: rgba(246, 240, 255, .72);
  font-size: 11px;
  font-weight: 950;
}

.game-score-row {
  display: grid;
  grid-template-columns: 1.7em 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 3px 4px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  transform-origin: center;
}

.game-score-row:first-child { border-top: 0; }

.game-score-row.is-self {
  margin-inline: -2px;
  border-radius: 11px;
  background: rgba(115, 255, 174, .10);
}

.game-score-row.is-drawing {
  background: rgba(255, 193, 97, .11);
}

.game-score-rank {
  color: rgba(224, 211, 255, .78);
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.game-score-name {
  overflow: hidden;
  color: rgba(255, 255, 255, .92);
  font-size: clamp(10px, .88vw, 14px);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-score-value {
  color: #fff3c8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.game-score-empty {
  padding: 10px 4px;
  color: rgba(255, 255, 255, .42);
  font-size: 11px;
  font-weight: 800;
}

.game-score-row.rank-rise { animation: rank-rise .62s cubic-bezier(.2,.85,.25,1) both; }
.game-score-row.rank-fall { animation: rank-fall .55s cubic-bezier(.2,.85,.25,1) both; }

.game-canvas-column { min-width: 0; }

.game-canvas-wrap {
  width: 100%;
  min-height: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: clamp(16px, 1.8vw, 28px);
  background: #fbfffc !important;
  box-shadow: 0 20px 52px rgba(0, 0, 0, .28);
}

.game-canvas-wrap canvas {
  min-height: 0 !important;
  cursor: default;
}

body[data-page="draw"].drawer-active .game-canvas-wrap canvas {
  cursor: crosshair;
}

.game-drawer-tag {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: .42em;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border: 1px solid rgba(244, 226, 189, .26);
  border-radius: 999px;
  background: rgba(18, 18, 21, .62);
  color: rgba(255, 242, 211, .88);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: clamp(11px, .95vw, 14px);
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-drawer-tag.is-you {
  border-color: rgba(117, 255, 171, .56);
  background: rgba(22, 93, 58, .66);
  color: #e5ffef;
}

.game-drawer-tag b {
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-chat-hint {
  margin-top: 8px;
  color: rgba(255, 192, 92, .88);
  font-size: clamp(10px, .9vw, 14px);
  font-weight: 900;
  text-align: center;
}

.game-turn-strip {
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  gap: .35em;
  width: 100%;
  margin-top: 3px;
  color: rgba(232, 237, 242, .4);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.game-turn-strip b {
  color: rgba(241, 245, 250, .72);
  font-variant-numeric: tabular-nums;
}

.game-draw-link {
  display: inline-flex;
  justify-content: center;
  width: min(100%, 360px);
  margin: 10px auto 0;
  padding: 12px 16px;
  border: 1px solid rgba(126, 255, 181, .7);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(83, 241, 142, .95), rgba(35, 182, 111, .95));
  color: #07130d;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(28, 208, 114, .18);
}

body[data-page="competition"].competition-finished-mode .game-topline,
body[data-page="competition"].competition-finished-mode .game-notification-space,
body[data-page="competition"].competition-finished-mode .competition-game-layout {
  display: none;
}

.competition-finale {
  width: min(1180px, 100%);
  margin: clamp(18px, 3vh, 42px) auto 0;
}

.competition-finale[hidden] { display: none; }

.competition-finale-card {
  display: grid;
  gap: clamp(14px, 1.9vw, 24px);
  padding: clamp(22px, 4vw, 54px);
  overflow: hidden;
  border: 1px solid rgba(255, 218, 124, .28);
  border-radius: clamp(26px, 3vw, 42px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 211, 96, .19), transparent 42%),
    radial-gradient(circle at 14% 100%, rgba(101, 255, 168, .11), transparent 34%),
    rgba(14, 15, 21, .82);
  box-shadow: 0 28px 90px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.08);
  text-align: center;
}

.competition-finale-kicker {
  color: #ffe59c;
  font-size: clamp(12px, 1vw, 16px);
  font-weight: 950;
}

.competition-finale-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(40px, 7vw, 96px);
  line-height: .95;
  font-weight: 950;
}

.competition-finale-card p {
  margin: 0;
  color: rgba(241, 246, 250, .62);
  font-size: clamp(12px, 1.2vw, 17px);
  font-weight: 800;
}

.competition-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(10px, 1.3vw, 18px);
}

.competition-podium-seat {
  display: grid;
  gap: 6px;
  min-height: 150px;
  align-content: center;
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 24px;
  background: rgba(255,255,255,.055);
}

.competition-podium-seat.rank-one {
  min-height: 190px;
  border-color: rgba(255, 218, 95, .58);
  background: linear-gradient(180deg, rgba(255, 208, 76, .20), rgba(255,255,255,.06));
  box-shadow: 0 18px 50px rgba(255, 185, 40, .12);
}

.competition-podium-seat.rank-two { order: -1; }

.competition-podium-seat span {
  color: rgba(255, 230, 163, .82);
  font-size: 12px;
  font-weight: 950;
}

.competition-podium-seat b {
  overflow: hidden;
  color: #ffffff;
  font-size: clamp(18px, 2.2vw, 32px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.competition-podium-seat strong,
.competition-podium-seat em {
  color: rgba(255,255,255,.78);
  font-style: normal;
  font-weight: 900;
}

.competition-podium-seat em { color: #ffd978; }

.competition-final-list {
  display: grid;
  gap: 6px;
  width: min(860px, 100%);
  margin: 0 auto;
}

.competition-final-row {
  display: grid;
  grid-template-columns: 3em minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  text-align: start;
}

.competition-final-row.is-self,
.competition-podium-seat.is-self {
  border-color: rgba(126, 255, 181, .48);
  box-shadow: 0 0 0 2px rgba(95, 255, 162, .08);
}

.competition-final-row b {
  overflow: hidden;
  color: #ffffff;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.competition-final-rank {
  color: #ffe098;
  font-weight: 950;
}

.competition-final-row strong {
  color: #ffd978;
  white-space: nowrap;
}

.competition-final-empty {
  color: rgba(255,255,255,.6);
  font-weight: 800;
}

/* ---------- Drawer tools: compact, visual, only when the private drawer token is valid ---------- */

.draw-tool-dock {
  display: none;
  grid-template-columns: auto minmax(90px, 150px) auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: min(100%, 1180px);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: rgba(20, 22, 26, .72);
  box-shadow: 0 12px 42px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow-x: clip;
}

.game-canvas-column .draw-tool-dock {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 8px 0 0;
  margin-left: 0;
  margin-right: 0;
  justify-self: stretch;
}

body[data-page="draw"].drawer-active .draw-tool-dock { display: grid; }

.draw-tool-dock select,
.draw-tool-dock input[type="color"] {
  width: auto;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 0 10px;
  border-radius: 12px;
}

.draw-tool-dock select {
  color: #f6f8fc;
  background: rgba(255, 255, 255, .08);
  text-align: center;
  font-size: 18px;
}

.draw-tool-dock input[type="range"] {
  width: 100%;
}

.draw-tool-dock input[type="color"] {
  padding: 2px;
}

.draw-tool-dock button {
  color: #f9fbff;
  background: rgba(255, 255, 255, .09);
  font-size: 20px;
  font-weight: 900;
}

.draw-tool-dock .swatches {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.draw-tool-dock .swatch {
  min-width: 0;
}
/* Small-screen and vertical stream layout. */
@media (max-width: 760px) {
  .competition-game-shell {
    width: min(100% - 14px, 1440px);
    padding-top: 10px;
  }

  .competition-room {
    min-height: calc(100vh - 20px);
    padding: 16px 12px;
    border-radius: 24px;
  }

  .room-header {
    grid-template-columns: 1fr auto;
  }

  .room-logo { display: none; }
  .room-header-center { justify-self: start; }
  .room-header-center h1 { font-size: clamp(32px, 10vw, 58px); }
  .room-seat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .room-seat { min-height: 122px; }

  .game-topline { min-height: 90px; }
  .game-word-mask { font-size: clamp(26px, 8vw, 48px); }
  .game-timer { min-width: 95px; min-height: 40px; font-size: 25px; }

  .competition-game-layout {
    grid-template-columns: minmax(76px, 22%) minmax(0, 1fr);
    gap: 7px;
  }

  .game-scoreboard {
    padding: 7px 6px;
    border-radius: 15px;
  }

  .game-scoreboard-title { margin: 1px 3px 4px; font-size: 10px; }
  .game-score-row { grid-template-columns: 1.4em minmax(0, 1fr) auto; gap: 3px; min-height: 27px; padding: 2px; }
  .game-score-row .room-avatar { display: none; }
  .game-score-name { font-size: 10px; }
  .game-score-value { font-size: 10px; }

  .game-drawer-tag { right: 7px; bottom: 7px; font-size: 10px; }
  .game-chat-hint { margin-top: 6px; font-size: 10px; }
  .competition-finale-card { padding: 18px 12px; border-radius: 24px; }
  .competition-podium { grid-template-columns: 1fr; }
  .competition-podium-seat,
  .competition-podium-seat.rank-one { order: 0; min-height: 104px; }
  .competition-final-row { grid-template-columns: 2.7em minmax(0, 1fr) auto; gap: 6px; font-size: 12px; }
  .competition-final-row strong { grid-column: 2 / -1; justify-self: start; }

  .draw-tool-dock {
    grid-template-columns: auto minmax(72px, 1fr) auto auto auto;
    gap: 6px;
    padding: 8px;
  }

  .draw-tool-dock .swatches {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  body[data-page="competition"] .correct-banner,
  body[data-page="draw"] .correct-banner {
    top: 128px;
    width: calc(100% - 22px);
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .room-entry { grid-template-columns: 1fr auto; }
  .room-leave-button { grid-column: 1 / -1; }
  .room-seat-grid { gap: 8px; }
  .room-seat { min-height: 105px; border-radius: 18px; }
  .room-avatar { width: 42px; height: 42px; font-size: 24px; }
}

@keyframes room-seat-enter {
  from { opacity: 0; transform: translateY(9px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes timer-pulse {
  from { transform: scale(1); box-shadow: 0 8px 22px rgba(123, 22, 17, .16); }
  to { transform: scale(1.05); box-shadow: 0 12px 36px rgba(255, 65, 48, .32); }
}

@keyframes rank-rise {
  0% { transform: translateY(18px) scale(.94); opacity: .25; }
  48% { transform: translateY(-4px) scale(1.05); opacity: 1; background: rgba(100, 255, 164, .20); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes rank-fall {
  0% { transform: translateY(-14px) scale(1.02); }
  42% { transform: translateY(4px) scale(.97); background: rgba(255, 155, 155, .13); }
  100% { transform: translateY(0) scale(1); }
}


/* VIVE Competition Gameplay V1.1 · readable masks, real word choice, one-click next round */
.game-word-mask,
.game-word-answer {
  font-family: "Rubik", "Heebo", "Arial Hebrew", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: .035em;
  word-spacing: .26em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
  text-rendering: optimizeLegibility;
}
.game-word-mask[dir="ltr"],
.game-word-answer[dir="ltr"] { direction: ltr; text-align: center; }
.game-word-mask[dir="rtl"],
.game-word-answer[dir="rtl"] { direction: rtl; text-align: center; }

/* The actual word break stays obvious on all engines, including OBS CEF and mobile Safari. */
.game-word-mask { font-size: clamp(34px, 4vw, 72px); line-height: 1.18; }
.game-word-answer { font-size: clamp(30px, 3.7vw, 66px); line-height: 1.18; }

.word-choice-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(3, 5, 8, .78);
  backdrop-filter: blur(15px) saturate(120%);
  -webkit-backdrop-filter: blur(15px) saturate(120%);
}
.word-choice-overlay[hidden] { display: none; }
.word-choice-card {
  width: min(720px, 100%);
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: clamp(24px, 4vw, 38px);
  background: rgba(24, 27, 34, .86);
  box-shadow: 0 28px 90px rgba(0,0,0,.52);
  text-align: center;
}
.word-choice-kicker { color: #7fffb4; font-size: 13px; font-weight: 900; letter-spacing: .06em; }
.word-choice-card h2 { margin: 8px 0 6px; font-size: clamp(31px, 6vw, 62px); line-height: 1; }
.word-choice-card p { margin: 0 0 14px; color: rgba(255,255,255,.66); font-size: clamp(13px, 2vw, 17px); font-weight: 700; }
.word-choice-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.word-choice-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 86px;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  background: rgba(255,255,255,.065);
  color: #fff;
  cursor: pointer;
  font: inherit;
  text-align: start;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.word-choice-option:hover:not(:disabled), .word-choice-option:focus-visible:not(:disabled) {
  transform: translateY(-3px) scale(1.015);
  border-color: rgba(124,255,182,.74);
  background: rgba(73, 209, 128, .17);
  box-shadow: 0 13px 26px rgba(38, 206, 116, .14);
  outline: none;
}
.word-choice-option:disabled { opacity: .55; cursor: wait; }
.word-choice-option span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,177,69,.2); color: #ffe2a7; font-size: 13px; font-weight: 950; }
.word-choice-option b { min-width: 0; overflow: visible; font-size: clamp(16px, 2.5vw, 25px); font-weight: 900; white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.25; unicode-bidi: plaintext; }
.word-choice-status { min-height: 1.3em; margin-top: 14px; color: #ffd394; font-weight: 800; }

@media (max-width: 760px) {
  .game-word-mask { font-size: clamp(30px, 9vw, 54px); word-spacing: .2em; }
  .game-word-answer { font-size: clamp(28px, 8vw, 48px); }
  .word-choice-options { grid-template-columns: 1fr; }
  .word-choice-option { min-height: 68px; }
}


/* VIVE Competition v1.2 · one persistent game screen + visual drawing dock */
.competition-game-body,
.competition-game-body button,
.competition-game-body input,
.competition-game-body select {
  font-family: "Rubik", "Heebo", "Arial Hebrew", Arial, sans-serif;
}

.competition-game-shell {
  width: min(calc(100% - 26px), 1420px);
  padding: 12px 0 22px;
}

.draw-game-shell {
  min-height: 100vh;
  align-content: start;
}

.game-topline {
  min-height: 146px;
  gap: 9px;
}

.game-word-area {
  min-width: min(94vw, 1120px);
}

.game-word-mask {
  font-size: clamp(42px, 5.1vw, 86px);
  letter-spacing: .035em;
  word-spacing: .26em;
}

.game-word-answer {
  font-size: clamp(40px, 4.65vw, 80px);
}

.game-word-mask.word-fit-medium,
.game-word-answer.word-fit-medium {
  font-size: clamp(35px, 4.25vw, 72px);
  letter-spacing: .024em;
  word-spacing: .18em;
}

.game-word-mask.word-fit-small,
.game-word-answer.word-fit-small {
  font-size: clamp(29px, 3.45vw, 58px);
  letter-spacing: .016em;
  word-spacing: .12em;
}

.game-word-mask.word-fit-extra-small,
.game-word-answer.word-fit-extra-small {
  font-size: clamp(23px, 2.75vw, 46px);
  letter-spacing: .008em;
  word-spacing: .06em;
}
.game-word-mask.has-mask-parts {
  --word-mask-letter-gap: .035em;
  --word-mask-slot-width: .42em;
  --word-mask-word-gap-base: .26em;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: calc(var(--word-mask-word-gap-base) + (var(--word-mask-slot-width) * .5));
  unicode-bidi: isolate;
}
.game-word-mask.has-mask-parts .word-mask-part {
  display: inline-flex;
  flex: 0 0 auto;
  gap: var(--word-mask-letter-gap);
  unicode-bidi: isolate;
}
.game-word-mask.has-mask-parts .word-mask-char {
  display: inline-block;
  min-width: var(--word-mask-slot-width);
  text-align: center;
  unicode-bidi: isolate;
}
.game-word-mask.word-fit-medium.has-mask-parts { --word-mask-letter-gap: .024em; --word-mask-word-gap-base: .18em; }
.game-word-mask.word-fit-small.has-mask-parts { --word-mask-letter-gap: .016em; --word-mask-word-gap-base: .12em; }
.game-word-mask.word-fit-extra-small.has-mask-parts { --word-mask-letter-gap: .008em; --word-mask-word-gap-base: .06em; }
.game-word-meta {
  margin-top: 6px;
  color: rgba(240, 245, 255, .6);
  font-size: clamp(12px, 1.1vw, 17px);
  font-weight: 900;
}

.game-timer {
  min-width: 118px;
  min-height: 58px;
  padding: 9px 17px;
  border-radius: 19px;
  font-size: clamp(23px, 2.2vw, 36px);
}

.game-notification-space { min-height: 10px; }

@media (min-width: 761px) {
  .competition-game-layout {
    position: relative;
    display: grid;
    grid-template-columns: clamp(224px, 18vw, 286px) minmax(0, 1fr);
    width: min(100%, 1370px);
    margin-top: 12px;
    gap: clamp(12px, 1.4vw, 20px);
    align-items: start;
  }

  .game-scoreboard {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 0;
    padding: 12px 13px 10px;
    border-radius: 20px;
  }

  .game-scoreboard-title {
    margin: 2px 4px 8px;
    font-size: 14px;
  }

  .game-score-row {
    min-height: 31px;
    padding: 4px 3px;
    font-size: 14px;
  }

  .game-score-name,
  .game-score-value { font-size: 14px; }

  .game-canvas-column { width: 100%; }

  .game-canvas-column .draw-tool-dock {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 8px 0 0;
  margin-left: 0;
  margin-right: 0;
  justify-self: stretch;
}
}

.game-canvas-wrap {
  border-radius: clamp(18px, 1.8vw, 28px);
}

.game-drawer-tag {
  right: 13px;
  bottom: 13px;
  padding: 7px 13px;
  font-size: clamp(13px, 1.12vw, 17px);
}

.game-chat-hint {
  margin-top: 9px;
  font-size: clamp(13px, 1.1vw, 17px);
}

.game-turn-strip { display: none; }
.game-draw-link { display: none !important; }

/* On the shared /competition screen, tools appear only while this person owns the active turn. */
body[data-page="competition"] .draw-tool-dock { display: none; }
body[data-page="competition"].competition-drawer-active .draw-tool-dock,
body[data-page="draw"].drawer-active .draw-tool-dock { display: grid; }

.draw-tool-dock {
  --draw-control-size: 46px;
  grid-template-areas:
    "size custom undo clear tools"
    "colors colors colors colors colors";
  grid-template-columns:
    clamp(130px, 15vw, 180px)
    var(--draw-control-size)
    var(--draw-control-size)
    var(--draw-control-size)
    minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 13px 14px;
  border-radius: 22px;
  background: rgba(16, 19, 24, .88);
  direction: ltr;
}

.draw-tool-group {
  grid-area: tools;
  display: grid;
  grid-template-columns: repeat(auto-fit, var(--draw-control-size));
  grid-auto-rows: var(--draw-control-size);
  grid-auto-flow: row;
  justify-content: end;
  align-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  direction: rtl;
}

.draw-tool-dock #clearCanvas { grid-area: clear; }
.draw-tool-dock #undoCanvas { grid-area: undo; }

.draw-tool-dock .draw-tool-button,
.draw-tool-dock .draw-action-button,
.draw-tool-dock .draw-custom-color {
  display: grid;
  place-items: center;
  inline-size: var(--draw-control-size);
  block-size: var(--draw-control-size);
  width: var(--draw-control-size);
  height: var(--draw-control-size);
  min-inline-size: var(--draw-control-size);
  max-inline-size: var(--draw-control-size);
  min-block-size: var(--draw-control-size);
  max-block-size: var(--draw-control-size);
  min-width: var(--draw-control-size);
  max-width: var(--draw-control-size);
  min-height: var(--draw-control-size);
  max-height: var(--draw-control-size);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  color: #f8fbff;
  background: rgba(255,255,255,.085);
  font: inherit;
  font-size: 25px;
  font-weight: 950;
  line-height: 0;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.draw-tool-button:hover,
.draw-action-button:hover,
.draw-tool-button:focus-visible,
.draw-action-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(164, 248, 214, .75);
  outline: none;
}

.draw-tool-button.is-selected,
.draw-shape-boundary-toggle[aria-pressed="true"] {
  border-color: rgba(97, 255, 172, .9);
  background: rgba(25, 178, 99, .28);
  box-shadow: 0 8px 22px rgba(34, 223, 126, .18), inset 0 0 0 1px rgba(200,255,225,.14);
}

.draw-shape-boundary-toggle {
  overflow: hidden;
}

.draw-tool-icon {
  display: block;
  place-self: center;
  inline-size: 31px;
  block-size: 31px;
  width: 31px;
  height: 31px;
  max-inline-size: 72%;
  max-block-size: 72%;
  max-width: 72%;
  max-height: 72%;
  margin: 0;
  overflow: hidden;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.paint-bucket-icon {
  display: block;
  place-self: center;
  inline-size: 31px;
  block-size: 31px;
  width: 31px;
  height: 31px;
  max-inline-size: 72%;
  max-block-size: 72%;
  max-width: 72%;
  max-height: 72%;
  margin: 0;
  overflow: hidden;
  transform: none;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.paint-bucket-icon .bucket-body {
  fill: rgba(255,255,255,.1);
}

.paint-bucket-icon .bucket-paint,
.paint-bucket-icon .bucket-drop {
  fill: currentColor;
  stroke: none;
}

.shape-boundary-icon {
  display: block;
  place-self: center;
  inline-size: 33px;
  block-size: 33px;
  width: 33px;
  height: 33px;
  max-inline-size: 72%;
  max-block-size: 72%;
  max-width: 72%;
  max-height: 72%;
  margin: 0;
  overflow: hidden;
  color: #f8fbff;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.shape-boundary-frame {
  fill: rgba(255,255,255,.04);
  stroke: rgba(255,255,255,.78);
  stroke-width: 2;
}

.shape-boundary-free,
.shape-boundary-clamped {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linejoin: round;
}

.shape-boundary-clamped { display: none; }
.draw-shape-boundary-toggle[aria-pressed="true"] .shape-boundary-free { display: none; }
.draw-shape-boundary-toggle[aria-pressed="true"] .shape-boundary-clamped { display: inline; }

.draw-action-button {
  font-size: 26px;
}

.draw-action-button:hover { background: rgba(255,255,255,.15); }

.draw-action-icon {
  display: block;
  place-self: center;
  inline-size: 26px;
  block-size: 26px;
  width: 26px;
  height: 26px;
  max-inline-size: 72%;
  max-block-size: 72%;
  max-width: 72%;
  max-height: 72%;
  margin: 0;
  overflow: hidden;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.draw-custom-color {
  grid-area: custom;
  justify-self: center;
  background: rgba(255,255,255,.07);
}

.draw-custom-color input[type="color"] {
  display: block;
  place-self: center;
  width: 100%;
  height: 100%;
  margin: auto;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  cursor: pointer;
  background: transparent;
}

.draw-size-control {
  grid-area: size;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 180px;
  height: 46px;
  padding: 0 12px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(255,255,255,.07);
}

.draw-size-control input[type="range"] {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
  accent-color: #52f7a1;
}

.draw-tool-dock .swatches {
  grid-area: colors;
  display: grid;
  grid-template-columns: repeat(14, minmax(30px, 1fr));
  grid-auto-rows: clamp(34px, 3.4vw, 40px);
  align-items: stretch;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  padding: 1px;
  box-sizing: border-box;
  direction: rtl;
}

.draw-tool-dock .swatch {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.34);
  transform: scale(.94);
}

.draw-tool-dock .swatch-eraser {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(210,222,232,.62));
  color: #10141a;
}

.swatch-eraser-icon {
  display: block;
  place-self: center;
  width: clamp(21px, 2.2vw, 27px);
  height: clamp(21px, 2.2vw, 27px);
  margin: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: none;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.draw-tool-dock .swatch:hover,
.draw-tool-dock .swatch:focus-visible,
.draw-tool-dock .swatch.is-selected {
  transform: scale(1);
  border-color: #ffffff;
  outline: none;
  z-index: 2;
}
/* A direct old /draw tab returns itself to the shared game instead of looking stuck. */
body[data-page="draw"].drawer-waiting .draw-tool-dock { display: none; }

@media (max-width: 760px) {
  .competition-game-shell {
    width: calc(100% - 10px);
    padding-top: 10px;
  }

  .game-topline {
    min-height: 165px;
    gap: 7px;
  }

  .game-word-area { min-width: 0; width: 100%; }
  .game-word-mask,
  .game-word-answer {
    font-size: clamp(37px, 10.3vw, 62px);
    letter-spacing: .02em;
    word-spacing: .12em;
  }

  .game-word-meta { font-size: 13px; }

  .competition-game-layout {
    display: block;
    width: 100%;
    margin-top: 0;
  }

  .game-scoreboard {
    width: 100%;
    min-height: 106px;
    margin: 0;
    padding: 10px 10px 8px;
    border-radius: 18px;
  }

  .game-scoreboard-title {
    margin: 1px 3px 7px;
    font-size: 13px;
  }

  .game-scoreboard #competitionGameScores {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
  }

  .game-score-row {
    min-height: 29px;
    padding: 3px 4px;
    border-radius: 8px;
    background: rgba(255,255,255,.045);
  }

  .game-score-row .room-avatar { display: inline-grid; width: 20px; height: 20px; font-size: 13px; }
  .game-score-name,
  .game-score-value { font-size: 12px; }

  .game-canvas-column {
    margin-top: 0;
  }

  .game-timer {
    position: absolute;
    z-index: 8;
    top: 422px;
    right: 50%;
    min-width: 100px;
    min-height: 62px;
    transform: translateX(50%);
    font-size: 29px;
  }

  .game-canvas-wrap { border-radius: 17px; }

  .game-drawer-tag {
    right: 9px;
    bottom: 9px;
    font-size: 12px;
  }

  .game-chat-hint {
    margin-top: 8px;
    font-size: 13px;
  }

  .draw-tool-dock {
    --draw-control-size: 44px;
    grid-template-areas:
      "tools tools tools"
      "undo clear custom"
      "size size size"
      "colors colors colors";
    grid-template-columns: var(--draw-control-size) var(--draw-control-size) minmax(0, 1fr);
    min-height: 0;
    gap: 8px;
    margin-top: 8px;
    padding: 12px 10px;
    border-radius: 20px;
  }

  .draw-tool-group {
    gap: 7px;
  }

  .draw-tool-dock .draw-tool-button,
  .draw-tool-dock .draw-action-button,
  .draw-tool-dock .draw-custom-color {
    border-radius: 13px;
  }

  .draw-custom-color {
    grid-area: custom;
    justify-self: start;
  }

  .draw-size-control {
    grid-area: size;
    width: 100%;
    max-width: 100%;
  }

  .draw-tool-dock .swatches {
    grid-area: colors;
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    grid-auto-rows: clamp(34px, 6vw, 40px);
    gap: 7px 6px;
    width: 100%;
    align-self: end;
  }

  .draw-tool-dock .swatch {
    height: 100%;
    min-height: 34px;
  }

  body[data-page="competition"].competition-drawer-active .game-canvas-column {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .game-timer { top: 405px; }
  .game-canvas-column { margin-top: 0; }

  .draw-tool-dock {
    --draw-control-size: 40px;
    grid-template-columns: var(--draw-control-size) var(--draw-control-size) minmax(0, 1fr);
    gap: 7px;
    padding: 10px 8px;
  }

  .draw-tool-group {
    gap: 6px;
  }

  .draw-tool-dock .draw-tool-button,
  .draw-tool-dock .draw-action-button,
  .draw-tool-dock .draw-custom-color {
    font-size: 22px;
  }

  .draw-tool-dock .swatches {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: clamp(30px, 8vw, 34px);
    gap: 5px 4px;
  }

  .draw-tool-dock .swatch {
    height: 100%;
    min-height: 30px;
  }
}

/* VIVE Competition v1.2 markers: persistent competition drawer and visual shape tools. */




.word-choice-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 18px;
  color: rgba(255,255,255,.78);
  font-weight: 900;
}
.word-choice-meta b { color: #7fffb4; }
.word-choice-refresh {
  margin-top: 13px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  background: rgba(255,177,69,.14);
  color: #ffe2a7;
  font-weight: 950;
  cursor: pointer;
}
.word-choice-refresh:hover:not(:disabled),
.word-choice-refresh:focus-visible:not(:disabled) {
  border-color: rgba(255,217,120,.72);
  background: rgba(255,177,69,.22);
  outline: none;
}
.word-choice-refresh:disabled { opacity: .58; cursor: not-allowed; }
.competition-game-body,
body[data-page="host"] { color-scheme: dark; }
.competition-game-body select,
.competition-game-body option,
body[data-page="host"] select,
body[data-page="host"] option {
  color: #f8fbff;
  background-color: #171b22;
}


/* Competition HUD Topic v1 - clean top hierarchy: word, topic, timer. */
body[data-page="competition"] .game-topline {
  grid-template-rows: auto auto auto;
  align-content: start;
  justify-items: center;
  gap: clamp(8px, 1vh, 14px);
  min-height: 172px;
}

body[data-page="competition"] .game-word-area {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  width: min(94vw, 1120px);
  min-width: 0;
}

body[data-page="competition"] .game-word-meta[hidden] {
  display: none !important;
}

body[data-page="competition"] .game-topic-bubble {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(76vw, 620px);
  min-height: clamp(30px, 3.1vw, 44px);
  padding: clamp(5px, .6vw, 9px) clamp(14px, 1.2vw, 22px);
  border: 1px solid rgba(138, 232, 255, .34);
  border-radius: 999px;
  background: rgba(11, 28, 42, .62);
  color: #dff8ff;
  box-shadow: inset 0 1px rgba(255, 255, 255, .10), 0 10px 26px rgba(0, 0, 0, .16);
  direction: rtl;
  unicode-bidi: plaintext;
  white-space: nowrap;
  overflow: hidden;
}

body[data-page="competition"] .game-topic-bubble[hidden] {
  display: none !important;
}

body[data-page="competition"] .game-topic-bubble span {
  flex: 0 0 auto;
  margin-inline-end: .38em;
  color: rgba(220, 247, 255, .74);
  font-size: clamp(12px, 1vw, 16px);
  font-weight: 900;
}

body[data-page="competition"] .game-topic-bubble b {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: clamp(15px, 1.35vw, 23px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  unicode-bidi: plaintext;
}

body[data-page="competition"] .game-timer {
  position: relative;
  z-index: 1;
  min-width: 108px;
  min-height: 49px;
  font-size: clamp(21px, 2vw, 33px);
}

@media (max-width: 760px) {
  body[data-page="competition"] .game-topline {
    min-height: 178px;
    gap: 8px;
  }

  body[data-page="competition"] .game-topic-bubble {
    max-width: calc(100vw - 26px);
    min-height: 36px;
  }

  body[data-page="competition"] .game-topic-bubble span {
    font-size: 13px;
  }

  body[data-page="competition"] .game-topic-bubble b {
    font-size: 17px;
  }

  body[data-page="competition"] .game-timer {
    position: relative;
    top: auto;
    right: auto;
    min-width: 96px;
    min-height: 48px;
    transform: none;
    font-size: 25px;
  }

  body[data-page="competition"] .game-canvas-column,
  body[data-page="competition"].competition-drawer-active .game-canvas-column {
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  body[data-page="competition"] .game-timer {
    top: auto;
  }

  body[data-page="competition"] .game-canvas-column {
    margin-top: 0;
  }
}
.room-entry {
  grid-template-columns: minmax(0, 1fr);
  width: min(860px, 100%);
  justify-items: stretch;
}

.room-identity-card,
.room-onboarding {
  width: min(760px, 100%);
  margin: 0 auto;
}

.room-identity-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(130, 255, 181, .18);
  border-radius: 20px;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px rgba(255, 255, 255, .05);
}

.room-identity-card[hidden],
.room-onboarding:empty {
  display: none !important;
}

.room-identity-avatar {
  width: 68px;
  height: 68px;
  font-size: 36px;
  border-radius: 20px;
}

.room-identity-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.room-identity-kicker {
  color: rgba(232, 241, 248, .64);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
}

.room-identity-name {
  color: #ffffff;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-identity-subtitle {
  color: rgba(232, 241, 248, .66);
  font-size: 12px;
  font-weight: 800;
}

.room-identity-link {
  color: #d8f2ff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.room-onboarding {
  display: grid;
  gap: 12px;
}

.room-onboarding-step {
  display: grid;
  gap: 10px;
  padding: 16px 16px 18px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 22px;
  background: rgba(255, 255, 255, .04);
}

.room-onboarding-step-title {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.03em;
}

.room-onboarding-step-helper {
  color: rgba(238, 245, 249, .68);
  font-size: 13px;
  line-height: 1.5;
}

.room-onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-onboarding-compact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(122, 245, 171, .18);
  background: rgba(255, 255, 255, .05);
}

.room-onboarding-code {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.room-onboarding-code bdi {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .24);
  color: #fff;
  font-size: 1rem;
  font-weight: 950;
  user-select: text;
}

.room-onboarding-candidates {
  display: grid;
  gap: 10px;
}

.room-onboarding-secondary {
  color: rgba(238, 245, 249, .64);
  font-size: 12px;
  font-weight: 800;
}

.room-onboarding button.secondary {
  background: rgba(255, 255, 255, .05);
}

.room-onboarding button.primary,
.room-join-button {
  background: linear-gradient(135deg, rgba(80, 255, 154, .20), rgba(64, 177, 255, .18));
  border-color: rgba(122, 245, 171, .42);
  color: #effff4;
}

.room-onboarding button.primary:hover,
.room-join-button:hover {
  background: linear-gradient(135deg, rgba(80, 255, 154, .28), rgba(64, 177, 255, .24));
}

@media (max-width: 760px) {
  .room-identity-card { grid-template-columns: auto minmax(0, 1fr); }
  .room-identity-link { grid-column: 1 / -1; }
  .room-onboarding-compact { grid-template-columns: 1fr; }
  .room-onboarding-code { align-items: stretch; }
}

/* Competition-only Rating composition and responsive layout overrides. */
body[data-page="competition"] .game-scoreboard #wordRating {
  width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  margin-top: 2px;
  padding: 8px;
  gap: 8px;
  box-sizing: border-box;
  overflow: visible;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-panel,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-followup-panel,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-panel-context,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-question-stack,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-card,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-card,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-question,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-star-rail,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-star-track {
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-panel,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-followup-panel {
  gap: 8px;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-question-stack {
  gap: 8px;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-card {
  padding: 10px;
  gap: 9px;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-card {
  padding: 10px;
  gap: 7px;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-word {
  width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  font-size: clamp(24px, 2.7vw, 34px);
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-word bdi {
  display: block;
  min-inline-size: 0;
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-topic-chip {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  max-inline-size: 100%;
  min-inline-size: 0;
  flex-wrap: wrap;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-context-topic-chip bdi {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-question,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-question > span,
body[data-page="competition"] .game-scoreboard #wordRating .feedback-question bdi {
  min-inline-size: 0;
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-question bdi {
  display: inline-block;
  vertical-align: bottom;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-star-rail {
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: stretch;
  overflow: visible;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-star-caption {
  white-space: normal;
}

body[data-page="competition"] .game-scoreboard #wordRating .feedback-star-svg {
  width: clamp(22px, 2.4vw, 28px);
  height: clamp(22px, 2.4vw, 28px);
}

@media (min-width: 761px) {
  body[data-page="competition"] .competition-game-layout,
  body[data-page="competition"] .game-scoreboard,
  body[data-page="competition"] .game-canvas-column,
  body[data-page="competition"] .game-scoreboard #wordRating {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  body[data-page="competition"] .competition-game-layout.has-word-rating {
    grid-template-columns: clamp(286px, 28vw, 330px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body[data-page="competition"] .game-scoreboard #wordRating {
    width: 100%;
    overflow: visible;
  }
}


/* Competition participant game chat hotfix */
body[data-page="competition"] .competition-game-chat {
  direction: rtl;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 420px;
  max-height: 640px;
  overflow: hidden;
  border: 1px solid rgba(96, 229, 191, .25);
  border-radius: 22px;
  background:
    radial-gradient(circle at 82% 0%, rgba(50, 224, 167, .12), transparent 38%),
    rgba(15, 26, 31, .82);
  box-shadow: inset 0 1px rgba(255, 255, 255, .07), 0 14px 42px rgba(0, 0, 0, .22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body[data-page="competition"] .competition-game-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 14px 15px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

body[data-page="competition"] .competition-game-chat-header strong {
  color: #effff9;
  font-size: 15px;
  font-weight: 950;
}

body[data-page="competition"] .competition-game-chat-header span {
  color: rgba(214, 247, 237, .5);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

body[data-page="competition"] .competition-game-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
}

body[data-page="competition"] .competition-game-chat-empty {
  margin: auto;
  padding: 18px 8px;
  color: rgba(224, 243, 237, .44);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

body[data-page="competition"] .competition-game-chat-message {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
}

body[data-page="competition"] .competition-game-chat-message.is-system {
  grid-template-columns: minmax(0, 1fr);
  border-color: rgba(255, 210, 104, .24);
  background: rgba(255, 188, 70, .1);
  color: #fff0c0;
  font-weight: 900;
  text-align: center;
}

body[data-page="competition"] .competition-game-chat-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: hsl(var(--avatar-hue, 160) 40% 22%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
}

body[data-page="competition"] .competition-game-chat-copy {
  min-width: 0;
}

body[data-page="competition"] .competition-game-chat-author {
  display: block;
  overflow: hidden;
  color: rgba(220, 255, 244, .78);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="competition"] .competition-game-chat-text {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, .94);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
}

body[data-page="competition"] .competition-game-chat-status {
  min-height: 38px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: rgba(225, 242, 237, .66);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

body[data-page="competition"] .competition-game-chat-status.is-locked {
  color: #ffd08a;
}

body[data-page="competition"] .competition-game-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  padding: 0 10px 10px;
}

body[data-page="competition"] .competition-game-chat-form input,
body[data-page="competition"] .competition-game-chat-form button {
  min-width: 0;
  min-height: 42px;
  border-radius: 13px;
  font: inherit;
}

body[data-page="competition"] .competition-game-chat-form input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .15);
  outline: none;
  background: rgba(0, 0, 0, .28);
  color: #ffffff;
  font-size: 13px;
}

body[data-page="competition"] .competition-game-chat-form input:focus-visible {
  border-color: rgba(82, 242, 184, .72);
  box-shadow: 0 0 0 3px rgba(55, 218, 161, .12);
}

body[data-page="competition"] .competition-game-chat-form input::placeholder {
  color: rgba(229, 244, 240, .4);
}

body[data-page="competition"] .competition-game-chat-form button {
  padding: 8px 13px;
  border: 1px solid rgba(88, 246, 184, .45);
  background: linear-gradient(135deg, #54ecad, #24bb82);
  color: #06150f;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

body[data-page="competition"] .competition-game-chat-form input:disabled,
body[data-page="competition"] .competition-game-chat-form button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

@media (min-width: 1280px) {
  body[data-page="competition"] .competition-game-shell {
    width: min(calc(100% - 26px), 1760px);
  }

  body[data-page="competition"] .competition-game-layout,
  body[data-page="competition"] .competition-game-layout.has-word-rating {
    grid-template-columns: clamp(220px, 15vw, 286px) minmax(0, 1fr) clamp(240px, 17vw, 316px);
    width: min(100%, 1710px);
  }

  body[data-page="competition"] .competition-game-layout.has-word-rating {
    grid-template-columns: clamp(286px, 18vw, 330px) minmax(0, 1fr) clamp(240px, 17vw, 316px);
  }

  body[data-page="competition"] .competition-game-chat {
    align-self: stretch;
  }
}

@media screen and (min-width: 761px) and (max-width: 1279px) {
  body[data-page="competition"] .competition-game-chat {
    grid-column: 1 / -1;
    min-height: 300px;
    max-height: 340px;
  }
}

@media screen and (max-width: 760px) {
  body[data-page="competition"] .competition-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  body[data-page="competition"] .game-canvas-column {
    order: 1;
  }

  body[data-page="competition"] .competition-game-chat {
    order: 2;
    min-height: 300px;
    max-height: 380px;
  }

  body[data-page="competition"] .game-scoreboard {
    order: 3;
  }

  body[data-page="competition"] .competition-game-chat-header {
    padding: 12px 13px 9px;
  }

  body[data-page="competition"] .competition-game-chat-form {
    padding: 0 8px 8px;
  }
}

/* VIVE Dual Game Leaderboards v1 */
.game-scoreboard-dual {
  align-content: start;
  gap: 12px;
}
.game-scoreboard-section {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}
.game-scoreboard-section + .game-scoreboard-section {
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.game-scoreboard-section.is-primary {
  padding: 5px 5px 3px;
  border-radius: 14px;
  background: rgba(126, 244, 185, .055);
}
.game-scoreboard-section .game-scoreboard-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-score-row .score-name-cell {
  min-width: 0;
}
.game-score-row .score-gain-indicator {
  font-size: clamp(10px, .78vw, 13px);
}
#drawViewerGuessersScores,
#overlayCompetitionScores {
  min-width: 0;
}
@media (max-width: 760px) {
  body[data-page="draw"] .game-scoreboard-dual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px;
  }
  body[data-page="draw"] .game-scoreboard-section + .game-scoreboard-section {
    padding-top: 5px;
    padding-inline-start: 8px;
    border-top: 0;
    border-inline-start: 1px solid rgba(255, 255, 255, .12);
  }
  body[data-page="draw"] .game-scoreboard-section .game-scoreboard-title {
    font-size: 11px;
  }
  body[data-page="draw"] #competitionGameScores,
  body[data-page="draw"] #drawViewerGuessersScores {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  body[data-page="draw"] .game-score-row {
    grid-template-columns: 1.35em minmax(0, 1fr) auto;
  }
  body[data-page="draw"] .game-score-row .score-avatar {
    display: none;
  }
}
