:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f8f8f9;
  --surface-2: #f0f1f2;
  --ink: #151517;
  --muted: rgba(21, 21, 23, 0.5);
  --muted-strong: rgba(21, 21, 23, 0.68);
  --line: rgba(21, 21, 23, 0.11);
  --line-strong: rgba(21, 21, 23, 0.22);
  --accent: #5e6673;
  --accent-hover: #464d57;
  --accent-soft: #f0f2f5;
  --accent-ink: #ffffff;
  --danger: #b54735;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.08);
  --soft-shadow: none;
  --radius: 8px;
  --pill: 999px;
  --ease: cubic-bezier(0.2, 0.85, 0.2, 1);
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --font-ui: "Montserrat", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-letter: "Montserrat", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font-ui);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1011;
  --surface: #151516;
  --surface-soft: #1d1d1f;
  --surface-2: #27282b;
  --ink: #f6f7f7;
  --muted: rgba(246, 247, 247, 0.6);
  --muted-strong: rgba(246, 247, 247, 0.78);
  --line: rgba(246, 247, 247, 0.1);
  --line-strong: rgba(246, 247, 247, 0.22);
  --accent: #a6adba;
  --accent-hover: #c0c5ce;
  --accent-soft: #24272d;
  --accent-ink: #111113;
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.26);
  --soft-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.app-shell {
  min-height: 100svh;
  padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: var(--bg);
  transition: background 260ms var(--ease), color 260ms var(--ease);
}

.topbar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  width: min(100%, 1180px);
  min-height: 58px;
  margin: 0 auto 18px;
  padding: 6px 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
}

.score-block {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-label,
.eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.score-block h1 {
  max-width: min(58vw, 520px);
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(2.25rem, 8vw, 4.35rem);
  line-height: 0.94;
  font-weight: 800;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.score-block span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

h2 {
  color: var(--ink);
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

h3 {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.18;
  font-weight: 750;
  letter-spacing: 0;
}

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

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-strong);
  display: grid;
  place-items: center;
  box-shadow: none;
  transition: transform 160ms var(--spring), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}

.icon-button svg,
.tab-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(1px) scale(0.96);
}

.app-grid {
  max-width: 1180px;
  width: min(100%, 1180px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
  grid-template-areas:
    "stage shop"
    "collection laboratory"
    "history laboratory";
  gap: 16px;
  align-items: start;
}

.play-stage,
.side-panel {
  min-width: 0;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  box-shadow: var(--soft-shadow);
}

.play-stage {
  position: relative;
  grid-area: stage;
  min-height: 610px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

.side-panel {
  padding: 22px 8px;
}

.shop-panel {
  grid-area: shop;
}

.collection-panel {
  grid-area: collection;
}

.laboratory-panel {
  grid-area: laboratory;
}

.history-panel {
  grid-area: history;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading .eyebrow {
  margin: 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-strip div {
  min-width: 0;
  min-height: 62px;
  display: grid;
  align-content: center;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 14px;
}

.metric-strip div:last-child {
  border-right: 0;
}

.metric-strip span,
.history-list small,
.upgrade-item p,
.auto-row small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.metric-strip span {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.metric-strip strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.slot-zone {
  position: relative;
  flex: 1;
  min-height: 260px;
  margin: 30px 0 14px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.slot-rail {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  gap: clamp(8px, 1.5vw, 16px);
  transform: translateZ(0);
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(var(--slot-count, 9), minmax(0, 1fr));
  gap: clamp(5px, 1vw, 12px);
  align-items: center;
}

.slot-tile {
  aspect-ratio: 0.44;
  min-width: 0;
  display: grid;
  place-items: center;
  container-type: inline-size;
  border: 0;
  border-bottom: 2px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: translateY(0) rotateX(0);
  transition: transform 260ms var(--spring), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
  user-select: none;
  will-change: transform, opacity;
}

.slot-tile span {
  display: block;
  font-family: var(--font-letter);
  font-size: clamp(2.18rem, 100cqw, 5.8rem);
  font-weight: 850;
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
}

.slot-tile.is-wildcard {
  color: var(--accent);
  background: transparent;
  border-color: var(--accent);
}

.slot-tile.is-blurring {
  animation: tile-spin 165ms steps(2, end) both;
  opacity: 0.9;
}

.slot-tile.is-hit {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.slot-tile.is-new {
  animation: tile-win 620ms var(--spring) both;
}

.result-line {
  min-height: 104px;
  display: grid;
  place-items: center;
  text-align: center;
}

.muted,
.empty-state {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.38;
}

.points-pulse {
  color: var(--accent);
  font-size: 2.35rem;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  animation: points-crack 560ms var(--spring);
}

.word-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 6px;
  max-width: min(100%, 640px);
  margin: 8px auto 0;
}

.word-chip {
  border: 0;
  border-radius: var(--pill);
  padding: 6px 10px;
  color: var(--muted-strong);
  background: var(--surface-soft);
  font-size: 0.86rem;
  line-height: 1;
  font-weight: 700;
}

.word-chip-row.is-dense {
  gap: 5px;
}

.word-chip-row.is-dense .word-chip {
  padding: 5px 8px;
  font-size: 0.76rem;
}

.word-chip-row.is-ultra-dense {
  gap: 4px;
}

.word-chip-row.is-ultra-dense .word-chip {
  padding: 3px 5px;
  font-size: 0.56rem;
}

.word-chip.is-new {
  color: var(--ink);
  background: var(--accent-soft);
}

.spin-button {
  width: min(100%, 380px);
  min-height: 66px;
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transition: transform 160ms var(--spring), opacity 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.spin-button:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: none;
}

.spin-button:active,
.is-spinning .spin-button {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  transform: translateY(2px) scale(0.985);
  box-shadow: none;
}

.spin-button:disabled {
  opacity: 0.82;
}

.has-super-spin .play-stage {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 34%, transparent) 0%, var(--surface) 22%);
}

.has-super-spin .spin-button {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.spin-button__label {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.spin-mode-line {
  width: min(100%, 380px);
  min-height: 28px;
  margin: 7px auto 0;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 750;
  text-align: center;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

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

.super-spin-area {
  width: min(100%, 520px);
  margin: 10px auto 0;
  display: grid;
  gap: 10px;
}

.super-spin-toggle {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
  transition: transform 150ms var(--spring), background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.super-spin-toggle:hover,
.super-spin-toggle.is-active {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.super-spin-toggle:active {
  transform: scale(0.97);
}

.super-spin-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.super-spin-options[hidden] {
  display: none;
}

.super-card {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.super-card:hover,
.super-card.is-active {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.super-card:disabled {
  color: var(--muted);
}

.super-card strong,
.super-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.super-card strong {
  font-size: 0.72rem;
  line-height: 1.15;
  font-weight: 850;
  text-transform: uppercase;
}

.super-card span {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.25;
  font-weight: 650;
}

.tabbar {
  display: none;
}

.upgrade-list,
.history-list,
.collection-list,
.laboratory-list {
  display: grid;
  gap: 0;
}

.upgrade-item,
.lab-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 0;
  background: transparent;
  transition: transform 180ms var(--spring), box-shadow 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.upgrade-item.can-buy {
  border-color: var(--line-strong);
  background: transparent;
}

.upgrade-item.is-purchased {
  animation: upgrade-buy 520ms var(--spring);
}

.upgrade-item.is-denied {
  animation: miss-shake 360ms var(--spring);
}

.super-spin-options.is-denied {
  animation: miss-shake 360ms var(--spring);
}

.lab-item.is-locked {
  opacity: 0.72;
}

.upgrade-topline,
.upgrade-meta,
.auto-row,
.switch-row,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.text-row-button {
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 650;
}

.text-row-button:hover {
  color: var(--accent-hover);
}

.upgrade-topline > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.upgrade-progress {
  height: 3px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: var(--pill);
  background: var(--surface-2);
}

.upgrade-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 300ms var(--spring);
}

.upgrade-meta span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.upgrade-meta button,
.primary-small,
.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  box-shadow: none;
  transition: transform 150ms var(--spring), opacity 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}

.upgrade-meta button:hover,
.primary-small:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.upgrade-meta button:disabled {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.upgrade-meta button:active,
.primary-small:active,
.ghost-button:active {
  transform: scale(0.94);
}

.auto-row,
.switch-row {
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
}

input[type="checkbox"] {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background 180ms var(--ease), box-shadow 180ms var(--ease);
}

input[type="checkbox"]::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
  transition: transform 180ms var(--spring);
}

input[type="checkbox"]:checked {
  background: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.collection-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.collection-tools input,
.collection-tools select {
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}

.collection-tools input:focus,
.collection-tools select:focus {
  border-color: var(--ink);
}

.fixed-letter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.fixed-letter-grid label {
  display: grid;
  gap: 6px;
}

.fixed-letter-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.fixed-letter-grid select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 0 8px;
  font-weight: 750;
}

.lab-locked-copy {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 600;
}

.weight-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.weight-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 34px 1fr 34px 34px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.weight-row strong {
  font-size: 0.82rem;
  font-weight: 850;
}

.weight-row span {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.weight-row button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
}

.weight-row button:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.weight-row button:disabled {
  color: var(--muted);
}

.collection-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.collection-stats div {
  min-width: 0;
  padding: 10px 8px;
  border-right: 1px solid var(--line);
}

.collection-stats div:last-child {
  border-right: 0;
}

.collection-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.collection-stats span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.15;
  font-weight: 700;
  text-transform: uppercase;
}

.collection-folders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.folder-button {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 150ms var(--spring);
}

.folder-button:hover,
.folder-button.is-active {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.folder-button:active {
  transform: scale(0.97);
}

.folder-button span,
.folder-button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-button span {
  font-size: 0.78rem;
  font-weight: 780;
}

.folder-button small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.collection-list {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.collection-word {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0 11px;
  background: transparent;
}

.collection-word strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.collection-word small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.history-list li:last-child {
  border-bottom: 0;
}

.history-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 760;
  letter-spacing: 0;
}

.history-list strong {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.history-list small {
  grid-column: 1 / -1;
}

.history-word-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow: visible;
  white-space: normal;
}

.history-word-row em {
  border-radius: var(--pill);
  padding: 4px 8px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.74rem;
  line-height: 1;
  font-style: normal;
  font-weight: 700;
}

.settings-dialog,
.how-to-dialog {
  width: min(420px, calc(100vw - 34px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop,
.how-to-dialog::backdrop {
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.settings-dialog form,
.how-to-dialog form {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.how-to-heading {
  display: grid;
  gap: 7px;
  margin-bottom: 4px;
}

.how-to-list {
  display: grid;
  gap: 0;
  margin: 2px 0 4px;
  padding: 0;
  list-style: none;
}

.how-to-list li {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.how-to-list strong {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 750;
}

.how-to-list span {
  color: var(--muted-strong);
  font-size: 0.86rem;
  line-height: 1.42;
  font-weight: 500;
}

.score-table {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.score-table span {
  min-width: 0;
  display: grid;
  gap: 5px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 4px;
  background: var(--surface-soft);
}

.score-table b,
.score-table small {
  display: block;
  line-height: 1;
}

.score-table b {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.score-table small {
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.quiet-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 600;
}

.quiet-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.quiet-check input[type="checkbox"]::after {
  width: 10px;
  height: 6px;
  top: 6px;
  left: 6px;
  border: 0;
  border-left: 2px solid var(--bg);
  border-bottom: 2px solid var(--bg);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transform: rotate(-45deg);
}

.quiet-check input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: rotate(-45deg);
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.ghost-button:hover {
  background: var(--surface-2);
}

.juice-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.spark {
  position: absolute;
  left: 50%;
  top: 54%;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 22px rgba(0, 0, 0, 0.12);
  opacity: 0;
  animation: spark-burst 760ms var(--spring) var(--delay) forwards;
}

.score-bump {
  animation: score-bump 520ms var(--spring);
}

.rail-lock .slot-tile.is-hit {
  animation: tile-lock 520ms var(--spring) both;
}

.rail-empty {
  animation: miss-shake 360ms var(--spring);
}

.result-crack {
  animation: result-crack 520ms var(--spring);
}

.result-soft {
  animation: result-soft 380ms var(--ease);
}

.view-shift .app-grid {
  animation: view-shift 340ms var(--spring);
}

.theme-switching {
  animation: theme-switch 420ms var(--ease);
}

.just-won .play-stage {
  border-color: transparent;
}

.just-missed .slot-zone {
  animation: miss-shake 360ms var(--spring);
}

@keyframes tile-spin {
  0% {
    transform: translateY(-14%) rotateX(24deg) scale(0.98);
    opacity: 0.68;
  }
  55% {
    transform: translateY(10%) rotateX(-18deg) scale(1.02);
    opacity: 0.96;
  }
  100% {
    transform: translateY(0) rotateX(0) scale(1);
    opacity: 0.9;
  }
}

@keyframes tile-win {
  0% {
    transform: translateY(10px) scale(0.92);
  }
  58% {
    transform: translateY(-6px) scale(1.05);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes tile-lock {
  0% {
    transform: translateY(-4px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes points-crack {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.82);
  }
  42% {
    opacity: 1;
    transform: translateY(-4px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes score-bump {
  0% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-2px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes spark-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
  }
}

@keyframes miss-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  28% {
    transform: translateX(-5px);
  }
  56% {
    transform: translateX(4px);
  }
  78% {
    transform: translateX(-2px);
  }
}

@keyframes upgrade-buy {
  0% {
    transform: scale(0.98);
  }
  48% {
    transform: scale(1.025);
    border-color: var(--accent);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes result-crack {
  0% {
    transform: translateY(8px) scale(0.96);
    opacity: 0.78;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes result-soft {
  0% {
    opacity: 0.5;
    transform: translateY(3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-shift {
  0% {
    opacity: 0.86;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes theme-switch {
  0% {
    filter: saturate(0.82) brightness(0.96);
  }
  100% {
    filter: saturate(1) brightness(1);
  }
}

@media (max-width: 920px) {
  .app-shell {
    padding: max(8px, env(safe-area-inset-top)) 12px calc(78px + env(safe-area-inset-bottom));
  }

  .topbar,
  .app-grid {
    max-width: 560px;
    width: min(100%, 560px);
  }

  .topbar {
    min-height: 52px;
    margin-bottom: 6px;
    padding: 4px 0 8px;
  }

  .app-grid {
    display: block;
  }

  .app-shell[data-view="play"] .side-panel,
  .app-shell[data-view="shop"] .play-stage,
  .app-shell[data-view="shop"] .collection-panel,
  .app-shell[data-view="shop"] .laboratory-panel,
  .app-shell[data-view="shop"] .history-panel,
  .app-shell[data-view="collection"] .play-stage,
  .app-shell[data-view="collection"] .shop-panel,
  .app-shell[data-view="collection"] .laboratory-panel,
  .app-shell[data-view="collection"] .history-panel,
  .app-shell[data-view="laboratory"] .play-stage,
  .app-shell[data-view="laboratory"] .shop-panel,
  .app-shell[data-view="laboratory"] .collection-panel,
  .app-shell[data-view="laboratory"] .history-panel,
  .app-shell[data-view="history"] .play-stage,
  .app-shell[data-view="history"] .shop-panel,
  .app-shell[data-view="history"] .collection-panel,
  .app-shell[data-view="history"] .laboratory-panel {
    display: none;
  }

  .play-stage,
  .side-panel {
    min-height: calc(100svh - 150px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .play-stage {
    min-height: calc(100svh - 188px);
    padding: 6px 0 0;
  }

  .side-panel {
    padding: 10px 0 0;
  }

  .tabbar {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 35;
    width: min(560px, calc(100vw - 18px));
    max-width: 560px;
    min-height: 60px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    padding: 2px 0 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: none;
    backdrop-filter: saturate(180%) blur(18px);
  }

  .tab-button {
    min-width: 0;
    min-height: 54px;
    display: grid;
    place-items: center;
    gap: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 650;
    line-height: 1;
    transition: background 180ms var(--ease), color 180ms var(--ease), transform 160ms var(--spring);
  }

  .tab-button svg {
    width: 20px;
    height: 20px;
  }

  .tab-button.is-active {
    background: transparent;
    color: var(--ink);
  }

  .tab-button:active {
    transform: scale(0.96);
  }
}

@media (max-width: 640px) {
  .score-block h1 {
    max-width: 62vw;
    font-size: clamp(1.98rem, 9.6vw, 2.85rem);
  }

  .brand-label,
  .score-block span,
  .eyebrow {
    font-size: 0.73rem;
  }

  h2 {
    font-size: 1.62rem;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .metric-strip {
    gap: 0;
  }

  .metric-strip div {
    min-height: 52px;
    padding: 7px 9px;
  }

  .metric-strip span {
    font-size: 0.7rem;
  }

  .metric-strip strong {
    font-size: 1.02rem;
  }

  .slot-zone {
    min-height: 224px;
    margin: 14px 0 6px;
  }

  .slot-rail {
    gap: 4px;
  }

  .slot-row {
    gap: 4px;
  }

  .slot-tile {
    border-radius: 0;
  }

  .slot-tile span {
    font-size: clamp(2.22rem, 98cqw, 3.65rem);
  }

  .result-line {
    min-height: 86px;
  }

  .spin-button {
    width: 100%;
    min-height: 58px;
    margin-bottom: 8px;
  }

  .super-spin-area {
    width: 100%;
  }

  .super-spin-options {
    gap: 6px;
  }

  .super-card {
    min-height: 70px;
    padding: 8px;
  }

  .super-card strong {
    font-size: 0.62rem;
  }

  .super-card span {
    font-size: 0.58rem;
  }

  .spin-button__label {
    font-size: 1.02rem;
  }

  .spin-mode-line {
    width: 100%;
    font-size: 0.68rem;
  }

  .collection-tools {
    grid-template-columns: 1fr;
  }

  .collection-folders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collection-list {
    max-height: calc(100svh - 390px);
  }

  .settings-dialog {
    width: calc(100vw - 20px);
    margin-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .how-to-dialog {
    width: calc(100vw - 22px);
    max-height: calc(100svh - 28px);
  }

  .settings-dialog form,
  .how-to-dialog form {
    padding: 20px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .top-actions {
    gap: 6px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .metric-strip span {
    font-size: 0.66rem;
  }

  .metric-strip strong {
    font-size: 0.96rem;
  }

  .slot-rail {
    gap: 3px;
  }

  .tab-button {
    font-size: 0.67rem;
  }
}

@media (max-width: 640px) and (max-height: 720px) {
  .app-shell {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 46px;
    margin-bottom: 4px;
    padding-bottom: 6px;
  }

  .brand-label,
  .score-block span,
  .eyebrow {
    font-size: 0.66rem;
  }

  .score-block h1 {
    font-size: clamp(1.72rem, 8.4vw, 2.32rem);
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .icon-button svg,
  .tab-button svg {
    width: 19px;
    height: 19px;
  }

  .metric-strip div {
    min-height: 46px;
    padding: 6px 8px;
  }

  .metric-strip span {
    font-size: 0.64rem;
  }

  .metric-strip strong {
    margin-top: 3px;
    font-size: 0.94rem;
  }

  .slot-zone {
    min-height: 188px;
    margin: 10px 0 4px;
  }

  .slot-tile span {
    font-size: clamp(2rem, 92cqw, 3.2rem);
  }

  .result-line {
    min-height: 74px;
  }

  .muted,
  .empty-state {
    font-size: 0.88rem;
  }

  .points-pulse {
    font-size: 1.9rem;
  }

  .word-chip-row {
    gap: 4px;
    margin-top: 6px;
  }

  .word-chip {
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .score-table {
    gap: 4px;
  }

  .score-table span {
    padding: 6px 3px;
  }

  .score-table b {
    font-size: 0.78rem;
  }

  .score-table small {
    font-size: 0.62rem;
  }

  .collection-stats div {
    padding: 8px 6px;
  }

  .folder-button {
    min-height: 40px;
    padding: 0 8px;
  }

  .folder-button span {
    font-size: 0.72rem;
  }

  .folder-button small {
    font-size: 0.62rem;
  }

  .spin-button {
    min-height: 52px;
    margin-top: 4px;
    margin-bottom: 4px;
  }

  .tabbar {
    bottom: max(6px, env(safe-area-inset-bottom));
    min-height: 56px;
  }

  .tab-button {
    min-height: 50px;
    gap: 3px;
    font-size: 0.64rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
