:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d8dce3;
  --brand: #0066cc;
  --brand-soft: #eaf3ff;
  --green: #1d7f45;
  --red: #d70015;
  --shadow: 0 24px 70px rgb(17 24 39 / 14%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 14%, rgb(0 102 204 / 14%), transparent 26%),
    radial-gradient(circle at 84% 18%, rgb(29 127 69 / 12%), transparent 24%),
    linear-gradient(135deg, #f8fafc 0%, #f5f5f7 56%, #fff7ed 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.options button:disabled,
.tiles button:disabled,
.board button:disabled,
.lanes button:disabled {
  color: var(--text);
  -webkit-text-fill-color: currentColor;
  opacity: 0.84;
}

.options button:disabled span,
.tiles button:disabled span,
.board button:disabled span,
.lanes button:disabled span {
  color: var(--muted);
  -webkit-text-fill-color: currentColor;
}

.options button:disabled.selected,
.tiles button:disabled.selected,
.board button:disabled.selected,
.lanes button:disabled.selected {
  opacity: 0.95;
}

#app {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero,
.play,
.result,
.history {
  border: 1px solid rgb(216 220 227 / 78%);
  background: rgb(255 255 255 / 88%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 32px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.95;
  letter-spacing: 0;
}

.meta {
  display: grid;
  min-width: min(420px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta span {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.play {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 20px;
  margin-top: 20px;
  border-radius: 34px;
  padding: 20px;
}

.prompt {
  display: grid;
  min-height: 520px;
  align-content: center;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgb(0 102 204 / 11%), transparent 46%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 38px;
}

.prompt > strong {
  display: block;
  max-width: 480px;
  color: var(--text);
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.04;
}

.prompt > span {
  display: block;
  max-width: 500px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.5;
}

.signals {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.signals li {
  display: grid;
  min-height: 76px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--signal-color);
}

.signals li.target {
  border-color: var(--signal-color);
  box-shadow: inset 0 0 0 2px var(--signal-color);
}

.signals strong {
  font-size: 28px;
  line-height: 1;
}

.signals span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  padding: 18px;
}

.stake {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.stake input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  padding: 0 16px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.stake input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lanes button {
  display: grid;
  min-height: 128px;
  align-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 92%), rgb(248 250 252 / 78%)),
    var(--surface-soft);
  padding: 18px;
  color: var(--text);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.lanes button::before {
  display: block;
  width: 38px;
  height: 7px;
  border-radius: 999px;
  background: var(--lane-color);
  content: "";
}

.lanes button:not(:disabled):hover,
.lanes button.selected {
  border-color: var(--lane-color);
  box-shadow: inset 0 0 0 2px var(--lane-color);
  transform: translateY(-1px);
}

.lanes strong {
  color: var(--text);
  font-size: 22px;
}

.lanes span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.42;
}

.sort-button {
  min-height: 62px;
  border: 0;
  border-radius: 22px;
  background: var(--text);
  color: #fff;
  font-weight: 850;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.sort-button:not(:disabled):hover {
  background: var(--brand);
  transform: translateY(-1px);
}

.result {
  display: flex;
  min-height: 118px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 20px;
  border-radius: 30px;
  padding: 26px;
}

.result.win {
  border-color: rgb(29 127 69 / 24%);
  background: rgb(240 253 244 / 88%);
}

.result.lose {
  border-color: rgb(215 0 21 / 18%);
  background: rgb(255 245 246 / 88%);
}

.result strong {
  display: block;
  font-size: 24px;
}

.result span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.settlement {
  min-width: 190px;
  border-radius: 22px;
  background: var(--surface);
  padding: 18px;
}

.settlement span {
  margin: 0 0 6px;
  font-size: 13px;
}

.history {
  margin-top: 20px;
  border-radius: 30px;
  padding: 24px;
}

.history h2 {
  font-size: 30px;
}

.history ol {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.history li,
.empty-history {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  padding: 16px;
}

.history li {
  display: grid;
  grid-template-columns: 52px minmax(110px, 0.5fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.history li span,
.history li small,
.empty-history {
  color: var(--muted);
}

.history li strong {
  font-size: 17px;
}

.history li small {
  font-size: 14px;
}

.error {
  margin-top: 16px;
  border-radius: 18px;
  background: #fff5f6;
  padding: 14px 16px;
  color: var(--red);
  font-weight: 750;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media (max-width: 860px) {
  #app {
    width: min(100vw - 20px, 680px);
    padding: 20px 0;
  }

  .hero,
  .play,
  .result {
    border-radius: 24px;
  }

  .hero,
  .result {
    align-items: stretch;
    flex-direction: column;
  }

  .meta,
  .play {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .play {
    padding: 14px;
  }

  .prompt {
    min-height: 320px;
    padding: 24px;
  }

  .prompt > strong {
    font-size: 38px;
  }

  .signals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .history li {
    grid-template-columns: 1fr;
  }
}

/* Mobile compact status strip */
@media (max-width: 560px) {
  .hero {
    min-height: 0;
    gap: 14px;
    padding: 20px;
  }

  .meta {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .meta span {
    min-height: 34px;
    display: flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
