/* Risk-y Dice website. Palette sampled from the app's own colour assets (RisikoTheme). */
:root {
  --bg: #051514;
  --bg-2: #0b1d1c;
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --faint: rgba(255, 255, 255, 0.45);
  --green: #63781c;
  --gold: #ffd201;
  --attacker: #c70f13;
  --defender: #0913ff;
  --display: "Norwester", "Arial Narrow", Impact, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 72rem;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html {
  font-size: clamp(16px, calc(16px + (100vw - 1440px) * 0.006), 24px);
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--gold); color: #000; padding: .5rem .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.eyebrow {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
.display {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: .94;
}
.display em { font-style: normal; color: var(--gold); }
.lede { color: var(--muted); font-size: 1.125rem; max-width: 34rem; margin: 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar .wrap { display: flex; align-items: center; gap: 1.5rem; height: 4rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 800; }
.brand img { width: 2rem; height: 2rem; border-radius: .5rem; }
.nav { display: flex; gap: 1.4rem; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .93rem; }
.nav a:hover { color: var(--text); }
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.5rem; padding: 0 1.1rem;
  border-radius: 999px; border: 0;
  background: var(--gold); color: #141400;
  font: 800 .93rem/1 var(--body);
  text-decoration: none; cursor: pointer;
}
@media (max-width: 760px) { .nav { display: none; } .topbar .pill { margin-left: auto; } }

/* Hero */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 7vw, 6rem); }
.hero .wrap { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.hero h1 { font-size: clamp(3.4rem, 9.5vw, 7.6rem); margin: 1rem 0 1.5rem; }
.hero h1 .line { display: block; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem; }
.badge { display: inline-block; }
.badge img { height: 3.25rem; width: auto; }
.textlink { color: var(--text); font-weight: 700; text-underline-offset: .3em; text-decoration-color: var(--gold); }
.reassure { margin: 1.1rem 0 0; color: var(--faint); font-size: .9rem; }
.phone { width: 100%; height: auto; aspect-ratio: 1 / 2; }
.hero .phone { width: min(100%, 20rem); justify-self: center; }
@media (prefers-reduced-motion: no-preference) {
  .hero h1 .line { animation: rise .7s var(--ease) both; }
  .hero h1 .line + .line { animation-delay: .12s; }
  .hero .phone { animation: lift .9s var(--ease) .15s both; }
}
@keyframes rise { from { transform: translateY(.35em); clip-path: inset(0 0 100% 0); } to { transform: none; clip-path: inset(0 0 -10% 0); } }
@keyframes lift { from { transform: translateY(2.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero .phone { width: min(72%, 17rem); }
}

/* Sections */
.section { padding: clamp(4rem, 10vw, 8rem) 0; }
.head { max-width: 40rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.head h2 { font-size: clamp(2.6rem, 6vw, 4.6rem); margin: .8rem 0 1rem; }
.head p:not(.eyebrow) { color: var(--muted); margin: 0; font-size: 1.07rem; }

/* How it works: three real screens, side by side */
.screens { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 4vw, 4rem); }
.screens li { display: grid; gap: 1.4rem; align-content: start; }
.screens .phone { width: min(100%, 17rem); margin-inline: auto; }
.screens .num { font-family: var(--display); color: var(--gold); font-size: 1.2rem; }
.screens h3 { font-family: var(--display); text-transform: uppercase; font-size: clamp(1.7rem, 2.6vw, 2.2rem); line-height: 1; margin: .3rem 0 .6rem; }
.screens p { margin: 0; color: var(--muted); }
@media (max-width: 860px) {
  .screens {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(78%, 18rem);
    overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 1rem;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
  }
  .screens li { scroll-snap-align: start; }
}

/* Dice */
.die {
  --size: 2.6rem;
  --face: var(--attacker);
  width: var(--size); height: var(--size);
  border-radius: calc(var(--size) * .2);
  background: var(--face);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: calc(var(--size) * .14);
  flex: none;
}
.die.def { --face: var(--defender); }
.die i { width: calc(var(--size) * .17); height: calc(var(--size) * .17); border-radius: 50%; background: #fff; place-self: center; visibility: hidden; }
.die[data-v="1"] i:nth-child(5),
.die[data-v="2"] i:is(:nth-child(3), :nth-child(7)),
.die[data-v="3"] i:is(:nth-child(3), :nth-child(5), :nth-child(7)),
.die[data-v="4"] i:is(:nth-child(1), :nth-child(3), :nth-child(7), :nth-child(9)),
.die[data-v="5"] i:is(:nth-child(1), :nth-child(3), :nth-child(5), :nth-child(7), :nth-child(9)),
.die[data-v="6"] i:is(:nth-child(1), :nth-child(3), :nth-child(4), :nth-child(6), :nth-child(7), :nth-child(9)) { visibility: visible; }
.die.lost { opacity: .35; }
@media (prefers-reduced-motion: no-preference) {
  .die.rolling { animation: shake .32s var(--ease) both; }
}
@keyframes shake {
  0% { transform: rotate(-24deg) scale(.82); }
  55% { transform: rotate(10deg) scale(1.06); }
  100% { transform: none; }
}

/* Try it: the demo, drawn as type on the page rather than as an app panel */
.try { border-top: 1px solid var(--line); }
.board { position: relative; }
.armies { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: clamp(1rem, 4vw, 3rem); }
.army h3 { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1rem; }
.army h3::before { content: ""; width: .75rem; height: .75rem; border-radius: 3px; background: var(--attacker); }
.army.def h3::before { background: var(--defender); }
.army.def { text-align: right; }
.army.def h3, .army.def .count-row, .army.def .dice-pick { justify-content: flex-end; }
.count-row { display: flex; align-items: center; gap: .9rem; margin: .4rem 0 .9rem; }
.count-row input {
  width: 2.25ch; min-width: 1.25ch; border: 0; padding: 0; background: none; color: var(--text);
  font: 400 clamp(4.5rem, 12vw, 8rem)/1 var(--display); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.army.def .count-row input { text-align: right; }
.count-row input::-webkit-inner-spin-button, .count-row input::-webkit-outer-spin-button { -webkit-appearance: none; }
.count-row input:focus-visible { outline: none; text-decoration: underline 3px var(--gold); text-underline-offset: .12em; }
.nudge { display: grid; gap: .4rem; }
.nudge button {
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--line); background: none; color: var(--text);
  font: 700 1.2rem/1 var(--body); cursor: pointer;
}
.nudge button:hover { border-color: var(--muted); }
.vs { font-family: var(--display); color: var(--faint); font-size: 1.6rem; align-self: center; }
.dice-pick { display: flex; gap: .45rem; }
.dice-pick button { border: 0; background: none; padding: 0; border-radius: .6rem; cursor: pointer; }
.dice-pick button .die { --size: 2.3rem; opacity: .3; transition: opacity .2s; }
.dice-pick button[aria-pressed="true"] .die { opacity: 1; }
.dice-pick button:disabled { cursor: not-allowed; }
.dice-pick button:disabled .die { opacity: .08; }
.pick-label { margin: 0 0 .5rem; font-size: .85rem; color: var(--faint); }
.hint { margin: .5rem 0 0; font-size: .85rem; color: var(--faint); min-height: 1.3em; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; margin-top: 2rem; }
.btn {
  min-height: 3.1rem; padding: 0 1.6rem; border-radius: 999px; border: 0;
  font: 800 1rem/1 var(--body); cursor: pointer;
  transition: transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-auto { background: var(--gold); color: #141400; }
.btn-roll { background: none; color: var(--text); border: 1px solid var(--line); }
.btn-text { background: none; border: 0; color: var(--muted); font: 700 .95rem/1 var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: .3em; padding: .6rem 0; }

.results { margin-top: clamp(2rem, 5vw, 3rem); }
.results h3 { font-weight: 800; font-size: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.log { list-style: none; margin: 0; padding: 0; max-height: 24rem; overflow-y: auto; overscroll-behavior: contain; }
.log li { display: grid; grid-template-columns: 5rem 1fr 1fr; align-items: center; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.log .r { font-weight: 800; color: var(--faint); font-size: .85rem; }
.log .d { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.log .d .die { --size: 1.6rem; }
.log .n { margin-left: .4rem; font-weight: 700; font-size: .85rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log .n b { color: var(--text); }
.empty { color: var(--faint); margin: 0; padding: 1rem 0; }
.sim-note { margin: 1.5rem 0 0; color: var(--faint); font-size: .85rem; }

/* End of match: the controls lock and the app is offered */
.lock {
  position: absolute; inset: -1rem; z-index: 5;
  display: none; place-items: center; text-align: center;
  padding: 2rem 1rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.board.locked .lock { display: grid; }
.lock h3 { font-size: clamp(2.6rem, 7vw, 4.6rem); margin: .6rem 0 .6rem; }
.lock .summary { margin: 0 0 .4rem; color: var(--muted); font-weight: 700; }
.lock p.pitch { margin: 0 auto 1.5rem; color: var(--muted); max-width: 30rem; }
.lock .lock-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .8rem 1.6rem; }
@media (prefers-reduced-motion: no-preference) { .board.locked .lock > div { animation: lift .45s var(--ease); } }

@media (max-width: 640px) {
  .armies { grid-template-columns: 1fr; }
  .vs { display: none; }
  .army.def { text-align: left; padding-top: 1.5rem; border-top: 1px solid var(--line); }
  .army.def h3, .army.def .count-row, .army.def .dice-pick { justify-content: flex-start; }
  .army.def .count-row input { text-align: left; order: -1; }
  .log li { grid-template-columns: 1fr 1fr; }
  .log .r { grid-column: 1 / -1; }
}

/* Rules */
.rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 clamp(2rem, 6vw, 5rem); counter-reset: rule; }
.rules li { padding: 1.6rem 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; counter-increment: rule; }
.rules li::before { content: counter(rule, decimal-leading-zero); font-family: var(--display); color: var(--gold); font-size: 1.4rem; line-height: 1.2; }
.rules strong { display: block; font-size: 1.1rem; margin-bottom: .3rem; }
.rules span { color: var(--muted); }
@media (max-width: 760px) { .rules { grid-template-columns: 1fr; } }

/* Final call */
.final { text-align: center; padding: clamp(5rem, 12vw, 9rem) 0; }
.final h2 { font-size: clamp(3rem, 8vw, 6.4rem); margin: 1rem auto 2rem; max-width: 14ch; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--muted); font-size: .9rem; }
.footer .wrap { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem 3rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }
.foot-name { margin: 0 0 .6rem; color: var(--text); font-weight: 800; }
.foot-by { margin: 0; }
.footer .fine { grid-column: 1 / -1; color: var(--faint); font-size: .8rem; margin: 0; }
@media (max-width: 640px) { .footer .wrap { grid-template-columns: 1fr; } }

/* Gentle entrance when a section arrives; never hides content without JS */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { transform: translateY(1.6rem); opacity: 0; transition: transform .7s var(--ease), opacity .7s var(--ease); }
  .js .reveal.in { transform: none; opacity: 1; }
  .js .screens.reveal { transform: none; opacity: 1; }
  .js .screens.reveal li { transform: translateY(2rem); opacity: 0; transition: transform .8s var(--ease), opacity .8s var(--ease); }
  .js .screens.reveal.in li { transform: none; opacity: 1; }
  .js .screens.reveal.in li:nth-child(2) { transition-delay: .12s; }
  .js .screens.reveal.in li:nth-child(3) { transition-delay: .24s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
