:root {
  --forest: #2f5d3a;
  --moss: #6b8e4e;
  --ochre: #c9962b;
  --wood: #8a5a33;
  --bark: #3b2a1a;
  --paper: #f6efdc;
  --card: #fffaf0;
  --vest: #f26b1d;
  --vest-dark: #c94f0c;
  --danger: #b3261e;
  --radius: 18px;
  --shadow: 0 4px 0 var(--bark);
  --head: 'Baloo 2', 'Trebuchet MS', sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  background-image: radial-gradient(#c9962b22 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--bark);
  font: 17px/1.5 var(--body);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 520px; margin: 0 auto; padding: 12px 16px 40px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.1; margin: .3em 0; }
h1 { font-size: 2.1rem; color: var(--forest); }
h2 { font-size: 1.6rem; color: var(--forest); }
h3 { font-size: 1.2rem; }
p { margin: .5em 0; }
.art { display: block; width: 100%; height: auto; }
.art.logo { max-width: 260px; margin: 8px auto 0; }
.art.scene { max-width: 300px; margin: 0 auto; }
.art.mirror { max-width: 220px; margin: 0 auto; }
.center { text-align: center; }
.muted { opacity: .72; font-size: .92rem; }

.card {
  background: var(--card);
  border: 3px solid var(--bark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 16px 0;
}
.card.sign { background: #f3dca6; position: relative; padding-top: 24px; }
.card.sign::before, .card.sign::after {
  content: ''; position: absolute; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--bark);
}
.card.sign::before { left: 10px; } .card.sign::after { right: 10px; }
.kicker { font: 700 .8rem/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--moss); }

.btn {
  display: block; width: 100%; padding: 14px 18px; margin: 12px 0 0;
  font: 800 1.2rem/1.1 var(--head); color: #fff; background: var(--vest);
  border: 3px solid var(--bark); border-radius: 14px; box-shadow: var(--shadow);
  cursor: pointer; text-align: center; text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bark); }
.btn:disabled { opacity: .55; }
.btn.secondary { background: var(--card); color: var(--bark); }
.btn.green { background: var(--forest); }
.btn.small { font-size: 1rem; padding: 10px 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.link { background: none; border: 0; color: var(--forest); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 8px 0; }

label { display: block; font-weight: 800; margin: 12px 0 4px; }
input[type=text] {
  width: 100%; padding: 12px 14px; font: 600 1.1rem var(--body); color: var(--bark);
  background: #fff; border: 3px solid var(--bark); border-radius: 12px; outline: none;
}
input[type=text]:focus { border-color: var(--vest); }
input.answer { font: 800 1.4rem var(--head); text-align: center; letter-spacing: .06em; text-transform: uppercase; }
.member { display: flex; gap: 8px; margin-bottom: 8px; }
.member button { flex: 0 0 48px; border: 3px solid var(--bark); border-radius: 12px; background: var(--card); font-size: 1.3rem; cursor: pointer; }

/* top bar: timer sign + trail */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 8px 0 4px; }
.topbar .line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.team-name { font: 800 1.05rem var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer {
  font: 800 1.25rem/1 var(--head); background: var(--wood); color: #fff; padding: 8px 12px 6px;
  border: 3px solid var(--bark); border-radius: 10px; box-shadow: 0 3px 0 var(--bark); font-variant-numeric: tabular-nums;
}
.timer small { font-size: .75rem; opacity: .85; }
.trail { display: flex; justify-content: space-between; align-items: flex-end; margin: 10px 2px 0; }
.trail .step { width: 12%; opacity: .25; transform: rotate(var(--r, 0deg)); transition: opacity .4s; }
.trail .step:nth-child(odd) { --r: -10deg; margin-bottom: 6px; }
.trail .step:nth-child(even) { --r: 10deg; }
.trail .step.done { opacity: 1; }
.trail .step.now { opacity: .7; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.puzzle { font-size: 1.08rem; }
.hint { background: #e9f5d0; border: 2px dashed var(--moss); border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.banner {
  border: 3px solid var(--bark); border-radius: 14px; padding: 12px 14px; margin: 12px 0; font-weight: 800;
  background: #ffd8c2; box-shadow: var(--shadow); animation: drop .3s ease-out;
}
.banner.ok { background: #d9efc0; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
.shake { animation: shake .4s; border-color: var(--danger) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.code-chip { display: inline-block; font: 800 1.05rem var(--head); letter-spacing: .12em; background: #f3dca6; border: 2px solid var(--bark); border-radius: 8px; padding: 2px 8px; }

/* modal (no native alert/confirm) */
.modal-bg { position: fixed; inset: 0; background: #0007; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-bg .card { max-width: 420px; width: 100%; }

/* hit-the-target overlay */
.hit { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f6efdcee; z-index: 30; }
.hit .art { width: 180px; animation: zoom .35s ease-out; }
.hit .cork { animation: fly .5s ease-in both; }
.hit h2 { font-size: 2rem; }
@keyframes zoom { from { transform: scale(.4); } }
@keyframes fly { from { transform: translate(60px, -60px); } }

table.times { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.times td { padding: 6px 4px; border-bottom: 2px dotted #c9962b88; }
table.times td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.big-time { font: 800 2.6rem/1 var(--head); color: var(--vest-dark); font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #f3dca6; margin-left: 4px; }

.pines { display: flex; justify-content: center; gap: 4px; margin-top: 24px; opacity: .8; }
.pines .art { width: 34px; }
.pines .art:nth-child(2) { width: 46px; }
