:root {
  --bg0: #070913;
  --bg1: #101a33;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
  --radius: 18px;
  --primary0: #5b8cff;
  --primary1: #8d5bff;
  --danger: #ff4d6d;
  --ok: #44d19d;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 15% 10%, #223a7a 0%, transparent 55%),
    radial-gradient(900px 500px at 95% 20%, #4a1c77 0%, transparent 55%),
    radial-gradient(900px 500px at 40% 100%, #133c3b 0%, transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

a {
  color: inherit;
}

.container {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(10, 13, 28, 0.65);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand__mark {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary0), var(--primary1));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

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

.link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.link:hover {
  color: var(--text);
}

.hero {
  padding: 26px 0 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

.error {
  color: var(--danger);
  font-weight: 650;
  margin: 10px 0 0;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 10px 0 18px;
}

@media (min-width: 860px) {
  .grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.field label {
  display: block;
  font-weight: 650;
  margin: 0 0 8px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 12, 26, 0.55);
  color: var(--text);
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: rgba(91, 140, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.18);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary0);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row--tight {
  gap: 12px;
}

.pill {
  min-width: 42px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 800;
}

.button {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
}

.button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--primary {
  border: none;
  background: linear-gradient(135deg, var(--primary0), var(--primary1));
  box-shadow: 0 14px 30px rgba(91, 140, 255, 0.18);
}

.button--primary:hover {
  filter: brightness(1.05);
}

.details {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
}

.details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.result {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.result__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

@media (min-width: 520px) {
  .result__actions {
    grid-template-columns: 1fr 1fr;
  }

  #openGameBtn {
    grid-column: span 2;
  }
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 6px 0;
}

.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.footer {
  padding: 8px 0 26px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(10, 12, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 650;
}

/* Game page */
.gameHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.actions {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

@media (min-width: 680px) {
  .actions {
    grid-template-columns: 2fr 1fr 1fr;
  }

  .actions.actions--secondary {
    grid-template-columns: 1fr;
  }
}

.timerCard {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--card2);
  padding: 14px;
  margin-top: 10px;
}

.timerRow {
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.countdown {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.timerMeta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.terms {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.term {
  display: block;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 12, 26, 0.42);
  text-decoration: none;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.term:hover {
  background: rgba(10, 12, 26, 0.55);
}

.terms--hidden .term {
  filter: blur(12px);
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


/* Theme Switcher Select */
select#themeSelect {
  appearance: none;
  background-color: rgba(10, 12, 26, 0.55);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px !important;
}

select#themeSelect option {
  background-color: #070913;
  color: #fff;
}