/* Pig Fort — a road, a store of truffles, and the pigs between them. */
:root {
  --bg: #241a10;
  --panel: rgba(38, 27, 17, .95);
  --edge: rgba(255, 230, 190, .16);
  --ink: #f6ecdd;
  --muted: #c0a888;
  --gold: #ffc65c;
  --grass: #4f7a34;
  --road: #9a7b52;
  --good: #8fe08a;
  --bad: #ff8f8f;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(1200px 700px at 50% 0%, #33251a 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: .6rem; top: .6rem; background: var(--gold); color: #241a10;
                   padding: .4rem .7rem; border-radius: .5rem; z-index: 50; }
.wrap { max-width: 62rem; margin: 0 auto; padding: .9rem .9rem 2rem; }

/* ---- screens ---- */
.screen { display: none; }
.screen.show { display: block; }
.panel {
  background: var(--panel); border: 2px solid var(--edge); border-radius: 1rem;
  padding: 1.1rem 1.2rem; box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.panel.wide { max-width: 48rem; }
h1 { margin: 0 0 .5rem; font-size: 2.1rem; letter-spacing: .01em; }
h2 { margin: 0 0 .5rem; font-size: 1.35rem; }
h3 { margin: 1rem 0 .35rem; font-size: 1rem; color: var(--gold); }
.lede { margin: 0 0 .7rem; font-size: .98rem; line-height: 1.5; }
.hint { margin: .4rem 0 .8rem; font-size: .84rem; line-height: 1.5; color: var(--muted); }
.hint.good { color: var(--good); }
.hint.warn { color: var(--gold); }
.gold { color: var(--gold); }
kbd { background: rgba(255,255,255,.1); border: 1px solid var(--edge); border-radius: .3rem;
      padding: 0 .3rem; font-size: .8rem; }

/* ---- buttons ---- */
.prow { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 .2rem; }
.btn {
  font: inherit; font-weight: 800; color: var(--ink); cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 2px solid var(--edge);
  border-radius: .7rem; padding: .55rem .9rem;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .15); border-color: rgba(255,230,190,.4); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffd37a, #e8a33c); color: #2b1d0c;
               border-color: #ffdf9c; }
.btn.big { font-size: 1.08rem; padding: .75rem 1.3rem; }
.btn.tiny { padding: .3rem .55rem; font-size: .82rem; border-radius: .5rem; }
.btn.ghost { background: rgba(255, 255, 255, .05); }
.btn.danger { color: var(--bad); }

/* ---- the bar across the top of the game ---- */
.hud { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .5rem; }
.hud .spacer { flex: 1; }
.stat { font-weight: 800; font-size: .92rem; background: rgba(0,0,0,.3);
        border: 1px solid var(--edge); border-radius: .5rem; padding: .3rem .55rem; }

/* ---- the board ---- */
.board-wrap { position: relative; }
canvas#board {
  display: block; width: 100%; height: auto; border-radius: .8rem;
  border: 2px solid var(--edge); background: #3c5c28; touch-action: manipulation;
}
.say {
  position: absolute; left: 50%; top: .8rem; transform: translateX(-50%);
  background: rgba(0,0,0,.72); border: 1px solid var(--edge); border-radius: .6rem;
  padding: .4rem .8rem; font-weight: 800; font-size: .9rem; pointer-events: none;
  max-width: 90%; text-align: center;
}

/* ---- the shop along the bottom ---- */
.shop { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
        gap: .45rem; margin: .6rem 0 .3rem; }
.pigcard {
  display: flex; align-items: center; gap: .5rem; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: rgba(255,255,255,.05); border: 2px solid var(--edge);
  border-radius: .7rem; padding: .45rem .55rem;
}
.pigcard:hover:not(:disabled) { border-color: rgba(255,230,190,.45); background: rgba(255,255,255,.1); }
.pigcard.on { border-color: var(--gold); background: rgba(255,198,92,.16); }
.pigcard:disabled { opacity: .42; cursor: not-allowed; }
.pigcard .pi { font-size: 1.5rem; line-height: 1; }
.pigcard .pb { min-width: 0; }
.pigcard .pn { display: block; font-weight: 800; font-size: .86rem; }
.pigcard .pc { display: block; font-size: .78rem; color: var(--gold); font-weight: 800; }
.tip { margin: .2rem 0 0; min-height: 1.2em; }

/* ---- a chosen pig's numbers ---- */
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
           gap: .4rem; margin: .6rem 0; }
.statrow .s {
  background: rgba(0,0,0,.28); border: 1px solid var(--edge); border-radius: .55rem;
  padding: .4rem .55rem;
}
.statrow .s b { display: block; font-size: 1.05rem; }
.statrow .s span { font-size: .74rem; color: var(--muted); }
.guide { display: grid; gap: .45rem; margin: .5rem 0 .2rem; }
.guide .g { display: flex; gap: .6rem; align-items: flex-start;
            background: rgba(0,0,0,.25); border: 1px solid var(--edge);
            border-radius: .55rem; padding: .45rem .6rem; }
.guide .g .gi { font-size: 1.5rem; }
.guide .g b { display: block; }
.guide .g span { font-size: .8rem; color: var(--muted); line-height: 1.45; }

/* ---- the upgrade panel ---- */
.pighead { display: flex; align-items: flex-start; gap: .7rem; }
.pighead .pigicon { font-size: 2.3rem; line-height: 1; }
.pighead .pigwho { flex: 1; min-width: 0; }
.pighead .pigwho h2 { margin: 0 0 .2rem; }
.pighead .pigwho .lede { margin: 0; font-size: .86rem; color: var(--muted); }
.pigtier {
  font-weight: 800; font-size: 1rem; letter-spacing: .06em; color: var(--gold);
  background: rgba(0,0,0,.35); border: 1px solid var(--edge); border-radius: .5rem;
  padding: .3rem .5rem; white-space: nowrap;
}

.aims { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .4rem; }
.aim {
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.05); border: 2px solid var(--edge);
  border-radius: .6rem; padding: .4rem .55rem;
}
.aim:hover { border-color: rgba(255,230,190,.45); }
.aim.on { border-color: var(--gold); background: rgba(255,198,92,.16); }
.aim b { display: block; font-size: .88rem; }
.aim span { display: block; font-size: .72rem; color: var(--muted); line-height: 1.35; }

.paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .5rem 0 .2rem; }
.path { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.path .ph {
  display: flex; align-items: center; gap: .35rem; font-size: .82rem;
  border-bottom: 1px solid var(--edge); padding-bottom: .3rem; margin-bottom: .1rem;
}
.path .ph span { font-size: 1.05rem; }
.path .ph b { color: var(--gold); }
.tier {
  display: flex; align-items: center; justify-content: space-between; gap: .4rem;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: rgba(255,255,255,.04); border: 2px solid var(--edge);
  border-radius: .55rem; padding: .38rem .5rem;
}
.tier .tw { min-width: 0; }
.tier .tn { display: block; font-size: .8rem; font-weight: 700; }
.tier .td { display: block; font-size: .68rem; color: var(--muted); line-height: 1.3; }
.tier.have .td { color: rgba(143,224,138,.75); }
.tier .tc { font-size: .76rem; font-weight: 800; color: var(--gold); white-space: nowrap; }
.tier.have { background: rgba(143,224,138,.16); border-color: rgba(143,224,138,.5); }
.tier.have .tc { color: var(--good); }
.tier.next { border-color: rgba(255,198,92,.55); background: rgba(255,198,92,.08); }
.tier.next:hover:not(:disabled) { background: rgba(255,198,92,.2); }
.tier.later { opacity: .5; }
.tier:disabled { cursor: not-allowed; }
.tier.next:disabled { opacity: .62; }
.plock { margin: .15rem 0 0; font-size: .72rem; color: var(--muted); line-height: 1.35; }

.foot { margin-top: 1rem; text-align: center; font-size: .84rem; }
.foot a { color: var(--muted); }

/* ---- on a phone ---- */
@media (max-width: 34rem) {
  .wrap { padding: .6rem .6rem 1.4rem; }
  h1 { font-size: 1.7rem; }
  .hud { gap: .3rem; }
  .stat { font-size: .8rem; padding: .25rem .4rem; }
  .shop { grid-template-columns: repeat(2, 1fr); }
  .pigcard .pn { font-size: .8rem; }
  .btn.big { width: 100%; }
  /* three columns of upgrades will not fit a phone; one path under the next. */
  .paths { grid-template-columns: 1fr; gap: .7rem; }
  .aims { grid-template-columns: 1fr 1fr; }
  .pighead .pigicon { font-size: 1.9rem; }
}
