/* Weed Conquest — cozy sticker theme with a pinch of pixel farm */
:root {
  --cream: #fff8ef;
  --paper: #ffffff;
  --ink: #3d3a50;
  --ink-soft: #7a768c;
  --leaf: #8fd694;
  --leaf-soft: #dff5d8;
  --leaf-deep: #3f8f4c;
  --ai: #b38bfa;
  --ai-soft: #eee4ff;
  --amber: #ffd166;
  --amber-soft: #fff3c4;
  --coral: #ff8f7a;
  --coral-soft: #ffe1da;
  --sky: #cdeffd;
  --line: 2.5px solid var(--ink);
  --shadow: 0 4px 0 var(--ink);
  --radius: 18px;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #f3ead9; color: var(--ink); font-size: 16px; line-height: 1.4; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, p { margin: 0; }
small { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.app {
  max-width: 430px; min-height: 100dvh; margin: 0 auto; background: var(--cream);
  padding: 0 0 env(safe-area-inset-bottom); position: relative; overflow-x: clip;
}
@media (min-width: 431px) { .app { border-left: var(--line); border-right: var(--line); } }

.screen { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px 24px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 13.5px; }
.good { color: var(--leaf-deep); }
.bad { color: #d6452f; }
.label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 6px 0 2px; }
.label small { text-transform: none; letter-spacing: 0; }

/* ---------- building blocks ---------- */
.card { background: var(--paper); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card.calm { background: var(--leaf-soft); font-weight: 700; text-align: center; }

.btn {
  min-height: 46px; padding: 8px 16px; border: var(--line); border-radius: 14px; background: var(--paper);
  font-weight: 800; box-shadow: 0 3px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .35; box-shadow: none; cursor: default; }
.btn.primary { background: var(--leaf); }
.btn.secondary { background: var(--amber-soft); }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.btn.round { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }

.bar { height: 10px; background: #eee6d8; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; flex: 1; min-width: 40px; }
.bar i { display: block; height: 100%; background: var(--leaf); transition: width .3s; }
.bar.ai i { background: var(--ai); }
.bar.warn i { background: var(--amber); }
.bar.danger i { background: var(--coral); }
.bar.goal { height: 8px; border-radius: 0; border-left: 0; border-right: 0; }

.badge { background: var(--amber); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge.soft { background: var(--leaf-soft); }
.chip { display: inline-block; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; }

/* ---------- HUD & pixel town ---------- */
.hud { position: sticky; top: 0; z-index: 5; background: var(--ink); padding-top: env(safe-area-inset-top); }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 10px; color: var(--cream); font-weight: 800; font-size: 14px; }
.hud-item { display: flex; flex-direction: column; align-items: center; line-height: 1.1; white-space: nowrap; }
.hud-item small { color: #b9b5cc; font-size: 10px; }
.hud-item.bad { color: var(--coral); }
.hud-quit { width: 44px; height: 44px; margin: -4px 0; border: 0; background: none; font-size: 22px; }

.town {
  position: relative; height: 46px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 6px 5px; overflow: hidden;
  background: linear-gradient(var(--sky) 0 62%, #9ad17d 62% 100%);
  border-bottom: var(--line); image-rendering: pixelated;
}
.town .sprite { width: 20px; height: 16px; flex: 0 0 auto; }
.town .sprite svg { width: 100%; height: 100%; display: block; }
.town .sun { position: absolute; top: 6px; right: 14px; width: 10px; height: 10px; background: var(--amber); box-shadow: 0 0 0 2px #ffe7a3; }
.title .town, .run .town { border: var(--line); border-radius: 12px; }

/* ---------- title ---------- */
.title { padding-top: calc(20px + env(safe-area-inset-top)); }
.logo { text-align: center; }
.logo-leaf { font-size: 56px; display: inline-block; animation: sway 3s ease-in-out infinite; transform-origin: 50% 90%; }
.logo h1 { font-size: 44px; font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.tagline { font-weight: 700; color: var(--ink-soft); margin-top: 4px; }
.howto { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14.5px; font-weight: 600; }
.seed-row { display: flex; gap: 8px; }
.seed-input { flex: 1; min-width: 0; min-height: 46px; border: var(--line); border-radius: 14px; padding: 0 14px; font-weight: 800; font-size: 18px; letter-spacing: .05em; text-transform: uppercase; background: var(--cream); }
.seed-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.fineprint { text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ---------- plan ---------- */
.plan { padding-bottom: 96px; }
.tips { display: flex; gap: 10px; background: var(--leaf-soft); border: var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 14.5px; font-weight: 600; }
.tips p + p { margin-top: 6px; }
.mascot { font-size: 34px; animation: sway 3s ease-in-out infinite; transform-origin: 50% 90%; align-self: flex-start; }

.forecast { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.forecast-item { background: var(--paper); border: var(--line); border-radius: 14px; padding: 6px 10px; display: flex; flex-direction: column; }
.forecast-item.wide { grid-column: 1 / -1; gap: 4px; }
.forecast-item .bar { flex: none; margin: 3px 0 2px; }
.forecast-item b { font-size: 18px; }

.fold { padding: 0; gap: 0; overflow: hidden; }
.fold-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 52px; padding: 8px 14px; border: 0; background: none; text-align: left; font-weight: 800; font-size: 17px; }
.fold-title { flex: 1; }
.chev { color: var(--ink-soft); transition: transform .15s; }
.fold.open > .fold-head .chev { transform: rotate(180deg); }
.fold-body { display: none; flex-direction: column; gap: 8px; padding: 0 14px 14px; }
.fold.open > .fold-body { display: flex; }

.stepper { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.stepper-label { flex: 1; font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; }
.stepper-label > span { display: flex; flex-direction: column; }
.stepper-value { min-width: 54px; text-align: center; font-weight: 900; font-size: 17px; }
.meter-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; }

.ai-row { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 2px dashed #e6dcc8; }
.ai-name { display: flex; align-items: baseline; gap: 8px; }
.ai-name small { flex: 1; }
.mood { font-size: 18px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--line); border-radius: 14px; overflow: hidden; }
.seg { min-height: 48px; border: 0; border-left: 2px solid var(--ink); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 17px; line-height: 1.1; padding: 4px 2px; }
.seg:first-child { border-left: 0; }
.seg small { font-size: 10.5px; }
.seg.on { background: var(--ai-soft); box-shadow: inset 0 -4px 0 var(--ai); }
.seg.on small { color: var(--ink); font-weight: 800; }
.segmented.five { grid-template-columns: repeat(5, 1fr); }
.segmented.five .seg { font-size: 20px; }
.ai-level-name { font-weight: 800; color: var(--ink); }

.deal { border: var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--amber-soft); }
.deal.signing { background: var(--leaf-soft); }
.deal.committed { background: var(--paper); border-style: dashed; }
.deal-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.deal-stores { font-weight: 900; white-space: nowrap; }
.deal-meta { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.deal-meta.bad { color: #d6452f; }
.deal-meta.good { color: var(--leaf-deep); }
.reqs { display: flex; flex-wrap: wrap; gap: 4px; }
.req { font-size: 12.5px; font-weight: 700; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 2px 7px; }
.req.done { background: var(--leaf-soft); }

.feature { display: flex; align-items: center; gap: 6px; }
.feature-main { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 10px; text-align: left; border: 2px solid #e6dcc8; border-radius: 12px; background: var(--paper); padding: 6px 10px; }
.feature.queued .feature-main { border-color: var(--ink); background: var(--leaf-soft); }
.feature-pos { width: 30px; text-align: center; font-weight: 900; color: var(--ink-soft); }
.feature.queued .feature-pos { color: var(--ink); }
.feature-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-weight: 700; font-size: 14.5px; }
.feature.done { font-size: 14px; font-weight: 700; color: var(--ink-soft); padding: 2px 4px; }
.feature .bar { flex: none; height: 8px; }

.role { border-top: 2px dashed #e6dcc8; }
.role-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 52px; border: 0; background: none; text-align: left; padding: 4px 0; }
.role-face { font-size: 22px; }
.role-name { flex: 1; font-weight: 800; display: flex; flex-direction: column; line-height: 1.2; }
.role-stars { color: #e0a100; font-size: 12px; letter-spacing: -1px; }
.role-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 12px; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; }
.toggle input { width: 24px; height: 24px; accent-color: var(--leaf-deep); flex: none; }
.toggle span { display: flex; flex-direction: column; line-height: 1.2; }
.cv, .person { display: flex; align-items: center; gap: 8px; border: 2px solid #e6dcc8; border-radius: 12px; padding: 6px 8px; background: var(--paper); }
.cv { border-color: var(--ink); background: var(--amber-soft); }
.cv.picked { background: var(--leaf-soft); }
.cv-face { font-size: 24px; }
.cv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; font-size: 14.5px; }
.retrain { min-height: 44px; max-width: 120px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); font-size: 13px; font-weight: 700; padding: 0 4px; }
.retrain:disabled { opacity: .5; border-style: dashed; }

.market { display: grid; grid-template-columns: 1fr 70px auto; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; min-height: 30px; }
.market.locked { color: var(--ink-soft); }
.market small { white-space: nowrap; }
.market-name small { white-space: normal; }

.runbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 430px; z-index: 6;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--cream) 35%);
}
.runbar.two { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }

/* ---------- run animation ---------- */
.run { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: 96px; }
.run-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.run-head h2 { font-size: 19px; }
.run-count { font-size: 20px; font-weight: 900; white-space: nowrap; }
.run .bar.goal { border: 2px solid var(--ink); border-radius: 8px; flex: none; }
.lanes { display: flex; flex-direction: column; gap: 6px; }
.lane { display: flex; align-items: center; gap: 6px; background: var(--leaf-soft); border: var(--line); border-radius: 14px; padding: 0 0 0 8px; height: 50px; overflow: hidden; }
.lane:nth-child(2) { background: var(--amber-soft); }
.lane:nth-child(3) { background: var(--ai-soft); }
.lane:nth-child(4) { background: var(--coral-soft); }
.lane:nth-child(5) { background: var(--sky); }
.lane-label { width: 108px; flex: none; font-size: 12.5px; font-weight: 800; }
.lane-track { position: relative; flex: 1; height: 100%; }
.token {
  position: absolute; top: 8px; left: 0; height: 34px; min-width: 34px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; font-size: 16px; font-weight: 900; white-space: nowrap;
  animation: slide 2.6s linear forwards;
}
.token.bug { background: var(--coral-soft); }
.token.incident { background: var(--coral); animation-name: slide-shake; }
.token.ship { background: var(--leaf); }
.token.store-up { background: var(--leaf); animation-name: pop; }
.token.store-down { background: #ddd; animation-name: pop; }
.ticker { display: flex; flex-direction: column; gap: 4px; min-height: 124px; }
.tick { background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px; font-size: 13.5px; font-weight: 700; animation: drop .25s ease-out; }
.tick.incident { background: var(--coral-soft); }
.tick.ship, .tick.store-up { background: var(--leaf-soft); }

/* ---------- events ---------- */
.event { padding-top: 20px; }
.speech { align-items: center; text-align: center; padding: 20px 16px; }
.speech-face { font-size: 64px; line-height: 1; animation: bounce .5s ease-out; }
.speech-who { font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--ink-soft); }
.speech-text { font-size: 18px; font-weight: 700; }
.btn.choice { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; min-height: 64px; background: var(--amber-soft); width: 100%; }
.btn.choice b { font-size: 17px; }

/* ---------- report ---------- */
.report { padding-bottom: 96px; }
.paper { background: #fbf3df; border: var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 12px 14px; text-align: center; font-family: Georgia, "Times New Roman", serif; }
.paper small { font-family: inherit; letter-spacing: .12em; border-bottom: 2px solid var(--ink); display: block; padding-bottom: 4px; margin-bottom: 8px; color: var(--ink); }
.paper h2 { font-size: 22px; line-height: 1.15; }
.stat { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.stat b { white-space: nowrap; }
.stat-note { text-align: right; margin-top: -6px; }
.incident { display: flex; gap: 10px; align-items: flex-start; }
.incident > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.prio { flex: none; width: 34px; text-align: center; border: 2px solid var(--ink); border-radius: 8px; font-weight: 900; font-size: 13px; padding: 1px 0; background: var(--amber-soft); }
.prio.p0 { background: var(--coral); }
.prio.p1 { background: var(--amber); }
.note { font-weight: 600; font-size: 14.5px; }
.bubble { background: var(--ai-soft); border: var(--line); border-radius: 18px 18px 18px 4px; padding: 10px 12px; font-weight: 600; font-size: 14.5px; }

/* ---------- end ---------- */
.end { padding-top: 16px; }
.hero { align-items: center; text-align: center; background: var(--coral-soft); }
.hero.win { background: var(--leaf-soft); }
.hero-icon { font-size: 60px; line-height: 1; animation: bounce .6s ease-out; }
.hero-stat { font-weight: 800; }
.score-title { text-align: center; font-size: 26px; line-height: 1.1; }
.score-total { text-align: center; font-size: 44px; font-weight: 900; line-height: 1; margin: 4px 0; }
.debrief, .track-head { display: grid; grid-template-columns: 96px 1fr 104px; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; min-height: 30px; }
.track-scale { display: flex; justify-content: space-between; }
.track { position: relative; height: 8px; background: #eee6d8; border: 2px solid var(--ink); border-radius: 8px; margin: 0 8px; }
.dot { position: absolute; top: 50%; width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 50%; transform: translate(-50%, -50%); }
.dot.sweet { background: var(--leaf); }
.dot.yours { background: var(--ai); width: 12px; height: 12px; }
.share-box { width: 100%; min-height: 44px; border: var(--line); border-radius: 12px; padding: 0 10px; background: var(--cream); font-size: 13px; }

/* ---------- motion ---------- */
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes bounce { 0% { transform: scale(.3); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide { from { left: 0; transform: translateX(-100%); } to { left: 100%; transform: translateX(0); } }
@keyframes slide-shake {
  0% { left: 0; transform: translateX(-100%) rotate(0); } 25% { transform: translateX(-75%) rotate(-8deg); } 50% { transform: translateX(-50%) rotate(8deg); }
  75% { transform: translateX(-25%) rotate(-8deg); } 100% { left: 100%; transform: translateX(0) rotate(0); }
}
@keyframes pop { 0% { left: 40%; transform: scale(.2); opacity: 0; } 20% { transform: scale(1.2); opacity: 1; } 80% { transform: scale(1); opacity: 1; } 100% { left: 40%; transform: scale(1) translateY(-14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
