:root {
  --bg: #10161a;
  --panel: rgba(18, 28, 32, 0.86);
  --panel-strong: rgba(7, 13, 16, 0.9);
  --text: #f8f0df;
  --muted: #b6c2bd;
  --line: rgba(255, 236, 196, 0.18);
  --gold: #f6bc59;
  --teal: #69d0c4;
  --danger: #ff796f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 80% 20%, #253d3c 0, transparent 32%), var(--bg);
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 18px;
  color: #1b1208;
  background: var(--gold);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(2, 8, 10, 0.54);
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(105, 208, 196, 0.16);
}

select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(105, 208, 196, 0.16);
}

.app {
  min-height: 100vh;
}

.join {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-image: linear-gradient(90deg, rgba(7, 13, 16, 0.92), rgba(7, 13, 16, 0.18)), url("./assets/escape-room.png");
  background-size: cover;
  background-position: center;
}

.join__inner {
  width: min(760px, 100%);
  margin-inline-start: auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 20, 24, 0.82);
  box-shadow: var(--shadow);
}

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.lang-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
}

.lang-button.active {
  color: #0b1717;
  background: var(--teal);
}

.brand,
.room-label,
.object-name {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
}

.join h1,
.topbar h1,
.console h2 {
  margin: 0;
  letter-spacing: 0;
}

.join h1 {
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  max-width: 10ch;
}

.join__form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.join label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.scenario-field {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-weight: 800;
}

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

.scenario-card {
  display: grid;
  grid-template-rows: 74px auto auto;
  gap: 7px;
  min-height: 156px;
  padding: 8px;
  color: var(--text);
  text-align: inherit;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.scenario-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(105, 208, 196, 0.16);
}

.scenario-card img {
  width: 100%;
  height: 74px;
  border-radius: 6px;
  object-fit: cover;
}

.scenario-card strong {
  font-size: 14px;
  line-height: 1.2;
}

.scenario-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.game {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 40px);
}

.scenario-title {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer {
  min-width: 104px;
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  color: #0b1717;
  background: var(--teal);
  font-weight: 900;
  font-size: 24px;
}

.progress {
  width: 190px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.progress i {
  display: block;
  width: 0;
  height: 7px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--gold);
  transition: width 180ms ease;
}

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 280px;
  gap: 16px;
  margin-top: 16px;
}

.panel,
.console {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  min-height: 560px;
  padding: 16px;
}

.panel h2,
.console h2 {
  font-size: 20px;
}

.players__list,
.log__list {
  display: grid;
  gap: 10px;
}

.player,
.log-item {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.player strong {
  display: block;
}

.player span,
.log-item {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.my-clue {
  margin-top: 18px;
  border: 1px solid rgba(246, 188, 89, 0.32);
  border-radius: 8px;
  padding: 14px;
  background: rgba(246, 188, 89, 0.1);
}

.my-clue span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.my-clue p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.board {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070d10;
  box-shadow: var(--shadow);
}

.board img {
  width: 100%;
  height: 100%;
  min-height: 560px;
  object-fit: cover;
  display: block;
}

.hotspot {
  position: absolute;
  width: clamp(46px, 5vw, 72px);
  height: clamp(46px, 5vw, 72px);
  min-height: 0;
  padding: 0;
  border: 2px solid rgba(246, 188, 89, 0.86);
  border-radius: 50%;
  background: rgba(246, 188, 89, 0.18);
  box-shadow: 0 0 0 8px rgba(246, 188, 89, 0.08), 0 0 26px rgba(246, 188, 89, 0.34);
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: inherit;
  background: var(--gold);
}

.hotspot.solved {
  border-color: var(--teal);
  background: rgba(105, 208, 196, 0.18);
}

.hotspot.solved::after {
  background: var(--teal);
}

.clock {
  top: 18%;
  left: 47%;
}

.books {
  top: 28%;
  right: 18%;
}

.painting {
  top: 22%;
  left: 22%;
}

.chest {
  bottom: 15%;
  right: 35%;
}

.console {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 0.9fr) minmax(220px, 0.6fr);
  gap: 14px;
  align-items: end;
  padding: 16px;
}

.console p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.answer-row,
.final-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.final-row {
  grid-template-columns: 1fr auto;
}

.win {
  animation: winPulse 900ms ease both;
}

@keyframes winPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(105, 208, 196, 0);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(105, 208, 196, 0.24);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@media (max-width: 1050px) {
  .game {
    padding: 12px;
  }

  .layout,
  .console {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .players {
    order: 3;
  }

  .log {
    order: 4;
  }

  .board {
    order: 1;
  }

  .console {
    order: 2;
  }

  .topbar,
  .status-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .progress,
  .timer {
    width: 100%;
  }

  .console {
    position: sticky;
    bottom: 0;
    z-index: 3;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@media (max-width: 620px) {
  body {
    background: #10161a;
  }

  .game {
    padding: 8px;
  }

  .join__inner {
    padding: 18px;
  }

  .join {
    padding: 12px;
    align-items: start;
  }

  .join h1 {
    max-width: 12ch;
    font-size: 36px;
  }

  .scenario-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scenario-card {
    grid-template-rows: 68px auto;
    min-height: 132px;
    padding: 7px;
  }

  .scenario-card span {
    display: none;
  }

  .topbar {
    padding: 12px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .layout {
    gap: 10px;
    margin-top: 10px;
  }

  .board,
  .board img {
    min-height: auto;
    height: clamp(330px, 78vw, 440px);
  }

  .hotspot {
    width: 54px;
    height: 54px;
    box-shadow: 0 0 0 6px rgba(246, 188, 89, 0.08), 0 0 22px rgba(246, 188, 89, 0.34);
  }

  .hotspot::after {
    inset: 16px;
  }

  .panel {
    padding: 12px;
  }

  .players__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .console {
    gap: 12px;
    padding: 12px;
    position: static;
    margin-inline: 0;
    border-radius: 8px;
  }

  .answer-row,
  .final-row {
    grid-template-columns: 1fr;
  }

  .answer-row button,
  .final-row button {
    width: 100%;
  }
}

/* Concept-faithful game screen */
.game {
  min-height: 100vh;
  padding: 14px 16px 16px;
  background:
    radial-gradient(circle at 18% 10%, rgba(24, 76, 104, 0.35), transparent 28%),
    linear-gradient(180deg, #07111f 0%, #030913 100%);
}

.topbar {
  direction: ltr;
  display: grid;
  grid-template-columns: 300px minmax(360px, 1fr) 520px;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 12px 18px;
  border: 1px solid rgba(63, 131, 178, 0.36);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(9, 29, 51, 0.92), rgba(3, 15, 29, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 24px 70px rgba(0, 0, 0, 0.34);
}

.top-actions,
.title-block,
.top-stats {
  direction: rtl;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 58px;
  min-height: 56px;
  padding: 0 8px;
  color: #dce8f3;
  background: transparent;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0;
  font-size: 24px;
}

.icon-button span {
  color: #9eb2c4;
  font-size: 12px;
  font-weight: 700;
}

.icon-button.muted {
  opacity: 0.55;
}

.title-block {
  text-align: center;
}

.title-block h1 {
  margin: 0;
  color: #f5d48a;
  text-shadow: 0 2px 18px rgba(245, 212, 138, 0.22);
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1;
}

.title-key {
  font-size: 0.76em;
}

.scenario-title {
  margin: 7px 0 0;
  color: rgba(245, 240, 222, 0.7);
  font-size: 14px;
  font-weight: 800;
}

.top-stats {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 12px;
}

.stat-card {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(173, 203, 225, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
}

.stat-card span {
  display: block;
  color: #a6b8c8;
  font-size: 12px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  color: #f8f0df;
  font-size: 24px;
  line-height: 1.25;
}

.timer-card strong {
  font-size: 34px;
}

.room-code-card strong {
  color: #f6bc59;
  letter-spacing: 0;
}

.progress-card i {
  display: block;
  width: 0;
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #70d66f, #f6bc59);
}

.layout {
  direction: ltr;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 12px;
  height: calc(100vh - 122px);
  margin-top: 12px;
}

.players,
.playfield {
  direction: rtl;
}

.panel,
.console > article {
  border: 1px solid rgba(63, 131, 178, 0.32);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(7, 28, 48, 0.9), rgba(3, 16, 30, 0.93));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 20px 55px rgba(0, 0, 0, 0.26);
}

.players {
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.players h2,
.console h2 {
  margin: 0 0 12px;
  color: #f5e0b5;
  font-size: 20px;
}

.players__list {
  display: grid;
  gap: 10px;
}

.player {
  direction: ltr;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  min-height: 148px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(87, 165, 94, 0.14), rgba(255, 255, 255, 0.04));
}

.player > div:not(.avatar) {
  direction: rtl;
}

.player.placeholder {
  opacity: 0.58;
}

.player.placeholder .avatar {
  filter: grayscale(0.45);
}

.player.role-signs {
  background: linear-gradient(160deg, rgba(143, 92, 208, 0.16), rgba(255, 255, 255, 0.04));
}

.player.role-map {
  background: linear-gradient(160deg, rgba(47, 158, 216, 0.16), rgba(255, 255, 255, 0.04));
}

.player.role-memory {
  background: linear-gradient(160deg, rgba(245, 151, 54, 0.16), rgba(255, 255, 255, 0.04));
}

.avatar {
  width: 82px;
  height: 82px;
  border: 3px solid #6acb68;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #264f43, #102033);
  overflow: hidden;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-signs .avatar {
  border-color: #a46be1;
}

.role-map .avatar {
  border-color: #45afe9;
}

.role-memory .avatar {
  border-color: #f49b3c;
}

.player strong {
  color: #8ee47f;
  font-size: 20px;
}

.role-signs strong {
  color: #c18cff;
}

.role-map strong {
  color: #61c5ff;
}

.role-memory strong {
  color: #ffad53;
}

.player span {
  display: block;
  margin-top: 8px;
  color: #e8d9bf;
  font-size: 14px;
  line-height: 1.35;
}

.my-clue {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(173, 203, 225, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.reveal-button {
  width: 100%;
  margin-bottom: 12px;
}

.my-clue span {
  color: #f6bc59;
}

.playfield {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 202px;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.waiting-room {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: start center;
  padding: clamp(18px, 8vh, 74px) 18px 18px;
  border: 2px solid rgba(63, 131, 178, 0.34);
  border-radius: 14px;
  background: rgba(3, 13, 24, 0.76);
  backdrop-filter: blur(8px);
}

.waiting-room__panel {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid rgba(246, 188, 89, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(9, 29, 51, 0.95), rgba(3, 16, 30, 0.98));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.waiting-room__eyebrow {
  margin: 0 0 8px;
  color: #f6bc59;
  font-size: 14px;
  font-weight: 900;
}

.waiting-room h2 {
  margin: 0;
  color: #f8f0df;
  font-size: 32px;
}

.waiting-room p {
  color: #c7d5df;
}

.waiting-meter {
  position: relative;
  overflow: hidden;
  height: 46px;
  margin-top: 18px;
  border: 1px solid rgba(112, 214, 111, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.waiting-meter span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 100%;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.waiting-meter i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #70d66f, #f6bc59);
  transition: width 0.25s ease;
}

.invite-button {
  width: 100%;
  margin-top: 16px;
}

.invite-link {
  overflow-wrap: anywhere;
  margin: 10px 0 0;
  color: #9fb6c7;
  font-size: 12px;
}

.playfield.is-waiting .board,
.playfield.is-waiting .console {
  filter: saturate(0.55) brightness(0.72);
}

.board {
  min-height: 0;
  border: 2px solid rgba(63, 131, 178, 0.34);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.board img {
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.board-caption {
  position: absolute;
  right: 50%;
  bottom: 10px;
  transform: translateX(50%);
  margin: 0;
  padding: 11px 24px;
  border: 1px solid rgba(99, 163, 208, 0.24);
  border-radius: 10px;
  color: #d8e6ef;
  background: rgba(8, 29, 48, 0.78);
  font-weight: 800;
  white-space: nowrap;
}

.hotspot {
  width: clamp(58px, 5vw, 78px);
  height: clamp(58px, 5vw, 78px);
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.2), 0 0 20px rgba(255, 255, 255, 0.7);
}

.hotspot::after {
  inset: 22px;
  background: #ffffff;
}

.hotspot.solved {
  border-color: #72d17d;
}

.hotspot.solved::after {
  background: #72d17d;
}

.console {
  direction: ltr;
  display: grid;
  grid-template-columns: 1fr 1.25fr 1.2fr;
  gap: 8px;
  padding: 0;
}

.console > article {
  direction: rtl;
  min-width: 0;
  padding: 14px;
}

.mission-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 10px;
}

.object-name {
  color: #f5d48a;
}

.mission-card h3 {
  margin: 3px 0 0;
  color: #f8f0df;
  font-size: 18px;
}

.console p {
  color: #c4d1d7;
  font-size: 14px;
}

.mini-log {
  display: grid;
  gap: 6px;
  align-content: start;
}

.log-item {
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
}

.clue-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.clue-slot {
  display: grid;
  place-items: center;
  min-height: 82px;
  border: 1px dashed rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  color: #9aa8b1;
  background: rgba(255, 255, 255, 0.035);
}

.clue-slot span {
  color: #f6bc59;
  font-weight: 900;
}

.clue-slot strong {
  font-size: 36px;
}

.clue-slot.filled {
  border-style: solid;
  border-color: rgba(112, 214, 111, 0.45);
}

.clue-slot.filled strong {
  color: #70d66f;
}

.code-digits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.final-row {
  display: block;
}

.code-digit {
  height: 58px;
  padding: 0;
  border-radius: 8px;
  color: #111;
  background: #f3f5f8;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
}

.code-actions {
  direction: rtl;
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 10px;
}

.code-actions button,
.answer-row button {
  min-height: 48px;
}

.hint-action {
  background: #f6bc59;
}

.new-action {
  color: #fff;
  background: #377cdc;
}

.answer-row {
  grid-template-columns: 1fr auto;
  margin-top: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(1, 8, 16, 0.72);
  backdrop-filter: blur(7px);
}

.dialog__panel {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(63, 131, 178, 0.42);
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(9, 29, 51, 0.98), rgba(3, 15, 29, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.dialog__close {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.dialog h2 {
  margin: 0 0 12px;
  color: #f5d48a;
  font-size: 26px;
}

.dialog p {
  margin: 0;
  color: #d3dde4;
  line-height: 1.7;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.team-clues {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-clues li {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.team-clues strong {
  color: #f5d48a;
}

.team-clues span {
  color: #d3dde4;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 24px;
  z-index: 25;
  transform: translateX(50%);
  padding: 12px 18px;
  border: 1px solid rgba(63, 131, 178, 0.42);
  border-radius: 999px;
  color: var(--text);
  background: rgba(4, 18, 32, 0.94);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    order: 4;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .icon-button {
    min-width: 0;
    border-left: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
  }

  .top-stats {
    grid-template-columns: 1fr;
  }

  .layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .playfield {
    grid-template-rows: auto auto;
  }

  .board,
  .board img {
    height: min(58vw, 560px);
  }

  .players {
    order: 3;
  }

  .console {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .game {
    padding: 8px;
  }

  .title-block h1 {
    font-size: 28px;
  }

  .stat-card strong,
  .timer-card strong {
    font-size: 24px;
  }

  .board,
  .board img {
    height: 370px;
  }

  .board-caption {
    right: 10px;
    left: 10px;
    transform: none;
    text-align: center;
    white-space: normal;
  }

  .players__list {
    grid-template-columns: 1fr;
  }

  .player {
    grid-template-columns: 70px 1fr;
    min-height: 100px;
  }

  .avatar {
    width: 58px;
    height: 58px;
    font-size: 27px;
  }

  .mission-body {
    grid-template-columns: 1fr;
  }

  .code-actions,
  .answer-row {
    grid-template-columns: 1fr;
  }
}
