:root {
  --bg: #07060b;
  --card: rgba(22, 18, 30, 0.9);
  --line: rgba(232, 197, 107, 0.18);
  --gold: #e8c56b;
  --fog: #8dffc0;
  --danger: #ff5d5d;
  --mute: #9a92a8;
  --text: #f4eef8;
  --ok: #6ee7a8;
  --setup: #7ec8ff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 480px at 50% -12%, rgba(125, 40, 40, 0.24), transparent 55%),
    radial-gradient(700px 380px at 100% 100%, rgba(40, 90, 70, 0.16), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}
body { padding: 10px 10px 24px; }
.wrap { max-width: 720px; margin: 0 auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand h1 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.brand p { margin: 0; color: var(--mute); font-size: 0.74rem; }
.lang {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--gold);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  backdrop-filter: blur(8px);
}
.lobby h2, .sec-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
  width: 100%;
  background: #0c0a12;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
textarea { min-height: 64px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  min-height: 46px;
}
.btn-gold { background: var(--gold); color: #1a1408; }
.btn-ghost { background: #221c2c; color: var(--text); }
.btn-danger { background: #3a1518; color: var(--danger); }
.btn-fog { background: #143226; color: var(--fog); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hint { color: var(--mute); font-size: 0.84rem; margin: 8px 0 0; }
.notify-bar {
  background: #16121c;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: none;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.notify-bar.show { display: flex; }
.notify-bar p {
  margin: 0;
  color: #e8e0f0;
  font-size: 0.84rem;
  line-height: 1.4;
  flex: 1 1 220px;
}
.notify-bar .btn { min-height: 42px; padding: 8px 12px; }
.notify-bar a { color: var(--gold); }
.code {
  font-size: 1.45rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-weight: 800;
}
.players { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.78rem;
  color: var(--mute);
}
.pill.on { color: var(--fog); border-color: rgba(141, 255, 192, 0.35); }

.hero {
  text-align: center;
  padding: 16px 12px 14px;
  border-radius: 18px;
  background: #0c0a12;
  border: 1px solid var(--line);
}
.hero.hot {
  border-color: rgba(255, 93, 93, 0.7);
  box-shadow: 0 0 28px rgba(255, 60, 60, 0.28);
  background: radial-gradient(circle at 50% 0%, rgba(255, 70, 70, 0.22), #0c0a12 70%);
}
.hero.cool {
  border-color: rgba(141, 255, 192, 0.45);
  box-shadow: 0 0 20px rgba(80, 180, 130, 0.16);
}
.hero.setup {
  border-color: rgba(126, 200, 255, 0.55);
  box-shadow: 0 0 22px rgba(80, 150, 220, 0.2);
}
.hero .label {
  color: var(--mute);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
}
.hero.hot .label { color: var(--danger); }
.hero.cool .label { color: var(--fog); }
.hero.setup .label { color: var(--setup); }
.hero .time {
  font-size: clamp(3.4rem, 18vw, 5.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 0.95;
  margin: 6px 0 4px;
}
.hero .sub { color: var(--mute); font-size: 0.86rem; min-height: 1.2em; }

.mini-timers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.mini {
  background: #0c0a12;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}
.mini.hot { border-color: rgba(255, 93, 93, 0.5); }
.mini.cool { border-color: rgba(141, 255, 192, 0.4); }
.mini .label { color: var(--mute); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; }
.mini .time {
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.1;
}

.acts { display: grid; gap: 8px; margin-top: 10px; }
.act-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: rgba(8, 6, 12, 0.55);
}
.act-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.act-head span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--mute);
}
.tile-main { min-height: 72px; font-size: 1.02rem; }
.tile-sub { min-height: 64px; font-size: 0.86rem; }
.settings-hint { margin: 2px 2px 0; font-size: 0.78rem; }
.help-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: #0c0a12;
}
.help-box summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  list-style: none;
}
.help-box summary::-webkit-details-marker { display: none; }
.help-box summary::before { content: "▸ "; }
.help-box[open] summary::before { content: "▾ "; }
.help-box ul {
  margin: 8px 0 2px;
  padding-left: 18px;
  color: var(--mute);
  font-size: 0.8rem;
  line-height: 1.4;
}
.help-box li { margin-bottom: 6px; }
.guide-box {
  margin-top: 12px;
  padding: 12px 14px 16px;
  border: 2px solid rgba(232, 197, 107, 0.35);
  position: static;
}
.guide-box summary {
  font-size: 1.08rem;
  font-weight: 800;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.guide {
  margin-top: 10px;
  display: grid;
  gap: 16px;
}
.guide-sec h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.guide-sec p, .guide-sec li {
  color: #e8e0f0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.guide-sec p { margin: 0 0 8px; }
.guide-sec ol, .guide-sec ul {
  margin: 0;
  padding-left: 1.2em;
}
.guide-sec li { margin-bottom: 8px; }
.guide-rules {
  list-style: none;
  padding-left: 0;
}
.guide-rules li {
  background: rgba(232, 197, 107, 0.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.guide-if {
  color: var(--gold);
  font-weight: 800;
  font-size: 0.86rem;
}
.guide-then {
  color: #e8e0f0;
  font-size: 0.9rem;
}
.ring-flash {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(18, 0, 4, 0.72);
  color: #ffe3e3;
  font-size: clamp(2.4rem, 14vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  z-index: 80;
  pointer-events: none;
}
.ring-flash.on { display: flex; }
.tile {
  border: 0;
  border-radius: 16px;
  padding: 16px 12px;
  min-height: 76px;
  width: 100%;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text);
}
.tile span {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  opacity: 0.78;
  text-transform: none;
}
.tile-xl { min-height: 88px; font-size: 1.12rem; }
.tile-door { background: #16344a; color: var(--setup); }
.tile-hunt { background: #4a1418; color: #ffd0d0; font-size: 1.18rem; }
.tile-fog { background: #143226; color: var(--fog); }
.tile-gold { background: #3a2c12; color: var(--gold); }
.tile-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.tile-row-2 { grid-template-columns: 1fr 1fr; }
.tile-row .tile { min-height: 68px; font-size: 0.82rem; padding: 12px 6px; }
.chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: -2px;
}
.chip {
  border: 1px solid var(--line);
  background: #16121c;
  color: var(--mute);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
}
.chip:active, .tile:active { transform: scale(0.98); }

.room-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.settings-box { padding: 8px 12px; }
.settings-box summary {
  cursor: pointer;
  color: var(--mute);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  list-style: none;
}
.settings-box summary::-webkit-details-marker { display: none; }
.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.settings .wide { grid-column: 1 / -1; }
.ev {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
}
.ev button {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #121018;
  color: var(--text);
  padding: 9px 6px;
  cursor: pointer;
  min-height: 44px;
  font-weight: 650;
  font-size: 0.82rem;
}
.ev button.found { background: #163326; border-color: var(--fog); color: var(--fog); }
.ev button.ruled { background: #2a1418; border-color: var(--danger); color: var(--danger); text-decoration: line-through; }
.ghosts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.ghost {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 9px;
  background: #0e0c14;
  cursor: pointer;
}
.ghost.guess { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.ghost h3 { margin: 0 0 2px; font-size: 0.92rem; }
.ghost .meta { color: var(--mute); font-size: 0.7rem; }
.ghost .tell { margin-top: 4px; font-size: 0.74rem; color: #d7cfe2; }
.muted { opacity: 0.38; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status { font-size: 0.8rem; color: var(--mute); }
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1724;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 14px;
  border-radius: 999px;
  display: none;
  z-index: 20;
}
@media (max-width: 520px) {
  .tile-row { grid-template-columns: 1fr 1fr; }
  .tile-row:not(.tile-row-2) .tile:last-child { grid-column: 1 / -1; }
}
@media (min-width: 821px) {
  .wrap { max-width: 860px; }
}
