:root {
  color-scheme: dark;
  --bg: #080b18;
  --bg-2: #151022;
  --panel: rgba(16, 20, 36, 0.82);
  --panel-strong: rgba(19, 17, 31, 0.97);
  --card: rgba(255, 255, 255, 0.075);
  --card-2: rgba(255, 255, 255, 0.11);
  --ink: #fff4dc;
  --muted: #b9c1d8;
  --line: rgba(255, 238, 197, 0.18);
  --orange: #ff9d44;
  --gold: #f5cf70;
  --lime: #bffd6a;
  --cyan: #55e4ff;
  --pink: #ff5ba6;
  --red: #ff6171;
  --violet: #7c5cff;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  --epic-border: linear-gradient(135deg, rgba(245, 207, 112, 0.86), rgba(85, 228, 255, 0.42), rgba(255, 91, 166, 0.54));
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -18%, rgba(245, 207, 112, 0.22), transparent 34rem),
    radial-gradient(circle at 8% 20%, rgba(124, 92, 255, 0.27), transparent 28rem),
    radial-gradient(circle at 88% 14%, rgba(85, 228, 255, 0.17), transparent 26rem),
    linear-gradient(135deg, #080b18 0%, #151022 46%, #081827 100%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(245, 207, 112, 0.12) 12.2%, transparent 12.6% 87.4%, rgba(245, 207, 112, 0.12) 87.8%, transparent 88%),
    linear-gradient(rgba(255, 244, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 244, 220, 0.04) 1px, transparent 1px),
    repeating-linear-gradient(118deg, transparent 0 28px, rgba(255, 244, 220, 0.035) 29px, transparent 31px),
    linear-gradient(155deg, rgba(255, 157, 68, 0.18), transparent 38%),
    linear-gradient(25deg, transparent 56%, rgba(85, 228, 255, 0.15));
  background-size: auto, 54px 54px, 54px 54px, auto, auto, auto;
  opacity: 0.92;
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0 42%, rgba(0, 0, 0, 0.44) 78%, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}

.app {
  width: min(1120px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.shell {
  display: grid;
  gap: 14px;
}

.shell.two {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(245, 207, 112, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(245, 207, 112, 0.94), rgba(255, 157, 68, 0.82) 42%, rgba(85, 228, 255, 0.7)),
    #171125;
  color: #0b0b16;
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  box-shadow: 0 12px 36px rgba(245, 207, 112, 0.22), 0 0 0 6px rgba(245, 207, 112, 0.08);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(8, 11, 24, 0.42);
  border-radius: 6px;
  transform: rotate(45deg);
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand-name {
  display: block;
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
}

.brand-sub {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero,
.panel,
.game-card,
.mission-card,
.modal-card {
  position: relative;
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--epic-border) border-box;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 70px);
  padding: clamp(22px, 5vw, 56px);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(245, 207, 112, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(85, 228, 255, 0.1) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(112deg, black, transparent 74%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(245, 207, 112, 0.22);
  border-radius: 8px;
  pointer-events: none;
}

.hero-veil {
  position: absolute;
  inset: auto -12% -26% -12%;
  height: 52%;
  background:
    radial-gradient(ellipse at center, rgba(245, 207, 112, 0.16), transparent 58%),
    linear-gradient(0deg, rgba(255, 157, 68, 0.08), transparent);
  filter: blur(4px);
  pointer-events: none;
  z-index: -1;
}

.hero-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(18px, 5vw, 44px);
  align-items: center;
  min-height: calc(100vh - 170px);
}

.eyebrow,
.label {
  margin: 0;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 16px;
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 7.3rem;
  line-height: 0.86;
  letter-spacing: 0;
  color: #fff7e4;
  text-shadow: 0 0 34px rgba(245, 207, 112, 0.2), 0 12px 42px rgba(0, 0, 0, 0.4);
}

h2 {
  margin-bottom: 8px;
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.04rem;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.56;
}

.lede {
  max-width: 560px;
  color: #e7e2f1;
  font-size: 1.18rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid rgba(255, 244, 220, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06)),
    var(--card-2);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 207, 112, 0.48);
  box-shadow: 0 10px 28px rgba(245, 207, 112, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.button.primary {
  background:
    linear-gradient(135deg, var(--gold), var(--orange) 46%, #ff5f8f),
    #ff9d44;
  color: #11101b;
  box-shadow: 0 14px 34px rgba(255, 157, 68, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.button.success {
  background: linear-gradient(135deg, var(--lime), #7effbc);
  color: #111728;
}

.button.ghost {
  border-color: rgba(245, 207, 112, 0.24);
  background: rgba(255, 255, 255, 0.065);
}

.button.danger {
  background: rgba(255, 97, 113, 0.16);
  color: #ffe2e6;
}

.button.full {
  width: 100%;
}

.hero-card {
  position: relative;
  min-height: 480px;
  padding: 18px;
  border: 1px solid rgba(245, 207, 112, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(245, 207, 112, 0.12), rgba(255, 255, 255, 0.04)),
    radial-gradient(circle at 50% 18%, rgba(85, 228, 255, 0.16), transparent 44%),
    rgba(10, 8, 20, 0.52);
  box-shadow: 0 28px 74px rgba(0, 0, 0, 0.45);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(245, 207, 112, 0.24);
  border-radius: 8px;
  transform: rotate(2deg);
  pointer-events: none;
}

.cover-card {
  position: relative;
  display: grid;
  height: 100%;
  min-height: 420px;
  place-items: center;
  border: 1px solid rgba(245, 207, 112, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(245, 207, 112, 0.14), transparent 38%),
    conic-gradient(from 45deg, rgba(245, 207, 112, 0.18), rgba(85, 228, 255, 0.13), rgba(124, 92, 255, 0.2), rgba(245, 207, 112, 0.18)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.075) 0 1px, transparent 1px 18px),
    linear-gradient(145deg, rgba(14, 18, 34, 0.92), rgba(28, 16, 42, 0.86));
  text-align: center;
  overflow: hidden;
}

.cover-card::before,
.cover-card::after {
  content: "";
  position: absolute;
  width: 62%;
  aspect-ratio: 1;
  border: 1px solid rgba(245, 207, 112, 0.24);
  border-radius: 8px;
  transform: rotate(45deg);
}

.cover-card::after {
  width: 38%;
  border-color: rgba(85, 228, 255, 0.28);
}

.hidden-letter {
  position: relative;
  z-index: 1;
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 9rem;
  font-weight: 900;
  line-height: 0.8;
  color: #fff3cf;
  text-shadow: 0 0 32px rgba(245, 207, 112, 0.36), 0 12px 32px rgba(0, 0, 0, 0.48);
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255, 244, 220, 0.16);
  border-radius: 8px;
  background: rgba(6, 10, 24, 0.44);
  color: var(--ink);
  outline: none;
  padding: 0 14px;
}

.textarea {
  min-height: 92px;
  padding: 12px 14px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(88, 220, 255, 0.14);
}

.grid {
  display: grid;
  gap: 12px;
}

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

.panel {
  padding: 18px;
}

.panel.tight {
  padding: 14px;
}

.room-code {
  display: inline-flex;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(245, 207, 112, 0.45);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(245, 207, 112, 0.14), rgba(255, 255, 255, 0.06));
  color: var(--gold);
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0;
}

.qr {
  width: 100%;
  max-width: 250px;
  border: 10px solid #fff4dc;
  border-radius: 8px;
  background: #fff;
}

.players {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 244, 220, 0.15);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.045));
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #14101d;
  font-weight: 1000;
}

.player strong,
.truncate {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 244, 220, 0.17);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #eadff5;
  font-size: 0.78rem;
  font-weight: 900;
}

.badge.hot {
  border-color: rgba(245, 207, 112, 0.5);
  color: #ffe2a1;
}

.badge.good {
  border-color: rgba(203, 255, 92, 0.42);
  color: #ecffc0;
}

.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.timer {
  display: grid;
  min-width: 116px;
  min-height: 58px;
  place-items: center;
  border: 1px solid rgba(245, 207, 112, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(245, 207, 112, 0.14), rgba(0, 0, 0, 0.2)),
    rgba(0, 0, 0, 0.24);
  color: var(--gold);
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
}

.mission-list {
  display: grid;
  gap: 12px;
}

.mission-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(245, 207, 112, 0.7), rgba(85, 228, 255, 0.28), rgba(255, 91, 166, 0.3)) border-box;
}

.mission-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(245, 207, 112, 0.08), transparent 42%);
  pointer-events: none;
}

.mission-card.done {
  border-color: rgba(203, 255, 92, 0.45);
  background: rgba(203, 255, 92, 0.12);
}

.mission-secret {
  position: relative;
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px solid rgba(245, 207, 112, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 207, 112, 0.12), transparent 46%),
    repeating-linear-gradient(90deg, rgba(255, 244, 220, 0.07) 0 1px, transparent 1px 12px),
    rgba(255, 255, 255, 0.055);
}

.mission-card.revealed .mission-secret {
  display: block;
  min-height: 0;
  padding: 4px 0 0;
  border: 0;
  background: transparent;
}

.mission-text {
  margin: 10px 0 14px;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.16;
}

.cover-text {
  padding: 0 18px;
  text-align: center;
}

.cover-text strong {
  display: block;
  color: var(--ink);
  font-family: Cinzel, "Space Grotesk", Inter, sans-serif;
  font-size: 1.35rem;
}

.cover-text span {
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.tab {
  min-height: 42px;
  border: 1px solid rgba(255, 244, 220, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-weight: 900;
}

.tab.active {
  background: rgba(245, 207, 112, 0.15);
  color: var(--ink);
  border-color: rgba(245, 207, 112, 0.42);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff4dc, #f5cf70);
  color: #0b0b16;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(5, 7, 16, 0.74);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  padding: 18px;
  background: var(--panel-strong);
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.score-row {
  display: grid;
  gap: 9px;
}

.score-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.notice {
  border-left: 4px solid var(--gold);
  padding: 12px;
  border-radius: 8px;
  background: rgba(245, 207, 112, 0.12);
  color: #fff1c4;
}

@media (max-width: 900px) {
  .shell.two,
  .hero-content {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-content {
    min-height: auto;
  }

  .hero-card {
    min-height: 330px;
  }

  .cover-card {
    min-height: 280px;
  }

  h1 {
    font-size: 5.1rem;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100vw - 16px, 520px);
    padding-top: 8px;
  }

  .hero,
  .panel,
  .game-card {
    padding: 14px;
  }

  .actions,
  .grid.two,
  .game-header {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

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

  h1 {
    font-size: 3.7rem;
  }

  h2 {
    font-size: 1.62rem;
  }

  .lede {
    font-size: 1.05rem;
  }
}
