:root {
  color-scheme: dark;
  --bg: #111312;
  --panel: rgba(18, 22, 20, 0.88);
  --panel-strong: rgba(24, 29, 27, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f1e8;
  --muted: #a9b2aa;
  --accent: #e3b341;
  --accent-2: #55c7a6;
  --danger: #f15f56;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  background: #232927;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

button.primary {
  border-color: transparent;
  background: var(--accent);
  color: #17140b;
  font-weight: 800;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 560px;
  background:
    linear-gradient(rgba(10, 13, 12, 0.35), rgba(10, 13, 12, 0.78)),
    radial-gradient(circle at 22% 20%, rgba(227, 179, 65, 0.12), transparent 26%),
    linear-gradient(135deg, #1f332c 0%, #161d1a 42%, #201c17 100%);
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.panel,
.game {
  position: relative;
  z-index: 1;
}

.lobby {
  width: min(940px, calc(100vw - 32px));
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 24px;
  padding: 28px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 44%, var(--accent) 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--accent-2) 45% 55%, transparent 56%),
    #202724;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(36px, 7vw, 74px);
  line-height: 1.02;
}

.room-card {
  display: grid;
  gap: 16px;
  width: min(580px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.sound-prompt {
  justify-self: start;
  min-height: 36px;
  padding: 0 14px;
  border-color: rgba(227, 179, 65, 0.55);
  background: rgba(227, 179, 65, 0.16);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  background: #0f1312;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.mode-row,
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.notes span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.hidden {
  display: none;
}

.game {
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #1d2924;
}

.hud {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  backdrop-filter: blur(10px);
}

.audio-control {
  position: absolute;
  z-index: 6;
  top: calc(env(safe-area-inset-top) + 36px);
  right: calc(env(safe-area-inset-right) + 8px);
  display: grid;
  justify-items: end;
  gap: 6px;
  pointer-events: auto;
}

.audio-toggle {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(15, 19, 18, 0.62);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.audio-panel {
  width: 178px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(15, 19, 18, 0.8);
  backdrop-filter: blur(10px);
}

.audio-panel.hidden {
  display: none;
}

.audio-panel label {
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}

.audio-panel input {
  height: 24px;
  padding: 0;
  accent-color: var(--accent);
}

.top {
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  height: 31px;
  display: grid;
  grid-template-columns: 42px repeat(5, minmax(44px, 1fr));
  gap: 3px;
  align-items: center;
  padding: 2px 5px;
  border-radius: 0;
  direction: ltr;
}

.top > div,
.stats > div {
  min-width: 0;
}

.top > div {
  text-align: center;
}

.top > div:nth-of-type(1) {
  grid-column: 6;
}

.top > div:nth-of-type(2) {
  grid-column: 5;
}

.top > div:nth-of-type(3) {
  grid-column: 4;
}

.top > div:nth-of-type(4) {
  grid-column: 3;
}

.top > div:nth-of-type(5) {
  grid-column: 2;
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1;
}

.hud strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.05;
}

#leaveGame {
  grid-column: 1;
  grid-row: 1;
  min-height: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
}

.stats {
  top: calc(env(safe-area-inset-top) + 34px);
  left: 50%;
  transform: translateX(-50%);
  width: min(210px, calc(100vw - 110px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
  padding: 3px 6px;
  border-radius: 0 0 5px 5px;
}

.bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
  transition: width 120ms linear;
}

.bar.zone span {
  background: var(--accent);
}

.small {
  grid-column: 1 / -1;
  min-height: 9px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-panel {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 46px) 18px calc(env(safe-area-inset-bottom) + 18px);
  background: rgba(5, 8, 8, 0.58);
  backdrop-filter: blur(8px);
}

.result-panel.hidden {
  display: none;
}

.result-card {
  width: min(620px, 94vw);
  max-height: min(82vh, 540px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(18, 22, 20, 0.95);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.result-card h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

#resultScore {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 32px;
  line-height: 1;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.result-grid > div,
.result-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.result-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.result-grid b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.result-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: #d9e1db;
  font-size: 13px;
  font-weight: 700;
}

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

.touch {
  position: absolute;
  z-index: 4;
  display: none;
}

body.in-game .touch {
  display: block;
}

.touch.left {
  left: 22px;
  bottom: max(22vh, calc(env(safe-area-inset-bottom) + 82px));
}

.touch.right {
  right: 22px;
  bottom: max(22vh, calc(env(safe-area-inset-bottom) + 82px));
}

.rotate-hint {
  display: none;
}

#stickBase {
  position: relative;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 0 2px rgba(245, 241, 232, 0.06);
  touch-action: none;
}

#aimRing {
  display: none;
}

#stickKnob {
  position: absolute;
  left: 49px;
  top: 49px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(245, 241, 232, 0.82);
  pointer-events: none;
}

#aimKnob {
  position: absolute;
  left: 23px;
  top: 23px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(233, 185, 68, 0.92);
  box-shadow: 0 0 12px rgba(233, 185, 68, 0.35);
}

#aimBase {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid rgba(233, 185, 68, 0.55);
  background: rgba(233, 185, 68, 0.13);
  box-shadow: inset 0 0 0 2px rgba(245, 241, 232, 0.06);
  touch-action: none;
}

#aimBase::after {
  content: "Auto";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(245, 241, 232, 0.72);
  font-weight: 900;
  font-size: 16px;
  pointer-events: none;
}

#rightAimKnob {
  position: absolute;
  left: 49px;
  top: 49px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(233, 185, 68, 0.95);
  box-shadow: 0 0 16px rgba(233, 185, 68, 0.42);
  pointer-events: none;
}

@media (pointer: coarse), (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  body.in-game {
    overflow: hidden;
  }

  .shell {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  body.in-game .shell {
    height: 100svh;
    overflow: hidden;
  }

  .lobby {
    width: min(100% - 22px, 520px);
    min-height: 100svh;
    align-content: start;
    gap: 14px;
    padding: 14px 0 22px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.08;
  }

  .brand {
    gap: 10px;
  }

  .mark {
    width: 46px;
    height: 46px;
  }

  .room-card {
    gap: 11px;
    padding: 12px;
  }

  label {
    gap: 5px;
  }

  input,
  select {
    height: 42px;
  }

  .mode-row,
  .actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .notes {
    gap: 7px;
    font-size: 12px;
  }

  .notes span {
    padding: 6px 8px;
  }

  .touch {
    display: block;
  }

  .stats {
    top: calc(env(safe-area-inset-top) + 33px);
    left: 50%;
    transform: translateX(-50%);
    width: min(200px, calc(100vw - 230px));
    padding: 3px 6px;
    gap: 2px 6px;
  }

  .top {
    top: env(safe-area-inset-top);
    height: 30px;
    grid-template-columns: 42px repeat(3, minmax(48px, 1fr));
    grid-auto-rows: 26px;
    padding: 2px 5px;
  }

  .top > div:nth-of-type(4),
  .top > div:nth-of-type(5) {
    display: none;
  }

  .top > div:nth-of-type(1) {
    grid-column: 4;
  }

  .top > div:nth-of-type(2) {
    grid-column: 3;
  }

  .top > div:nth-of-type(3) {
    grid-column: 2;
  }

  #leaveGame {
    min-height: 25px;
    height: 25px;
    padding: 0 7px;
    font-size: 10px;
  }

  .hud strong {
    font-size: 12px;
  }

  .hud-label {
    font-size: 7px;
  }

  .result-panel {
    padding: calc(env(safe-area-inset-top) + 34px) 12px calc(env(safe-area-inset-bottom) + 12px);
  }

  .result-card {
    max-height: 84vh;
    padding: 12px;
  }

  .result-card h2 {
    font-size: 22px;
  }

  #resultScore {
    margin-bottom: 9px;
    font-size: 24px;
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .result-grid > div,
  .result-list {
    padding: 7px;
  }

  .result-list {
    max-height: 74px;
    overflow: auto;
    font-size: 12px;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .touch.left {
    left: 12px;
    bottom: max(18vh, calc(env(safe-area-inset-bottom) + 58px));
  }

  .touch.right {
    right: 12px;
    bottom: max(18vh, calc(env(safe-area-inset-bottom) + 58px));
  }

  #stickBase,
  #aimBase {
    width: 177px;
    height: 177px;
  }

  #stickKnob,
  #rightAimKnob {
    left: 65px;
    top: 65px;
    width: 47px;
    height: 47px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  body.in-game .rotate-hint {
    position: absolute;
    z-index: 8;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: rgba(8, 12, 12, 0.82);
    color: var(--text);
  }

  .rotate-hint strong {
    font-size: 28px;
  }

  .rotate-hint span {
    color: var(--muted);
  }
}

body:not(.in-game) {
  overflow: hidden;
}

body:not(.in-game) .shell {
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 78%, rgba(31, 112, 255, 0.42), transparent 24%),
    radial-gradient(circle at 82% 76%, rgba(219, 36, 44, 0.42), transparent 24%),
    radial-gradient(circle at 50% 13%, rgba(255, 255, 255, 0.18), transparent 20%),
    linear-gradient(90deg, rgba(0, 52, 120, 0.7), rgba(4, 6, 8, 0.44) 34%, rgba(4, 6, 8, 0.44) 66%, rgba(120, 8, 15, 0.74)),
    linear-gradient(180deg, #09111a 0%, #05080a 48%, #0a0708 100%),
    #070b0e;
}

body:not(.in-game) .shell::before {
  background:
    radial-gradient(ellipse at 10% 16%, rgba(73, 159, 255, 0.38) 0 4%, transparent 18%),
    radial-gradient(ellipse at 90% 16%, rgba(255, 95, 88, 0.34) 0 4%, transparent 18%),
    radial-gradient(circle at 25% 62%, rgba(37, 117, 255, 0.3), transparent 18%),
    radial-gradient(circle at 75% 62%, rgba(232, 48, 54, 0.28), transparent 18%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(255, 255, 255, 0.04) 39px 40px),
    linear-gradient(108deg, transparent 0 12%, rgba(37, 117, 255, 0.28) 13% 28%, transparent 29% 50%, rgba(232, 48, 54, 0.26) 72% 87%, transparent 88%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.48));
  background-size: auto, auto, auto, auto, auto, auto, auto, auto;
  mask-image: none;
  pointer-events: none;
}

body:not(.in-game) .shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, transparent 0 7%, rgba(22, 91, 182, 0.55) 8% 24%, transparent 25% 50%, rgba(169, 24, 28, 0.55) 76% 92%, transparent 93%),
    radial-gradient(ellipse at 20% 86%, rgba(42, 138, 255, 0.38), transparent 20%),
    radial-gradient(ellipse at 80% 86%, rgba(255, 64, 62, 0.36), transparent 20%),
    linear-gradient(to top, rgba(0, 0, 0, 0.88), transparent 42%);
  clip-path: polygon(0 20%, 16% 15%, 30% 56%, 48% 32%, 52% 32%, 70% 56%, 84% 15%, 100% 20%, 100% 100%, 0 100%);
  opacity: 0.82;
}

body:not(.in-game) .lobby {
  width: 100vw;
  height: 100svh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  place-items: center;
  align-content: start;
  gap: clamp(10px, 1.1vw, 18px);
  padding: clamp(42px, 5.8vh, 68px) max(32px, env(safe-area-inset-right)) 18px max(32px, env(safe-area-inset-left));
}

body:not(.in-game) .lobby::before,
body:not(.in-game) .lobby::after {
  position: absolute;
  top: 20%;
  z-index: 0;
  color: rgba(245, 241, 232, 0.22);
  font-size: clamp(48px, 5vw, 88px);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  pointer-events: none;
  text-shadow: 0 0 22px currentColor;
}

body:not(.in-game) .lobby::before {
  content: "BLUE";
  left: clamp(22px, 3vw, 58px);
  color: rgba(75, 155, 255, 0.32);
}

body:not(.in-game) .lobby::after {
  content: "RED BLOOD";
  right: clamp(22px, 3vw, 58px);
  color: rgba(255, 72, 72, 0.32);
}

body:not(.in-game) .brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.72);
  position: relative;
  z-index: 1;
}

body:not(.in-game) .brand .mark {
  display: none;
}

body:not(.in-game) .brand > div {
  display: contents;
}

body:not(.in-game) .eyebrow {
  display: none;
}

body:not(.in-game) .brand::after {
  content: "اختر فريقك... وادخل المعركة";
  order: 2;
  color: #f5f1e8;
  font-size: clamp(17px, 1.45vw, 26px);
  font-weight: 900;
  text-transform: none;
}

body:not(.in-game) .brand::before,
body:not(.in-game) .brand::after {
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.72);
}

body:not(.in-game) .brand::before {
  content: "";
  order: 2;
  display: none;
}

body:not(.in-game) .brand::after {
  display: block;
}

body:not(.in-game) .brand::after {
  padding-inline: 72px;
  background:
    linear-gradient(90deg, transparent, #2278ff 22%, transparent 22%) right center / 64px 6px no-repeat,
    linear-gradient(270deg, transparent, #e22b2f 22%, transparent 22%) left center / 64px 6px no-repeat;
}

body:not(.in-game) .eyebrow::before,
body:not(.in-game) .eyebrow::after {
  content: "";
  display: inline-block;
  width: 58px;
  height: 6px;
  vertical-align: middle;
}

body:not(.in-game) .eyebrow::before {
  margin-left: 14px;
  background: linear-gradient(90deg, transparent, #2278ff);
  clip-path: polygon(0 35%, 82% 35%, 82% 0, 100% 50%, 82% 100%, 82% 65%, 0 65%);
}

body:not(.in-game) .eyebrow::after {
  margin-right: 14px;
  background: linear-gradient(270deg, transparent, #e22b2f);
  clip-path: polygon(18% 0, 18% 35%, 100% 35%, 100% 65%, 18% 65%, 18% 100%, 0 50%);
}

body:not(.in-game) h1 {
  order: 1;
  max-width: none;
  color: #f2f2ef;
  font-size: 0;
  font-weight: 1000;
  line-height: 0.86;
  letter-spacing: 0;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.82));
}

body:not(.in-game) h1::before {
  content: "حرب";
  color: #d9292e;
  margin-left: 16px;
  font-size: clamp(58px, 5.8vw, 98px);
}

body:not(.in-game) h1::after {
  content: "الجماهير";
  color: #f2f2ef;
  font-size: clamp(58px, 5.8vw, 98px);
}

body:not(.in-game) .sound-prompt {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 5;
  background: rgba(227, 179, 65, 0.9);
  color: #17140b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

body:not(.in-game) .room-card {
  position: relative;
  z-index: 1;
  width: min(650px, calc(100vw - 48px));
  gap: 12px;
  padding: 20px 26px;
  border-color: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(8, 12, 13, 0.76);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.52),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}

body:not(.in-game) label {
  color: rgba(245, 241, 232, 0.72);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

body:not(.in-game) input,
body:not(.in-game) select {
  height: 48px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(3, 8, 10, 0.72);
  color: #f5f1e8;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

body:not(.in-game) input:focus,
body:not(.in-game) select:focus {
  border-color: rgba(227, 179, 65, 0.9);
  box-shadow: 0 0 0 3px rgba(227, 179, 65, 0.18);
}

body:not(.in-game) .mode-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body:not(.in-game) .mode-row.single {
  grid-template-columns: 1fr;
}

body:not(.in-game) .actions {
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}

body:not(.in-game) .actions button {
  height: 52px;
  min-height: 52px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 1000;
}

body:not(.in-game) button.primary {
  border-color: rgba(255, 220, 122, 0.45);
  background: linear-gradient(180deg, #f1c94a, #d99c25);
  color: #171008;
  box-shadow:
    0 12px 26px rgba(217, 156, 37, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

body:not(.in-game) .actions button:not(.primary) {
  background: rgba(31, 39, 39, 0.9);
  color: #f5f1e8;
}

body:not(.in-game) .notes {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 52px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-top: auto;
  padding-bottom: 2px;
  color: #f5f1e8;
  text-align: center;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.75);
}

body:not(.in-game) .notes span {
  border: 0;
  border-radius: 0;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(27, 95, 176, 0.58), rgba(0, 0, 0, 0.1));
  font-size: clamp(17px, 1.35vw, 25px);
  font-weight: 1000;
}

body:not(.in-game) .notes span:nth-child(3) {
  background: linear-gradient(270deg, rgba(176, 27, 31, 0.58), rgba(0, 0, 0, 0.1));
}

body:not(.in-game) .notes strong {
  color: #f5f1e8;
  font-size: clamp(32px, 3vw, 52px);
  font-style: italic;
  line-height: 1;
}

@media (max-width: 760px), (orientation: portrait) {
  body:not(.in-game) {
    overflow: auto;
  }

  body:not(.in-game) .shell {
    min-height: 100svh;
    height: auto;
    overflow: visible;
    background:
      radial-gradient(circle at 20% 78%, rgba(31, 112, 255, 0.44), transparent 29%),
      radial-gradient(circle at 80% 78%, rgba(219, 36, 44, 0.44), transparent 29%),
      radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.16), transparent 20%),
      linear-gradient(90deg, rgba(0, 52, 120, 0.76), rgba(4, 6, 8, 0.42) 38%, rgba(4, 6, 8, 0.42) 62%, rgba(120, 8, 15, 0.76)),
      linear-gradient(180deg, #09111a 0%, #05080a 48%, #0a0708 100%),
      #070b0e;
  }

  body:not(.in-game) .lobby {
    height: auto;
    min-height: 100svh;
    gap: 16px;
    padding: max(66px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  }

  body:not(.in-game) .eyebrow {
    font-size: clamp(16px, 4.2vw, 22px);
  }

  body:not(.in-game) .eyebrow::before,
  body:not(.in-game) .eyebrow::after {
    width: 38px;
  }

  body:not(.in-game) .eyebrow::before {
    margin-left: 8px;
  }

  body:not(.in-game) .eyebrow::after {
    margin-right: 8px;
  }

  body:not(.in-game) h1::before,
  body:not(.in-game) h1::after {
    font-size: clamp(52px, 15vw, 88px);
  }

  body:not(.in-game) .room-card {
    width: min(100%, 520px);
    gap: 12px;
    padding: 18px;
    background: rgba(8, 12, 13, 0.76);
  }

  body:not(.in-game) .mode-row,
  body:not(.in-game) .actions {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  body:not(.in-game) .mode-row.single {
    grid-template-columns: 1fr;
  }

  body:not(.in-game) label {
    font-size: 13px;
  }

  body:not(.in-game) input,
  body:not(.in-game) select {
    height: 47px;
    font-size: 15px;
  }

  body:not(.in-game) .actions {
    grid-template-columns: 1fr;
  }

  body:not(.in-game) .actions button {
    height: 54px;
    min-height: 54px;
    font-size: 20px;
  }

  body:not(.in-game) .notes {
    width: 100%;
    gap: 10px;
    margin-top: 8px;
  }

  body:not(.in-game) .notes span {
    padding: 8px 6px;
    font-size: clamp(14px, 4vw, 22px);
  }

  body:not(.in-game) .notes strong {
    font-size: clamp(30px, 10vw, 48px);
  }
}

body:not(.in-game) .brand::after {
  content: "\0627\062E\062A\0631 \0641\0631\064A\0642\0643... \0648\0627\062F\062E\0644 \0627\0644\0645\0639\0631\0643\0629";
}

body:not(.in-game) h1::before {
  content: "\062D\0631\0628";
}

body:not(.in-game) h1::after {
  content: "\0627\0644\062C\0645\0627\0647\064A\0631";
}

/* Final lobby skin: use the supplied mockups as the real stage artwork, then place live controls over them. */
body:not(.in-game) {
  overflow: hidden;
}

body:not(.in-game) .shell {
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.02)),
    url("assets/images/lobby-desktop.png") center / cover no-repeat,
    #05080b;
}

body:not(.in-game) .shell::before,
body:not(.in-game) .shell::after,
body:not(.in-game) .lobby::before,
body:not(.in-game) .lobby::after {
  display: none;
}

body:not(.in-game) .lobby {
  width: 100vw;
  height: 100svh;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr;
  place-items: center;
  overflow: hidden;
}

body:not(.in-game) .brand,
body:not(.in-game) .notes {
  display: none;
}

body:not(.in-game) .sound-prompt {
  top: 18px;
  left: 18px;
}

body:not(.in-game) .room-card {
  position: absolute;
  left: 50%;
  top: 53.4%;
  transform: translate(-50%, -50%);
  width: min(590px, 35.2vw);
  min-width: 540px;
  gap: 15px;
  padding: 18px 22px;
  border: 1px solid rgba(245, 241, 232, 0.12);
  border-radius: 8px;
  background: rgba(2, 7, 9, 0.64);
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.52),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(8px);
}

body:not(.in-game) .room-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -10px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 18% 30%, rgba(29, 82, 133, 0.14), transparent 32%),
    radial-gradient(circle at 82% 72%, rgba(120, 22, 24, 0.14), transparent 34%),
    rgba(0, 0, 0, 0.36);
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

body:not(.in-game) .room-card label {
  gap: 8px;
  color: rgba(245, 241, 232, 0.68);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.72);
}

body:not(.in-game) .room-card input,
body:not(.in-game) .room-card select {
  height: 46px;
  border: 1px solid rgba(245, 241, 232, 0.26);
  border-radius: 6px;
  background: rgba(3, 8, 10, 0.66);
  color: #f5f1e8;
  font-size: 16px;
  font-weight: 900;
  text-align: right;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.36);
}

body:not(.in-game) .room-card select {
  appearance: auto;
}

body:not(.in-game) .room-card input:focus,
body:not(.in-game) .room-card select:focus {
  border-color: rgba(227, 179, 65, 0.9);
  box-shadow: 0 0 0 2px rgba(227, 179, 65, 0.18), inset 0 0 18px rgba(0, 0, 0, 0.18);
}

body:not(.in-game) .mode-row {
  grid-template-columns: repeat(2, 1fr);
  gap: 42px;
}

body:not(.in-game) .mode-row.single {
  grid-template-columns: 1fr;
  padding-right: calc(50% + 21px);
}

body:not(.in-game) .actions {
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}

body:not(.in-game) .actions button {
  height: 48px;
  min-height: 48px;
  border-radius: 7px;
  font-size: 20px;
  font-weight: 1000;
}

body:not(.in-game) .actions button.primary {
  background: linear-gradient(180deg, rgba(244, 202, 65, 0.95), rgba(215, 151, 32, 0.95));
  color: #120d06;
}

body:not(.in-game) .actions button:not(.primary) {
  background: rgba(27, 37, 37, 0.8);
  color: #f5f1e8;
}

@media (max-width: 760px), (orientation: portrait) {
  body:not(.in-game) {
    overflow: auto;
  }

  body:not(.in-game) .shell {
    height: auto;
    min-height: 100svh;
    overflow: visible;
    background:
      linear-gradient(rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.02)),
      url("assets/images/lobby-mobile.png") center top / cover no-repeat,
      #05080b;
  }

  body:not(.in-game) .lobby {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  body:not(.in-game) .room-card {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: min(390px, calc(100vw - 56px));
    min-width: 0;
    margin-top: clamp(292px, 33.5svh, 350px);
    margin-bottom: clamp(128px, 16svh, 190px);
    gap: 9px;
    padding: 13px 16px;
    background: rgba(2, 7, 9, 0.74);
    backdrop-filter: blur(9px);
  }

  body:not(.in-game) .room-card::before {
    inset: -8px;
    background:
      radial-gradient(circle at 18% 30%, rgba(29, 82, 133, 0.12), transparent 32%),
      radial-gradient(circle at 82% 72%, rgba(120, 22, 24, 0.12), transparent 34%),
      rgba(0, 0, 0, 0.48);
  }

  body:not(.in-game) .room-card label {
    font-size: 12px;
    gap: 4px;
  }

  body:not(.in-game) .room-card input,
  body:not(.in-game) .room-card select {
    height: 42px;
    font-size: 14px;
  }

  body:not(.in-game) .mode-row {
    gap: 14px;
  }

  body:not(.in-game) .mode-row.single {
    padding-right: 0;
  }

  body:not(.in-game) .actions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 6px;
  }

  body:not(.in-game) .actions button {
    height: 48px;
    min-height: 48px;
    font-size: 19px;
  }
}
