:root {
  --bg: #f5efe6;
  --bg-accent: #efe3d4;
  --paper: rgba(255, 252, 247, 0.92);
  --card: rgba(253, 243, 230, 0.98);
  --line: rgba(94, 68, 44, 0.14);
  --line-strong: rgba(94, 68, 44, 0.26);
  --text: #2d221a;
  --muted: #574539;
  --accent: #aa6b4b;
  --accent-light: #d38c66;
  --accent-strong: #8f5333;
  --accent-soft: #f0d6c5;
  --btn-from: #bb7a58;
  --btn-to: #9f5f3f;
  --success: #547364;
  --shadow: 0 24px 60px rgba(71, 42, 27, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  color: var(--text);
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 30%),
    radial-gradient(circle at top right, rgba(240, 214, 197, 0.75), transparent 28%),
    linear-gradient(180deg, #f9f4ed 0%, #efe4d7 100%);
}


.page-shell {
  width: 100%;
  padding: 16px 16px max(28px, calc(16px + env(safe-area-inset-bottom)));
}

.app {
  min-height: calc(100dvh - 44px);
  display: flex;
  align-items: stretch;
}

.screen {
  width: 100%;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: screen-enter 280ms ease-out;
}

.screen--centered {
  justify-content: center;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.screen h1,
.screen h2 {
  margin: 0;
  font-family: "Lora", Georgia, serif;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.screen h1 {
  font-size: clamp(2rem, 6vw, 2.7rem);
}

.screen h2 {
  font-size: clamp(1.55rem, 5vw, 2rem);
}

.screen p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.lead {
  font-size: 1rem;
  color: var(--text);
}

.frame-note,
.helper-note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 250, 245, 0.92);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.prize-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(170, 107, 75, 0.08), rgba(240, 214, 197, 0.35));
  border: 1px solid rgba(170, 107, 75, 0.18);
  color: var(--accent-strong);
  font-size: 0.94rem;
  font-weight: 600;
}

.categories-label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.category-card {
  width: 100%;
  text-align: left;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.96), rgba(248, 240, 230, 0.94));
  color: inherit;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: start;
  touch-action: manipulation;
  user-select: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.category-card--enabled {
  cursor: pointer;
}


.category-card--enabled:focus-visible {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(71, 42, 27, 0.08);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.category-card--enabled:active {
  transform: translateY(0) scale(0.99);
  box-shadow: none;
}

.category-card--disabled {
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(170, 107, 75, 0.12);
  transition: transform 180ms ease;
}


.category-copy {
  display: grid;
  gap: 5px;
}

.category-title {
  font-weight: 700;
  color: var(--text);
}

.category-subtitle {
  font-size: 0.94rem;
  color: var(--muted);
  line-height: 1.45;
}

.badge {
  align-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.progress-row {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  align-items: center;
}

.progress-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(170, 107, 75, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  transition: width 220ms ease;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-button,
.primary-button,
.secondary-button,
.ghost-button {
  appearance: none;
  border: none;
  font: inherit;
  border-radius: 18px;
  min-height: 58px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.option-button {
  text-align: left;
  padding: 16px 18px;
  background: rgba(255, 251, 246, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.45;
}


.option-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px rgba(71, 42, 27, 0.08);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.option-button:active {
  transform: translateY(0) scale(0.99);
  box-shadow: none;
}

.button-row {
  display: grid;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  padding: 15px 18px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(180deg, var(--btn-from), var(--btn-to));
  color: #fffaf6;
  box-shadow: 0 12px 28px rgba(159, 95, 63, 0.28);
  text-decoration: none;
  text-align: center;
  display: block;
}

.prize-lead {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}


.primary-button:focus-visible {
  transform: translateY(-1px);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.primary-button:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 6px 14px rgba(159, 95, 63, 0.2);
}


.secondary-button:focus-visible {
  transform: translateY(-1px);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.secondary-button:active {
  transform: translateY(0) scale(0.99);
}


.ghost-button:focus-visible {
  transform: translateY(-1px);
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.ghost-button:active {
  transform: translateY(0) scale(0.99);
}

.secondary-button {
  background: rgba(255, 251, 246, 0.92);
  color: var(--accent-strong);
  border: 1px solid rgba(170, 107, 75, 0.18);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(94, 68, 44, 0.22);
}

.insight-card,
.pattern-card,
.prize-card,
.dice-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--card);
}

.pattern-card p + p {
  margin-top: 14px;
}

.insight-title,
.pattern-title,
.prize-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
}

.pattern-title {
  font-family: "Lora", Georgia, serif;
  font-size: 1.55rem;
}

.pattern-disclaimer {
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(255, 250, 245, 0.86);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.dice-layout {
  display: grid;
  gap: 18px;
}

.prizes-list {
  display: grid;
  gap: 8px;
}

.prize-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 246, 0.94);
  border: 1px solid var(--line);
}

.prize-face {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf6, #efdfd0);
  border: 1px solid rgba(170, 107, 75, 0.2);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.prize-list-copy {
  display: grid;
  gap: 2px;
}

.prize-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.prize-list-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.prize-list-item--won {
  background: linear-gradient(135deg, rgba(170, 107, 75, 0.08), rgba(240, 214, 197, 0.35));
  border-color: rgba(170, 107, 75, 0.32);
  border-left: 3px solid var(--accent);
}

.prize-list-item--won .prize-face {
  background: linear-gradient(180deg, #d38c66, #aa6b4b);
  border-color: transparent;
  color: #fffaf6;
}

.prize-list-item--won .prize-list-title {
  color: var(--accent-strong);
}

.prize-list-badge {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  white-space: nowrap;
}

.all-prizes-section {
  display: grid;
  gap: 10px;
}

.all-prizes-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dice-wrap {
  display: grid;
  place-items: center;
  padding: 14px 0 4px;
}

.dice {
  width: 98px;
  aspect-ratio: 1;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.65) 30%, transparent 31%),
    linear-gradient(180deg, #fffaf6, #efdfd0);
  border: 1px solid rgba(170, 107, 75, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 18px 35px rgba(71, 42, 27, 0.14);
  display: grid;
  place-items: center;
  position: relative;
}

.dice-face {
  width: 54px;
  height: 54px;
  position: relative;
}

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
}

.pip--top-left {
  top: 0;
  left: 0;
}

.pip--top-center {
  top: 0;
  left: 22px;
}

.pip--top-right {
  top: 0;
  right: 0;
}

.pip--middle-left {
  top: 22px;
  left: 0;
}

.pip--middle-center {
  top: 22px;
  left: 22px;
}

.pip--middle-right {
  top: 22px;
  right: 0;
}

.pip--bottom-left {
  bottom: 0;
  left: 0;
}

.pip--bottom-center {
  bottom: 0;
  left: 22px;
}

.pip--bottom-right {
  bottom: 0;
  right: 0;
}

.dice--rolling {
  animation: dice-roll 1.6s ease-out forwards;
}

.dice--hero {
  width: 140px;
  border-radius: 34px;
}

.dice-roll-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.dice-roll-hint {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  text-align: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(84, 115, 100, 0.1);
  color: var(--success);
  font-size: 0.86rem;
  font-weight: 700;
}

.dice-one-shot {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
}

.footnote {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.7;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dice-roll {
  0% {
    transform: rotate(0deg) scale(0.85) translateY(0px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 6px 12px rgba(71, 42, 27, 0.1);
  }

  12% {
    transform: rotate(110deg) scale(1.12) translateY(-18px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 28px 48px rgba(71, 42, 27, 0.22);
  }

  28% {
    transform: rotate(280deg) scale(1.08) translateY(-26px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 36px 56px rgba(71, 42, 27, 0.24);
  }

  48% {
    transform: rotate(490deg) scale(1.04) translateY(-14px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 22px 38px rgba(71, 42, 27, 0.18);
  }

  65% {
    transform: rotate(650deg) scale(0.98) translateY(-4px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 10px 20px rgba(71, 42, 27, 0.13);
  }

  78% {
    transform: rotate(730deg) scale(1.02) translateY(0px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 18px 35px rgba(71, 42, 27, 0.14);
  }

  88% {
    transform: rotate(712deg) scale(0.99) translateY(0px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 14px 28px rgba(71, 42, 27, 0.12);
  }

  94% {
    transform: rotate(722deg) scale(1.005) translateY(0px);
  }

  100% {
    transform: rotate(720deg) scale(1) translateY(0px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 18px 35px rgba(71, 42, 27, 0.14);
  }
}

@media (hover: hover) {
  .category-card--enabled:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: 0 12px 24px rgba(71, 42, 27, 0.08);
  }

  .category-card--enabled:hover .category-icon {
    transform: scale(1.1);
  }

  .option-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 10px 22px rgba(71, 42, 27, 0.08);
  }

  .primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(159, 95, 63, 0.38);
    background: linear-gradient(180deg, #c98462, var(--btn-from));
  }

  .secondary-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 248, 238, 0.98);
  }

  .ghost-button:hover {
    transform: translateY(-1px);
    border-color: rgba(94, 68, 44, 0.35);
    background: rgba(255, 251, 246, 0.5);
  }
}

