:root {
  --ink: #12151b;
  --panel: #1b1f27;
  --paper: #ede4d0;
  --paper-ink: #2a2115;
  --amber: #f2a341;
  --teal: #5b9a94;
  --text: #e8e4da;
  --text-dim: #9aa0ab;
  --line: rgba(232, 228, 218, 0.14);
}

* { box-sizing: border-box; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
}

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.mark {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mark-dim { color: var(--text-dim); font-weight: 400; }

.clock {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.lede {
  color: var(--text-dim);
  max-width: 46ch;
  margin: 0 0 2.75rem;
  font-size: 1.05rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}

.hint {
  color: var(--text-dim);
  font-size: 0.92rem;
  max-width: 52ch;
  margin: -0.4rem 0 1.4rem;
}

.frame {
  margin: 0 0 0.9rem;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.5rem;
  border-radius: 3px;
}

.frame img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #0d0f14;
}

.frame-sm img { max-height: 300px; }

.cap {
  font-weight: 500;
  margin: 0 0 0.25rem;
}

.meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0 0 0.3rem;
}

.meta a { color: var(--teal); }
.meta.dim { color: var(--text-dim); }

.rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.75rem 0;
}

.odometer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.digits {
  display: flex;
  gap: 0.4rem;
}

.digit {
  width: 2.5rem;
  height: 3.1rem;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem;
  color: var(--amber);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--amber);
  border-radius: 3px;
  outline-offset: 2px;
}

.digit:focus-visible {
  outline: 2px solid var(--amber);
}

.pull {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--amber);
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 3px;
  cursor: pointer;
}

.pull:hover { filter: brightness(1.08); }
.pull:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.random-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.random-link:hover { border-bottom-color: var(--teal); }

.result {
  margin-top: 2rem;
}

.ticket {
  position: relative;
  background: var(--paper);
  color: var(--paper-ink);
  padding: 1.4rem 1.2rem 1.2rem;
  border-radius: 0 0 4px 4px;
}

.ticket::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  background: radial-gradient(circle at 6px 6px, transparent 6px, var(--ink) 6.5px) repeat-x;
  background-size: 16px 12px;
}

.ticket .frame {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}

.ticket .frame img { background: #fff; }

.ticket .cap { color: var(--paper-ink); }
.ticket .meta { color: rgba(42, 33, 21, 0.65); }

.bar {
  height: 6px;
  background: rgba(42, 33, 21, 0.15);
  border-radius: 2px;
  margin-top: 0.7rem;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
  width: 0%;
  transition: width 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}

.site-foot {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.site-foot p { margin: 0 0 0.3rem; }

@media (max-width: 420px) {
  .digit { width: 2.15rem; height: 2.7rem; font-size: 1.35rem; }
  .wrap { padding-top: 2.5rem; }
}
