:root {
  --canvas: var(--color-canvas);
  --ink: var(--color-ink);
  --lime: var(--color-primary);
  --blue: var(--color-secondary);
  --coral: var(--color-attention);
  --surface: var(--color-surface-raised);
  --line: var(--color-border);
  --muted: var(--color-muted);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: clip;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
canvas:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.home-link {
  position: fixed;
  z-index: 20;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 10px 28px rgba(31, 37, 34, 0.09);
  backdrop-filter: blur(10px);
}

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

.home-link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-shape {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
}

.page-shape--lime {
  right: -70px;
  bottom: 8%;
  width: 230px;
  height: 230px;
  border: 38px solid color-mix(in srgb, var(--lime) 42%, transparent);
  border-radius: 50%;
}

.page-shape--blue {
  top: 8%;
  left: 7%;
  width: 86px;
  height: 86px;
  border: 18px solid color-mix(in srgb, var(--blue) 18%, transparent);
  transform: rotate(18deg);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 74px 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--ink);
}

.brand-mark i {
  border-radius: 2px;
  background: var(--lime);
}

.brand-mark i:nth-child(2) {
  background: var(--coral);
}

.brand-mark i:nth-child(3) {
  background: var(--blue);
}

.brand--compact {
  font-size: 0.78rem;
}

.eyebrow,
.dialog-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.start-screen h1 {
  max-width: 720px;
  margin: 19px 0 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 8vw, 7.4rem);
  font-weight: 500;
  line-height: 0.82;
  letter-spacing: -0.075em;
}

.start-screen h1 em {
  color: var(--blue);
  font-weight: 500;
}

.start-screen .eyebrow {
  margin-top: 42px;
}

.start-lead {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.setup-card {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.setup-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.setup-number {
  width: 52px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 17px;
  color: var(--ink);
  background: var(--lime);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.setup-card__header p,
.setup-card__header span {
  margin: 0;
}

.setup-card__header p {
  font-weight: 850;
}

.setup-card__header div > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.79rem;
}

.quick-rules {
  display: grid;
  gap: 17px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.quick-rules li {
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: start;
  gap: 12px;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.42;
}

.quick-rules b {
  padding-top: 2px;
  color: var(--blue);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 7px 6px 21px;
  border: 0;
  border-radius: 17px;
  color: var(--ink);
  background: var(--lime);
  font-size: 0.79rem;
  font-weight: 900;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  transition: transform 160ms ease, background-color 160ms ease;
}

.primary-button:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
}

.primary-button__arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  font-size: 1.2rem;
}

.primary-button__arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.setup-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.69rem;
  text-align: center;
}

.game-screen {
  width: 100%;
}

.game-header {
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.vault-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.vault-chip small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.vault-chip b {
  color: var(--blue);
  font-family: Georgia, "Times New Roman", serif;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
}

.icon-button:hover {
  color: var(--blue);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

.status-line {
  min-height: 26px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.mobile-stats {
  display: none;
}

.modal-backdrop.show {
  opacity: 0.62;
}

.game-dialog {
  padding: 35px;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  text-align: center;
}

.game-dialog .modal-title {
  margin: 8px 0 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.game-dialog > p:not(.dialog-kicker) {
  margin: 0 auto 22px;
  color: var(--muted);
}

.dialog-symbol {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 21px;
  color: var(--ink);
  background: var(--lime);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.dialog-symbol--pause {
  grid-template-columns: repeat(2, 7px);
  gap: 7px;
}

.dialog-symbol--pause i {
  height: 27px;
  border-radius: 5px;
  background: var(--ink);
}

.text-button {
  min-height: 44px;
  margin-top: 7px;
  padding: 8px 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

.result-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--canvas);
}

.result-score span {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-score strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

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