:root {
  --bg: #0b1020;
  --surface: #121a2d;
  --surface-soft: #18233a;
  --line: rgba(181, 196, 228, 0.18);
  --text: #eef3ff;
  --muted: #a7b5d2;
  --accent: #7dd3fc;
  --accent-2: #c084fc;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
  --red: #f87171;
  --blue: #60a5fa;
  --yellow: #fbbf24;
  --green: #34d399;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.12), transparent 24%),
    radial-gradient(circle at 88% 10%, rgba(192, 132, 252, 0.12), transparent 22%),
    linear-gradient(180deg, #050815 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 20px));
  margin: 0 auto;
  padding: 18px 0 180px;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: var(--shadow);
}

.hero {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

h1,
h2,
p,
ul {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.lede {
  max-width: 44rem;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.75;
}

.hero-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.game-card {
  margin-top: 16px;
  padding: 18px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}

.toolbar-group {
  display: grid;
  gap: 8px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mode-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.mode-btn {
  border: 0;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mode-btn.is-active {
  background: rgba(125, 211, 252, 0.16);
  color: var(--text);
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.ghost-btn,
.primary-btn {
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
}

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

.primary-btn {
  border: 1px solid rgba(125, 211, 252, 0.25);
  color: #08111d;
  background: linear-gradient(180deg, #bcecff 0%, #7dd3fc 100%);
}

.select-wrap {
  display: inline-flex;
}

.select-control {
  min-width: 160px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.select-control:focus {
  border-color: rgba(125, 211, 252, 0.5);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.14);
}

.status-card {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.status-line {
  font-size: 1.08rem;
  font-weight: 800;
}

.support-line,
.info-panel li,
.note {
  color: var(--muted);
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.main-panel,
.info-panel {
  padding: 16px;
}

.mode-view[hidden] {
  display: none;
}

.sequence-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sequence-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sequence-display {
  margin-top: 10px;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  font-size: clamp(1rem, 3vw, 1.6rem);
  line-height: 1.5;
}

.color-spot {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.color-spot.is-red {
  background: rgba(248, 113, 113, 0.2);
  color: #ffd3d3;
}

.color-spot.is-blue {
  background: rgba(96, 165, 250, 0.2);
  color: #dbeafe;
}

.color-spot.is-yellow {
  background: rgba(251, 191, 36, 0.18);
  color: #fff3bf;
}

.color-spot.is-green {
  background: rgba(52, 211, 153, 0.18);
  color: #d1fae5;
}

.sequence-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.06em;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.color-tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 0 -18px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.color-tile:hover:not(:disabled),
.color-tile:focus-visible:not(:disabled),
.color-tile.is-active {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.1) saturate(1.2);
  box-shadow:
    inset 0 -18px 24px rgba(0, 0, 0, 0.18),
    0 0 0 4px rgba(255, 255, 255, 0.22),
    0 0 28px rgba(255, 255, 255, 0.25),
    0 18px 28px rgba(0, 0, 0, 0.22);
}

.color-tile:disabled {
  cursor: default;
  filter: saturate(0.8) brightness(0.85);
}

.color-tile.is-active::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.color-tile.is-active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.18), transparent 58%);
  pointer-events: none;
}

.color-tile.red {
  background: linear-gradient(180deg, #fb7185 0%, #ef4444 100%);
}

.color-tile.blue {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.color-tile.yellow {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.color-tile.green {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
}

.number-form {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

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

.number-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.number-input:focus {
  border-color: rgba(125, 211, 252, 0.5);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.14);
}

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

.key {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  min-height: 52px;
}

.key.wide {
  grid-column: span 2;
}

.info-panel h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.info-panel ul {
  margin: 0 0 14px 18px;
  padding: 0;
}

.note {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.hud-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 20;
  width: min(1120px, calc(100% - 20px));
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  backdrop-filter: blur(14px);
  background: rgba(7, 12, 22, 0.78);
}

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

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  white-space: nowrap;
}

.hud-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  color: var(--muted);
  line-height: 1.5;
}

.hud-copy strong {
  color: var(--text);
}

@media (max-width: 860px) {
  .hero-top {
    display: grid;
  }

  .hero-meta {
    justify-items: start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    margin-left: 0;
  }

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

  .select-control {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 14px, 1120px);
    padding: 12px 0 24px;
  }

  .hero,
  .game-card {
    padding: 16px;
    border-radius: 20px;
  }

  .main-panel,
  .info-panel {
    padding: 14px;
  }

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

  .keyboard {
    gap: 8px;
  }

  .key {
    min-height: 48px;
    border-radius: 14px;
  }

  .shell {
    padding-bottom: 220px;
  }

  .hud-dock {
    width: calc(100% - 14px);
    bottom: 8px;
    padding: 10px 12px;
  }

  .hud-row {
    gap: 6px;
  }

  .hud-pill {
    padding: 7px 10px;
    font-size: 0.9rem;
  }
}
