@font-face { font-family: Gaegu; src: url('../fonts/Gaegu-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Patrick Hand'; src: url('../fonts/PatrickHand-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }

/* tokens: deep pcb green, off-white, copper as the one accent. spacing on an 8px scale. */
:root {
  --base: #0f2a1a; --panel: #163d24; --line: rgba(242, 244, 236, .12);
  --text: #f2f4ec; --muted: #a8bba6; --copper: #e3b85c; --ink: #1d1a16;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px;
  --wrap: 1200px; --gut: clamp(20px, 4vw, 40px);
}
* { box-sizing: border-box; }
html { background: var(--base); color: var(--text); scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; font: 400 19px/1.45 'Patrick Hand', cursive; -webkit-font-smoothing: antialiased; }
/* the whole page sits on a quiet circuit board; it drifts a little slower than the content */
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; top: 0; pointer-events: none; z-index: -1; }
body::before { height: calc(100vh + 640px); background: var(--tile, none) 0 0 / 640px 640px repeat; transform: translate3d(0, var(--py, 0px), 0); opacity: 0; transition: opacity .6s; will-change: transform; }
.tiled body::before { opacity: 1; }
body::after { bottom: 0; background: radial-gradient(1100px 620px at 72% -8%, rgba(40, 104, 62, .45), transparent 62%), radial-gradient(900px 700px at 0% 40%, rgba(6, 22, 12, .45), transparent 70%); }
canvas { display: block; }
img { display: block; }
[hidden] { display: none !important; }
h1, h2, h3, .logo, .btn, .count b { font-family: Gaegu, cursive; font-weight: 700; }
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gut) * 2); margin: 0 auto; padding: 0 var(--gut); }

/* drawn buttons: hand-drawn outline as a background image; on hover only the colour changes */
.ink { background: var(--bg) 0 0 / 100% 100% no-repeat; border: 0; }
.btn { color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; user-select: none;
  background: var(--bg) 0 0 / 100% 100% no-repeat; -webkit-tap-highlight-color: transparent; font-size: 22px; padding: 12px 26px 14px; line-height: 1; }
.btn:hover, .btn:focus-visible { background-image: var(--bgh); }
.btn.small { font-size: 19px; padding: 9px 18px 11px; }
.btn:disabled { cursor: progress; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }
.plate, .card { background: var(--bg) 0 0 / 100% 100% no-repeat; }

/* header */
.bar { position: sticky; top: 0; z-index: 30; background: rgba(15, 42, 26, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 30px; line-height: 1; }
.logo img { width: 28px; height: 28px; }
.links { display: flex; gap: var(--s1); }
.lk { font: 400 17px/1 'Patrick Hand', cursive; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; height: 36px; min-width: 52px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.lk:hover { background: rgba(242, 244, 236, .1); border-color: rgba(242, 244, 236, .28); }
.lk.soon { color: var(--muted); cursor: default; }
.lk.soon:hover { background: transparent; border-color: var(--line); }

/* hero: copy on the left, the chip stage centre-right */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s6); align-items: center; padding-top: var(--s6); padding-bottom: var(--s7); }
.big { font-size: clamp(52px, 5.6vw, 84px); line-height: .95; letter-spacing: -1px; margin: 0; }
.sub { margin: var(--s3) 0 0; font-size: 24px; line-height: 1.3; color: var(--text); max-width: 26ch; }
.lore { margin-top: var(--s4); padding-left: var(--s2); border-left: 2px solid var(--copper); }
.lore p { margin: 0; color: var(--muted); font-size: 19px; line-height: 1.55; }

.stage { display: flex; flex-direction: column; align-items: stretch; }
.plate { position: relative; display: flex; flex-direction: column; align-items: center; padding: var(--s3) var(--s3) var(--s2); filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .35)); }
.plate::before { content: ''; position: absolute; left: 10%; right: 10%; top: 6%; height: 70%; background: radial-gradient(closest-side, rgba(242, 244, 236, .07), transparent); pointer-events: none; }
#mineCv { position: relative; width: min(100%, 420px); aspect-ratio: 1; height: auto; }
.caption { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: center; border-top: 1px solid var(--line); padding-top: var(--s2); margin-top: var(--s1); }
.tag { text-align: center; font-size: 20px; color: var(--text); }
.tag small { display: block; font-size: 16px; color: var(--muted); }
.got { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.gotT { display: flex; flex-direction: column; }
.gotT b { font-family: Gaegu, cursive; font-size: 28px; line-height: 1; color: var(--text); }
.gotT small { font-size: 16px; color: var(--muted); margin-top: 4px; }
.gotB { display: flex; gap: var(--s1); }
.got.pop { animation: rise .35s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.act { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.btn.print { font-size: 30px; padding: 16px 40px 18px; }
.count { margin: 0; color: var(--muted); font-size: 19px; }
.count b { color: var(--text); font-size: 30px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.msg { margin: var(--s1) 0 0; min-height: 1.4em; color: var(--copper); font-size: 17px; }

/* the board */
.board { padding-bottom: var(--s6); scroll-margin-top: 64px; }
.head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: var(--s2); margin-bottom: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s5); }
.head h2 { margin: 0; font-size: 44px; line-height: 1; }
.hint { margin: 0; color: var(--muted); font-size: 18px; }
.road { margin: 0; color: var(--muted); font-size: 17px; }
.road b { color: var(--text); font-weight: 400; }
.boardEl { position: relative; width: 100%; border-radius: 18px; overflow: hidden; background: #2b7a3b; min-height: 240px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 30px 60px -30px rgba(0, 0, 0, .6); }
.boardEl canvas { display: block; }
.more { display: flex; justify-content: center; margin-top: var(--s4); }

.foot { display: flex; justify-content: space-between; align-items: center; padding-top: var(--s4); padding-bottom: var(--s5); border-top: 1px solid var(--line); color: var(--muted); font-size: 17px; }
.logo.small { font-size: 22px; gap: 8px; color: var(--muted); }
.logo.small img { width: 20px; height: 20px; opacity: .8; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(6, 20, 11, .7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: var(--s2); }
.card { width: min(380px, 100%); padding: var(--s3); color: var(--ink); display: flex; flex-direction: column; align-items: center; }
#cardCv { width: 240px; height: 240px; }
.card h3 { margin: var(--s1) 0 0; font-size: 30px; }
.card .facts { margin: 4px 0 var(--s2); font-size: 18px; color: #4c5b47; text-align: center; }
.card .row { display: flex; gap: var(--s1); }
#flyCv { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; display: none; }

.shake { animation: shake .36s linear; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translate(-5px, 3px); } 40% { transform: translate(4px, -3px); } 60% { transform: translate(-3px, -2px); } 80% { transform: translate(2px, 1px); } }
.hero > * { animation: rise .6s ease-out both; } .hero > .stage { animation-delay: .1s; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: var(--s5); padding-top: var(--s5); padding-bottom: var(--s6); }
  .head { grid-template-columns: auto 1fr; }
  .road { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  body { font-size: 18px; }
  .bar-in { height: 56px; }
  .logo { font-size: 26px; }
  .lk { height: 32px; min-width: 40px; padding: 0 12px; font-size: 15px; }
  .big { font-size: 48px; }
  .hero { padding-top: var(--s4); gap: var(--s4); }
  .lore { margin-top: var(--s3); }
  .sub { font-size: 21px; }
  .lore p { font-size: 17px; }
  .plate { padding: var(--s2) var(--s2) var(--s1); }
  .act { flex-direction: column; align-items: stretch; gap: var(--s1); }
  .btn.print { width: 100%; }
  .count { text-align: center; }
  .caption { min-height: 120px; }
  .got { justify-content: center; text-align: center; }
  .gotT { align-items: center; width: 100%; }
  .head { grid-template-columns: 1fr; gap: 4px; padding-top: var(--s4); }
  .head h2 { font-size: 38px; }
  .boardEl { border-radius: 14px; }
  .foot { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { body::before { transform: none; } .hero > *, .got.pop, .shake { animation: none; } html { scroll-behavior: auto; } }
