/* Pet Park web app. Palette and pixel pets follow the workshop deck. */
:root {
  --bg: #F2F4F4; --surface: #FDFEFE; --ink: #123229; --muted: #5E6463; --line: #E0E0E0;
  --brand: #00747A; --brand-soft: #E6F1F2; --cobalt: #3DA5A5; --petrol: #033E3F;
  --orange: #F4A053; --coral: #EF7364; --good: #3B634E; --sage: #A5AF80; --coffee: #86381D;
  --lcd: #C9D8B6; --lcd-ink: #1E2A1B; --egg: #EFE6CC; --track: #E3E8E8;
  --radius: 16px;
}
:root[data-theme="dark"] {
  --bg: #0B1E19; --surface: #123229; --ink: #F2F2F2; --muted: #AEB4B5; --line: #24473D;
  --brand: #3DA5A5; --brand-soft: #033E3F; --lcd: #B4C79F; --egg: #D8CFB3; --track: #24473D;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 Lato, system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.gap-top, .eyebrow.gap-top { margin-top: 28px; }
.gap-bottom { margin-bottom: 18px; }

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 24px; background: var(--brand-soft); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { font: 18px "Press Start 2P", monospace; color: var(--brand); letter-spacing: 1px; }
.net { font: 900 11px Lato, sans-serif; letter-spacing: .08em; text-transform: uppercase; background: var(--brand); color: #fff; border-radius: 500px; padding: 3px 10px; }
.tabs { display: flex; gap: 6px; }
.tabs a { text-decoration: none; color: var(--ink); font-weight: 700; padding: 8px 14px; border-radius: 500px; }
.tabs a.on { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 500px; padding: 6px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.btn { border: 0; border-radius: 500px; padding: 9px 18px; font-weight: 900; background: var(--brand); color: #fff; }
.btn:hover:not(:disabled) { filter: brightness(.92); }
.btn.alt { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.warm { background: var(--orange); color: var(--ink); }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--brand); font-weight: 700; padding: 0; }

main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px; outline: none; }
.foot { display: flex; justify-content: space-between; gap: 16px; padding: 10px 24px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.foot-right { display: flex; gap: 16px; }
.bad { color: var(--coral); }

h1, h2, h3 { margin: 0; }
.eyebrow { font: 900 12px Lato, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

/* ---------------------------------------------------------------- park */
.park { display: grid; grid-template-columns: 1fr 330px; gap: 24px; }
@media (max-width: 980px) { .park { grid-template-columns: 1fr; } }
.park-head { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: end; margin-bottom: 20px; }
.park-head h1 { font: 900 32px Lato, sans-serif; }
.kpis { display: flex; gap: 24px; margin-left: auto; }
.kpi b { display: block; font: 900 24px Lato, sans-serif; }
.kpi span { font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: inherit; text-decoration: none; display: block; position: relative; transition: transform .15s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card.flash { box-shadow: 0 0 0 4px var(--cobalt); }
.card.mine { border: 2px solid var(--orange); }
.card .name { display: flex; justify-content: space-between; gap: 8px; font: 900 19px Lato, sans-serif; margin: 10px 0 2px; }
.card .name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 13px; color: var(--muted); }
.alarm { font-size: 13px; font-weight: 900; margin-top: 8px; }
.alarm.bad { color: var(--coral); }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); }

/* LCD screen with the pixel pet (same look as the slides) */
.lcd { background: var(--lcd); border-radius: 12px; height: 150px; display: grid; place-items: center; position: relative; overflow: hidden; }
.lcd.egg { background: var(--egg); }
.lcd.dead { background: #DDE1E1; }
.lcd svg.pet { width: 112px; height: auto; }
.lcd .ver { position: absolute; left: 10px; top: 8px; font: 900 11px Lato, sans-serif; color: var(--lcd-ink); background: rgba(255,255,255,.55); border-radius: 500px; padding: 2px 8px; }
.lcd .lvl { position: absolute; right: 10px; top: 8px; font: 900 11px Lato, sans-serif; color: var(--lcd-ink); background: rgba(255,255,255,.55); border-radius: 500px; padding: 2px 8px; }
.lcd .zzz { position: absolute; right: 18px; top: 26px; font: 14px "Press Start 2P", monospace; color: var(--lcd-ink); animation: float 2.2s ease-in-out infinite; }
.lcd .poops { position: absolute; left: 10px; bottom: 8px; display: flex; gap: 4px; }
.lcd .poops svg { width: 18px; height: 18px; }
.happy svg.pet { animation: bob 1.6s ease-in-out infinite; }
.meh svg.pet { animation: bob 3s ease-in-out infinite; }
.ugh svg.pet { animation: shake .5s ease-in-out infinite; }
.egg svg.pet { animation: wobble 2.4s ease-in-out infinite; }
.sleep svg.pet { animation: breathe 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes wobble { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes breathe { 50% { transform: scale(1.04, .96); } }
@keyframes float { 50% { transform: translateY(-6px); } }

/* event effects (food, hearts, ball…) over a pet's screen */
.fx { position: absolute; left: 50%; top: 40%; font-size: 30px; pointer-events: none; animation: fx-up 1.6s ease-out forwards; z-index: 2; }
.fx.drop { top: -10%; animation-name: fx-drop; }
.fx.bounce { animation-name: fx-bounce; }
@keyframes fx-up { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 20% { opacity: 1; } to { transform: translate(-50%, -70px) scale(1.2); opacity: 0; } }
@keyframes fx-drop { from { transform: translate(-50%, 0); opacity: 0; } 20% { opacity: 1; } 70% { transform: translate(-50%, 60px); opacity: 1; } to { transform: translate(-50%, 60px) scale(.4); opacity: 0; } }
@keyframes fx-bounce { 0% { transform: translate(-140%, 30px); opacity: 0; } 15% { opacity: 1; } 40% { transform: translate(-60%, -30px); } 65% { transform: translate(20%, 30px); } 85% { transform: translate(80%, -10px); opacity: 1; } 100% { transform: translate(120%, 30px); opacity: 0; } }

/* stat bars */
.bars { display: grid; gap: 7px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: 82px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; }
.track { height: 10px; background: var(--track); border-radius: 10px; overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 10px; background: var(--good); transition: width .8s linear; }
.fill.mid { background: var(--orange); } .fill.high { background: var(--coral); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }

/* side column */
.side section { margin-bottom: 16px; }
ol.top { margin: 0; padding-left: 22px; } ol.top li { padding: 3px 0; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.feed li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border: 0; }
.feed a { font-size: 11px; margin-left: 4px; }
.graveyard { margin-top: 28px; }
.graveyard .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tomb { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 10px; text-align: center; font-size: 13px; color: var(--muted); text-decoration: none; display: block; }
.tomb b { color: var(--ink); display: block; }
.tomb svg { width: 56px; height: auto; display: block; margin: 4px auto 6px; }

/* ---------------------------------------------------------------- pet page */
.petpage { display: grid; grid-template-columns: 420px 1fr; gap: 32px; align-items: start; }
@media (max-width: 980px) { .petpage { grid-template-columns: 1fr; } }
.back { display: inline-block; margin-bottom: 14px; font-weight: 700; text-decoration: none; }

/* the Tamagotchi device, as drawn on the slides */
.device-wrap { position: relative; width: 100%; max-width: 400px; margin: 0 auto; }
.device { position: relative; width: 100%; aspect-ratio: 40 / 46; }
.device > svg.shell { position: absolute; inset: 0; width: 100%; height: 100%; }
.device .screen { position: absolute; left: 23.75%; top: 25%; width: 52.5%; height: 36.96%; border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.device .screen svg.pet { width: 66%; height: auto; }
.device .screen.lcd { background: var(--lcd); } .device .screen.egg { background: var(--egg); } .device .screen.dead { background: #DDE1E1; }
.device .dbtn { position: absolute; width: 11%; aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--orange); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 2px 0 rgba(0,0,0,.15); transform: translate(-50%, -50%); }
.device .dbtn:hover:not(:disabled) { filter: brightness(1.06); }
.device .dbtn:active:not(:disabled) { box-shadow: inset 0 2px 0 rgba(0,0,0,.2); }
.device .dbtn:disabled { background: #D9C3A8; }
.device .dbtn.a { left: 31.25%; top: 78.26%; }
.device .dbtn.b { left: 50%;    top: 82.6%; }
.device .dbtn.c { left: 68.75%; top: 78.26%; }
.dlabels { display: flex; justify-content: space-between; width: 64%; margin: 6px auto 0; font: 900 13px Lato, sans-serif; text-align: center; }
.dlabels span { width: 33%; }
.dlabels small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.bubble { position: absolute; left: 50%; top: 23%; transform: translate(-50%, -100%); background: var(--surface); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; max-width: 92%; width: max-content; text-align: center; z-index: 3; animation: pop .25s ease-out; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: var(--ink); }
.bubble.bad { border-color: var(--coral); }
.bubble.bad::after { border-top-color: var(--coral); }
@keyframes pop { from { transform: translate(-50%, -90%) scale(.8); opacity: 0; } }
.actions + .eyebrow { margin-top: 28px; }

.pet-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.pet-title h1 { font: 900 38px Lato, sans-serif; }
.pet-title .mood { font-size: 34px; }
.stats { display: grid; gap: 14px; margin: 18px 0; }
.stat { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; align-items: center; }
.stat .label { font-weight: 900; }
.stat .track { height: 14px; }
.stat .say { grid-column: 2; font-size: 14px; color: var(--muted); }
.stat .say.bad { color: var(--coral); font-weight: 700; }

.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.action { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--ink); }
.action:hover:not(:disabled) { border-color: var(--brand); }
.action b { display: block; font-size: 16px; }
.action small { color: var(--muted); }
.action code { color: var(--brand); }
.action:disabled { opacity: .55; }
.approve { display: flex; gap: 14px; align-items: center; background: var(--brand-soft); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; flex-wrap: wrap; }
.approve p { margin: 0; flex: 1; min-width: 220px; font-size: 14px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.versions { display: flex; flex-wrap: wrap; gap: 8px; }
.versions a { text-decoration: none; }
.versions .chip.on { border-color: var(--orange); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 16px; bottom: 50px; display: grid; gap: 8px; z-index: 10; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.toast a { color: var(--orange); }
.toast.bad { background: var(--coral); color: #1E1E1E; }
.toast.bad a { color: #1E1E1E; }

/* ---------------------------------------------------------------- how-to + setup */
.prose { max-width: 760px; }
.prose h2 { margin: 28px 0 8px; }
.prose li { margin: 4px 0; }
.setup { max-width: 560px; margin: 40px auto; }
.setup input, .setup select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 14px ui-monospace, monospace; margin: 4px 0 14px; }

/* ---------------------------------------------------------------- big screen (projector) */
body.screen .wallet, body.screen .tabs { display: none; }
body.screen main { max-width: none; }
body.screen .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
body.screen .card .lcd { height: 190px; }
body.screen .card .lcd svg.pet { width: 140px; }
body.screen .join { display: block; }
.join { display: none; font-size: 15px; }
.join b { font-size: 20px; }

@media (prefers-reduced-motion: reduce) {
  .lcd svg.pet, .device svg.pet, .zzz, .fx { animation: none !important; }
}
@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; gap: 12px; }
  .wallet { margin-left: 0; width: 100%; }
  .kpis { margin-left: 0; gap: 16px; }
}
