/* Penguin Idle — cozy theme
   Palette: deep winter-night sky outside, warm cocoa-and-wool panels inside. */
:root {
  --sky1: #1f1a3a;
  --sky2: #3a2b52;
  --sky3: #6b4560;
  --panel: rgba(58, 40, 40, 0.86);
  --panel-2: #4a3330;
  --panel-3: #5a3f3a;
  --border: rgba(255, 222, 186, 0.16);
  --text: #fbefe0;
  --muted: #dcc6ae;
  --accent: #ffb562;     /* lantern amber */
  --rose: #e8735a;       /* scarf */
  --cream: #f6d7b0;
  --good: #a6e3bd;       /* mint */
  --bad: #f6b3a8;
  --gold: #ffd27a;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(20, 10, 20, 0.35);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 1rem;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 40% at 70% 0%, rgba(120, 220, 190, .12), transparent 70%),
    radial-gradient(ellipse 60% 30% at 20% 5%, rgba(170, 140, 255, .10), transparent 70%),
    linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 55%, var(--sky3) 100%) fixed;
  min-height: 100vh;
  overflow-x: hidden;
  /* Safe area: keep content clear of notches / rounded corners */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2 { margin: 0; font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 16px 0 8px; letter-spacing: .01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.empty { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Focus is distinct from hover, and visible on every interactive element */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 6px, transparent 6px 12px),
    rgba(40, 26, 30, .75);
  border-bottom: 3px solid var(--rose);
  box-shadow: 0 3px 0 var(--cream) inset, var(--shadow);
}
.topbar h1 { font-size: 1.4rem; }
.totals { text-align: center; }
.fish-count { font-family: "Fredoka", sans-serif; font-size: 2.1rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fish-count .unit { font-size: 1rem; font-weight: 500; color: var(--muted); }
.fps { color: var(--muted); font-variant-numeric: tabular-nums; }
.feather-badge {
  background: rgba(255, 210, 122, .12); border: 1px solid rgba(255, 210, 122, .45);
  padding: 6px 14px; border-radius: 999px; color: var(--gold);
}

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px;
  padding: 18px; max-width: 1320px; margin: 0 auto;
  will-change: transform;
}
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; padding: 12px; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* ---------- Clicker ---------- */
.clicker { display: flex; flex-direction: column; align-items: center; position: relative; }
/* The big penguin's speech bubble */
.say-bubble {
  position: absolute; z-index: 4; max-width: min(220px, calc(100% - 16px)); width: max-content;
  padding: 7px 12px; border-radius: 14px; background: #fffaf2; color: #3a2a30;
  font: 700 .9rem/1.3 "Nunito", sans-serif; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); pointer-events: none;
}
.say-bubble::after {
  content: ""; position: absolute; top: 100%; left: var(--tail, 20px); translate: -50% 0;
  border: 8px solid transparent; border-top-color: #fffaf2; border-bottom: 0; border-left-width: 4px;
}
.say-bubble.pop { animation: sayIn .3s var(--ease-pop); }
.say-bubble.hidden { display: none; }
@keyframes sayIn { from { opacity: 0; scale: .5; translate: -8px 10px; } }
.big-penguin {
  background: radial-gradient(circle, rgba(255, 181, 98, .28), transparent 65%);
  border: none; border-radius: 50%; padding: 18px; margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
  animation: bob 3.4s ease-in-out infinite;
  touch-action: manipulation;
}
.big-penguin:focus-visible { border-radius: 50%; outline-offset: -4px; }
.big-penguin svg { display: block; transform-origin: 50% 95%; transition: transform .25s var(--ease-out); }
.big-penguin:hover svg { transform: scale(1.04); }
@keyframes bob { 50% { translate: 0 -6px; } }
/* Squash on each pat, then spring back past rest and settle (overshoot ease) */
.big-penguin.happy svg { animation: pop .3s var(--ease-pop); }
@keyframes pop { 0% { transform: scale(1.14, .84); } 100% { transform: scale(1, 1); } }
.click-info { color: var(--muted); margin-top: 4px; }

.buffs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 30px; }
.buff {
  background: rgba(255, 210, 122, .16); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 999px; padding: 3px 12px; font-size: .85rem; font-weight: 600;
  animation: popIn .35s var(--ease-pop);
}

/* ---------- Colony scene ---------- */
.colony {
  margin-top: 14px; width: 100%; height: 170px; position: relative; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--border);
  --sky: linear-gradient(180deg, #171433 0%, #2e2550 60%, #4b3a5e 100%);
  --sky-night: linear-gradient(180deg, #0c0a20 0%, #1d1838 60%, #2e2448 100%);
  --ground: linear-gradient(180deg, #f3ecf6, #dcd3ea);
  --land: #3d3460; --land-hi: #b9b3d8;
  background: var(--sky); transition: background 1.5s;
}
.colony .aurora {
  position: absolute; inset: 0 0 50% 0; opacity: 0; transition: opacity 2s;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(120, 240, 190, .35), transparent 70%);
  animation: aurora 9s ease-in-out infinite alternate;
}
.colony .aurora.on { opacity: 1; }
@keyframes aurora { to { transform: translateX(12%) scaleY(1.2); } }
.colony .ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  background: var(--ground);
  border-top-left-radius: 50% 20px; border-top-right-radius: 50% 20px;
}
.lights { position: absolute; top: 6px; left: 0; right: 0; display: flex; justify-content: space-around; padding: 0 6px; }
.lights::before {
  content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 14px;
  border-bottom: 1px solid rgba(255,255,255,.25); border-radius: 0 0 50% 50%;
}
.bulb { width: 7px; height: 9px; border-radius: 50%; margin-top: 8px; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .45; } }
.props { position: absolute; inset: 0; }
.prop { position: absolute; font-size: 1.6rem; animation: popIn .5s var(--ease-pop); }
.prop.float { animation: popIn .5s var(--ease-pop), drift 6s ease-in-out infinite alternate; }
@keyframes drift { to { translate: 0 -8px; } }
.prop.igloo {
  width: 50px; height: 28px; background: #fbf8ff; border-radius: 50px 50px 0 0;
  box-shadow: inset -5px -3px 0 #d9d0ea;
  background-image: repeating-linear-gradient(0deg, transparent 0 8px, rgba(150,140,180,.25) 8px 9px);
}
.prop.igloo::after {
  content: ""; position: absolute; left: 18px; bottom: 0; width: 14px; height: 13px; border-radius: 7px 7px 0 0;
  background: radial-gradient(circle at 50% 80%, #ffd27a, #e8735a);
  box-shadow: 0 0 10px rgba(255, 181, 98, .8);
}
.fire { position: absolute; left: 50%; bottom: 14%; translate: -50% 0; font-size: 1.6rem; }
.fire .glow {
  position: absolute; left: 50%; top: 50%; width: 120px; height: 80px; translate: -50% -40%;
  background: radial-gradient(ellipse, rgba(255, 170, 80, .55), transparent 65%);
  animation: flicker 1.8s ease-in-out infinite;
}
.fire .flame { position: relative; display: inline-block; animation: flame .9s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes flicker { 50% { opacity: .7; transform: scale(.94); } }
@keyframes flame { to { transform: scale(1.08, .94) rotate(3deg); } }
.waddlers { position: absolute; inset: 0; }
.waddler { position: absolute; bottom: 8px; font-size: 22px; line-height: 1; }
.waddler.flip { scale: -1 1; }
.w-body { display: inline-block; transform-origin: 50% 92%; }
/* Standing still: a slow breath. Walking: a side-to-side waddle with a little bob each step */
.waddler .w-body { animation: breathe 3.2s ease-in-out infinite; }
.walking .w-body { animation: step var(--step, .45s) ease-in-out infinite; }
.waddler.look .w-body { animation: look 1.4s ease-in-out; }
.waddler.hop .w-body { animation: hop .7s var(--ease-out); }
.waddler.flap .w-body { animation: flap .6s ease-in-out 2; }
.arrival.flip .w-body { scale: -1 1; }
@keyframes breathe { 50% { transform: scale(1.03, .97); } }
@keyframes step {
  0%, 100% { transform: rotate(-10deg); }
  25%, 75% { transform: translateY(-2px) rotate(0); }
  50% { transform: rotate(10deg); }
}
@keyframes look { 0%, 22% { scale: 1 1; } 30%, 62% { scale: -1 1; } 70%, 100% { scale: 1 1; } }
@keyframes hop {
  0% { transform: none; } 15% { transform: scale(1.12, .84); }
  45% { transform: translateY(-10px) scale(.94, 1.08); } 70% { transform: scale(1.1, .88); } 100% { transform: none; }
}
@keyframes flap { 25% { transform: rotate(-12deg) translateY(-1px); } 75% { transform: rotate(12deg) translateY(-1px); } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px dashed var(--border); padding-bottom: 10px; }
.tab {
  background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 8px 16px; color: var(--muted);
  min-height: 40px; font-weight: 600; transition: background .2s var(--ease-out), color .2s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tab.active { background: var(--panel-3); border-color: var(--border); color: var(--text); }
.pill { background: var(--accent); color: #3a2312; border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 800; }
.tab-body { max-height: calc(100vh - 200px); overflow-y: auto; padding-right: 6px; animation: fadeUp .25s var(--ease-out); }
@media (max-width: 820px) { .tab-body { max-height: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
@keyframes popIn { from { opacity: 0; transform: scale(.6); } }

/* ---------- Upgrades ---------- */
.upgrade-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.upgrade {
  width: 56px; height: 56px; font-size: 1.7rem; border-radius: 14px;
  background: var(--panel-2); border: 2px solid var(--border);
  display: grid; place-items: center;
  animation: popIn .35s var(--ease-pop);
  transition: transform .15s var(--ease-out), opacity .2s;
}
.upgrade:hover { transform: translateY(-2px); }
.upgrade { position: relative; }
/* Category tints so patting / whole-colony / golden upgrades read apart from colony ones */
.upgrade.kind-click  { background: radial-gradient(circle at 50% 35%, rgba(232, 115, 90, .35), var(--panel-2) 70%); }
.upgrade.kind-global { background: radial-gradient(circle at 50% 35%, rgba(255, 181, 98, .35), var(--panel-2) 70%); }
.upgrade.kind-gold   { background: radial-gradient(circle at 50% 35%, rgba(255, 210, 122, .5), var(--panel-2) 70%); }
/* Tier badge on colony upgrades: numeral + colour, so it doesn't rely on colour alone */
.u-badge {
  position: absolute; right: -5px; bottom: -5px; min-width: 20px; height: 18px; padding: 0 4px;
  border-radius: 9px; font: 800 .62rem/18px "Nunito", sans-serif; color: #2a1810; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.tier-0 { background: #d9a679; }
.tier-1 { background: #cfd6de; }
.tier-2 { background: #ffd27a; }
.tier-3 { background: #a6e3bd; }
.tier-4 { background: #a9c8ff; }
.tier-5 { background: #d9b3ff; }
.tier-6 { background: linear-gradient(90deg, #ffb3b3, #ffe08a, #a6e3bd, #a9c8ff, #d9b3ff); }
.tooltip .t-sub { color: var(--muted); font-size: .8rem; margin-bottom: 4px; }.upgrade.affordable { border-color: var(--good); box-shadow: 0 0 12px rgba(166, 227, 189, .35); }
.upgrade:not(.affordable) { opacity: .5; }

/* ---------- Buildings ---------- */
.buy-mode { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--panel-2); }
.seg button { background: transparent; border: none; padding: 6px 14px; min-height: 38px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--accent); color: #3a2312; }

.building-list { display: flex; flex-direction: column; gap: 8px; }
.building {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 14px;
  padding: 8px 14px; text-align: left; width: 100%; min-height: 64px;
  transition: transform .15s var(--ease-out), opacity .2s, border-color .2s;
}
.building:hover { transform: translateX(3px); }
.building.pop { animation: rowPop .3s var(--ease-pop); }
@keyframes rowPop { 0% { transform: scale(.97); } }
.building .icon { font-size: 2rem; text-align: center; }
.building .name { font-weight: 800; }
.building .desc { font-size: .85rem; color: var(--muted); }
.building .cost { font-variant-numeric: tabular-nums; font-weight: 700; }
.building .owned { font-family: "Fredoka", sans-serif; font-size: 1.7rem; color: rgba(251, 239, 224, .35); text-align: right; }
/* State is shown by more than colour: unaffordable rows are dimmed too */
.building.affordable { border-color: var(--good); }
.building.affordable .cost { color: var(--good); }
.building:not(.affordable) { opacity: .7; }
.building:not(.affordable) .cost { color: var(--bad); }
.building.locked { filter: brightness(.55); }
/* Hovering with x10/x100/Max: the row shows the count and output it would have after buying */
.building.previewing .owned, .building.previewing .b-fps { color: var(--accent); }
.building.previewing.affordable .owned, .building.previewing.affordable .b-fps { color: var(--good); }
.building.previewing .b-fps { font-weight: 700; }
.building.previewing .milestone-bar > div { background: linear-gradient(90deg, var(--good), var(--gold)); }
.building.locked .name, .building.locked .desc { filter: blur(3px); }
.milestone-bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.milestone-bar > div { height: 100%; background: linear-gradient(90deg, var(--rose), var(--gold)); transition: width .3s var(--ease-out); }

/* ---------- Migration ---------- */
.migrate-box {
  background: rgba(255, 210, 122, .08); border: 1px dashed rgba(255, 210, 122, .45);
  border-radius: var(--radius); padding: 12px 16px; margin-top: 12px;
}
.migrate-box .big { color: var(--gold); font-size: 1.3rem; }
/* ---------- Heirloom Tree ---------- */
.tree-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tree-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.tree-branches { display: grid; grid-template-columns: 3fr 1fr 3fr; text-align: center; font-family: "Fredoka", sans-serif; color: var(--muted); margin: 6px 0 2px; font-size: .9rem; white-space: nowrap; }
@media (max-width: 520px) { .tree-branches { font-size: .78rem; } }
.tree-wrap {
  position: relative; border-radius: 16px; padding: 10px 4px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 210, 122, .10), transparent 60%),
    linear-gradient(90deg, rgba(232,115,90,.07) 0 42.8%, rgba(255,181,98,.07) 42.8% 57.2%, rgba(169,200,255,.07) 57.2% 100%);
  border: 1px dashed var(--border);
}
.tree-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.tree-lines line { stroke-width: 3; stroke-linecap: round; }
.tree-lines line.closed { stroke: rgba(255, 255, 255, .12); }
.tree-lines line.open { stroke: var(--cream); stroke-dasharray: 6 6; opacity: .7; }
.tree-lines line.learned { stroke: var(--gold); }
.tree-lines line.any { stroke-dasharray: 2 6; }
.tree { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 70px); align-items: center; justify-items: center; }
.node {
  position: relative; width: 52px; height: 52px; border-radius: 50%;
  background: var(--panel-2); border: 3px solid var(--border);
  display: grid; place-items: center; padding: 0;
  transition: transform .15s var(--ease-out), border-color .2s, box-shadow .2s;
}
.node .n-icon { font-size: 1.5rem; line-height: 1; }
.node .n-level {
  position: absolute; bottom: -9px; left: 50%; translate: -50% 0; min-width: 22px; padding: 0 5px; border-radius: 9px;
  font: 800 .62rem/16px "Nunito", sans-serif; background: var(--panel-3); color: var(--text); border: 1px solid var(--border);
}
.node .n-level:empty { display: none; }
.node:hover { transform: scale(1.08); }
.node.capstone { width: 60px; height: 60px; border-radius: 16px; rotate: 45deg; }
.node.capstone .n-icon, .node.capstone .n-level { rotate: -45deg; }
.node.capstone .n-level { bottom: -6px; left: auto; right: -12px; translate: 0 0; }
.node.state-locked { filter: grayscale(1) brightness(.6); }
.node.state-waiting { opacity: .85; }
.node.state-available { border-color: var(--good); box-shadow: 0 0 12px rgba(166, 227, 189, .45); }
.node.learned { border-color: var(--gold); background: radial-gradient(circle, rgba(255, 210, 122, .3), var(--panel-2) 70%); }
.node.learned .n-level { background: var(--gold); color: #2a1810; }
.node.state-maxed { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 210, 122, .5); }
.node.state-available.learned { border-color: var(--good); }
.node.selected { outline: 3px solid var(--text); outline-offset: 3px; }
.node.pop { animation: nodePop .4s var(--ease-pop); }
@keyframes nodePop { 0% { transform: scale(.7); } }
.tree-inspector {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border);
  min-height: 84px;
}
.tree-inspector .i-icon { font-size: 2.2rem; text-align: center; }
.tree-inspector .name { font-weight: 800; }
.tree-inspector .i-sub { color: var(--muted); font-size: .82rem; margin-bottom: 4px; }
.tree-inspector .i-req { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.tree-inspector .cap { background: var(--gold); color: #2a1810; border-radius: 8px; padding: 0 6px; font-size: .7rem; vertical-align: middle; }
@media (max-width: 520px) {
  .tree { grid-template-rows: repeat(6, 60px); }
  .node { width: 42px; height: 42px; border-width: 2px; }
  .node .n-icon { font-size: 1.2rem; }
  .node.capstone { width: 46px; height: 46px; }
  .tree-inspector { grid-template-columns: 40px 1fr; }
  .tree-inspector .btn { grid-column: 1 / -1; }
}

/* ---------- Workshop ---------- */
.research-list { display: flex; flex-direction: column; gap: 8px; }
.research {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 14px;
  padding: 8px 14px; text-align: left; width: 100%; min-height: 64px;
  transition: transform .15s var(--ease-out), opacity .2s, border-color .2s;
}
.research:not(:disabled):hover { transform: translateX(3px); }
.research .icon { font-size: 1.8rem; text-align: center; }
.research .name { font-weight: 800; }
.research .r-level { font-weight: 700; font-size: .8rem; color: var(--gold); margin-left: 4px; }
.research .desc { font-size: .85rem; color: var(--muted); }
.research .cost { font-weight: 700; font-variant-numeric: tabular-nums; }
.research.affordable { border-color: var(--good); }
.research.affordable .cost { color: var(--good); }
.research:not(.affordable):not(.maxed) .cost { color: var(--bad); }
.research:not(.affordable):not(.maxed) { opacity: .75; }
.research.maxed { border-color: var(--gold); cursor: default; }
.research.maxed .cost { color: var(--gold); }
.research.locked { opacity: .5; cursor: default; }
.research.locked .icon { filter: grayscale(1); }
.research.pop { animation: rowPop .3s var(--ease-pop); }
.r-bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.r-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .3s var(--ease-out); }

/* New upgrade categories */
.upgrade.kind-synergy   { background: radial-gradient(circle at 50% 35%, rgba(169, 200, 255, .35), var(--panel-2) 70%); }
.upgrade.kind-scrapbook { background: radial-gradient(circle at 50% 35%, rgba(217, 179, 255, .35), var(--panel-2) 70%); }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ach {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; opacity: .55;
  display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center;
}
.ach.done { opacity: 1; border-color: var(--gold); }
.a-icon { position: relative; font-size: 1.6rem; text-align: center; }
.ach:not(.done) .a-icon { filter: grayscale(1) brightness(.7); }
.a-badge {
  position: absolute; right: -6px; bottom: -4px; background: var(--gold); color: #2a1810;
  border-radius: 8px; padding: 0 4px; font: 800 .6rem/14px "Nunito", sans-serif;
}
.ach .name { font-weight: 800; }
.ach .desc { font-size: .82rem; color: var(--muted); }

/* ---------- Settings / stats ---------- */
.settings { display: grid; gap: 8px; }
.check, .range { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.range input[type=range] { flex: 1; max-width: 220px; accent-color: var(--accent); }
.range select { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.btn {
  background: var(--panel-3); border: 1px solid var(--border); border-radius: 999px; padding: 9px 18px; min-height: 42px; font-weight: 700;
  transition: transform .15s var(--ease-out), border-color .2s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #3a2312; border-color: var(--accent); }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.save-text { width: 100%; background: #2a1c1c; color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 8px; font-family: monospace; font-size: .8rem; }

/* ---------- Golden fish ---------- */
.golden-fish {
  position: fixed; z-index: 40; font-size: 3rem; background: none; border: none; padding: 6px;
  filter: drop-shadow(0 0 14px var(--gold)) sepia(1) saturate(4) hue-rotate(5deg);
  animation: swimIn 12s linear forwards, wiggle .7s ease-in-out infinite;
}
@keyframes swimIn { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wiggle { 50% { rotate: 12deg; } }

/* ---------- Toasts / modal / tooltip ---------- */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 16px; max-width: 320px;
  box-shadow: var(--shadow); animation: toastIn .45s var(--ease-pop);
}
.toast.out { animation: toastOut .35s var(--ease-out) forwards; }
.toast b { color: var(--gold); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(30%); opacity: 0; } }

.modal { position: fixed; inset: 0; z-index: 70; background: rgba(20, 10, 25, .6); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s; }
.modal-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 460px; width: 100%;
  box-shadow: var(--shadow); animation: popIn .3s var(--ease-pop);
}
.modal-card h2 { margin-top: 0; }
@keyframes fadeIn { from { opacity: 0; } }

.tooltip {
  position: fixed; z-index: 80; pointer-events: none; max-width: 290px;
  background: #2a1c1c; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: .88rem; box-shadow: var(--shadow);
}
.tooltip .t-name { font-weight: 800; }
.tooltip .t-cost { color: var(--gold); }
.tooltip hr { border: none; border-top: 1px dashed var(--border); }

/* ---------- Reduced motion (OS setting or in-game toggle) ---------- */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
}
html.reduce-motion .golden-fish, html.reduce-motion .waddler, html.reduce-motion .w-body { animation: none !important; }

/* =====================================================================
   v4 additions: canvas effects, penguin personality, scene life, new panels
   ===================================================================== */

#fxCanvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 55; }

.badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.season-badge {
  background: rgba(166, 227, 189, .14); border: 1px solid rgba(166, 227, 189, .5); color: var(--good);
  padding: 6px 12px; border-radius: 999px; font-weight: 700; cursor: help;
}
.fish-count.bump { animation: bump .25s var(--ease-pop); }
@keyframes bump { 0% { transform: scale(1.08); } }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
kbd {
  background: var(--panel-3); border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 6px;
  padding: 0 6px; font-family: inherit; font-size: .85rem;
}

/* ---------- The big penguin's personality ---------- */
#penguinSvg { overflow: visible; }
.big-penguin .p-pupil { transition: transform .18s var(--ease-out); }
.big-penguin .p-lid { transform: scaleY(0); transition: transform .08s linear; }
.big-penguin .p-lid-l { transform-origin: 78px 71px; }
.big-penguin .p-lid-r { transform-origin: 122px 71px; }
.big-penguin .p-happy { opacity: 0; }
.big-penguin .p-cheek { opacity: .75; transition: opacity .2s; }
.big-penguin .p-pom { transform-origin: 100px 32px; }
.big-penguin .p-tail { transform-origin: 126px 126px; }
.big-penguin .p-wing-l { transform-origin: 46px 92px; }
.big-penguin .p-wing-r { transform-origin: 154px 92px; }
.big-penguin .p-item { transform-origin: 164px 150px; }
.big-penguin .p-steam path { fill: none; stroke: rgba(255,255,255,.7); stroke-width: 2; stroke-linecap: round; opacity: 0; }
.big-penguin .p-zzz text { font: 700 16px Fredoka, sans-serif; fill: var(--cream); opacity: 0; }
.big-penguin .p-startle { font: 700 34px Fredoka, sans-serif; fill: var(--gold); opacity: 0; }
.big-penguin .p-all { transform-origin: 100px 210px; }

.big-penguin.blink .p-lid { transform: scaleY(1); }
.big-penguin.happy .p-white, .big-penguin.happy .p-pupils { opacity: 0; }
.big-penguin.happy .p-happy { opacity: 1; }
.big-penguin.happy .p-cheek, .big-penguin.excited .p-cheek { opacity: 1; }
.big-penguin.spring .p-pom { animation: springy .9s var(--ease-out); }
.big-penguin.spring .p-tail { animation: springy .9s var(--ease-out) .04s; }
@keyframes springy { 15% { transform: rotate(-14deg); } 35% { transform: rotate(9deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
.big-penguin.excited { filter: drop-shadow(0 0 16px rgba(255, 159, 177, .55)); }
.big-penguin.surprised .p-pupil { scale: 1.15; }

/* Dozing off when left alone */
.big-penguin.sleeping { animation-duration: 6s; }
.big-penguin.sleeping .p-lid { transform: scaleY(.92); }
.big-penguin.sleeping .p-zzz text { animation: zzz 3s ease-in-out infinite; }
.big-penguin.sleeping .p-zzz text:nth-child(2) { animation-delay: 1s; }
.big-penguin.sleeping .p-zzz text:nth-child(3) { animation-delay: 2s; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -14px); } }
.big-penguin.startle .p-startle { animation: startle .7s var(--ease-pop); }
.big-penguin.startle .p-all { animation: hop .5s var(--ease-pop); }
@keyframes startle { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; } }
@keyframes hop { 40% { transform: translateY(-12px); } }

/* Idle moments */
.big-penguin.act-wave .p-wing-r { animation: wave 1.4s ease-in-out; }
@keyframes wave { 20%, 60% { transform: rotate(-38deg); } 40%, 80% { transform: rotate(-22deg); } }
.big-penguin.act-wiggle .p-all { animation: wiggle-body 1.2s ease-in-out; }
@keyframes wiggle-body { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.big-penguin.act-look .p-pupil { animation: look 1.8s ease-in-out; }
@keyframes look { 25% { transform: translate(-3px, 0); } 65% { transform: translate(3px, -1px); } }
.big-penguin.act-sip .p-item { animation: sip 2.2s var(--ease-out); }
.big-penguin.act-sip .p-steam path { animation: steam 2.2s ease-out; }
.big-penguin.act-sip .p-lid { transform: scaleY(.6); transition-duration: .3s; }
@keyframes sip { 25%, 70% { transform: translate(-58px, -38px) rotate(-30deg); } }
@keyframes steam { 10% { opacity: .9; } 60% { opacity: 0; transform: translateY(-10px); } }

/* ---------- Colony scene: night, stars, residents, arrivals, seasons ---------- */
.colony .stars {
  position: absolute; inset: 0 0 45% 0; opacity: .35; transition: opacity 2s;
  background-image: radial-gradient(1px 1px at 12% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 45%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 52% 18%, #fff, transparent), radial-gradient(1px 1px at 70% 38%, #fff, transparent),
    radial-gradient(1px 1px at 86% 14%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 30%, #fff, transparent);
}
.colony.night { background: var(--sky-night); }
.colony.night .stars { opacity: 1; }
.colony.night .ground, .colony.night .land-front { filter: brightness(.8) saturate(.85); }
.colony.night .land-back { filter: brightness(.65); }
.colony.night .fire .glow { opacity: 1; transform: scale(1.3); }
.colony.night .prop.igloo::after { box-shadow: 0 0 16px rgba(255, 181, 98, 1); }
.colony .prop.rock { animation: popIn .5s var(--ease-pop), rock 3.5s ease-in-out infinite; }
@keyframes rock { 50% { rotate: 6deg; translate: 0 2px; } }
.colony .prop.breach { animation: popIn .5s var(--ease-pop), breach 9s ease-in-out infinite; }
@keyframes breach { 0%, 80%, 100% { translate: 0 0; } 88% { translate: 0 -18px; rotate: -15deg; } }
.colony .prop.glimmer { animation: popIn .5s var(--ease-pop), glimmer 4s ease-in-out infinite; }
@keyframes glimmer { 50% { filter: drop-shadow(0 0 8px #d9b3ff); } }
.waddler.huddle { left: 44% !important; bottom: 10px !important; }
.waddler.huddle:nth-child(6n) { left: 54% !important; }
/* ---------- Shores: each has its own sky, ground, landmarks and weather ---------- */
.land { position: absolute; inset: 0; pointer-events: none; }
.land-over { z-index: 1; }
.land .decor.glimmer { animation: glimmer 4s ease-in-out infinite; }
/* Shapes, coloured by each shore's --land / --land-hi */
.berg, .peak, .hill, .crag { position: absolute; bottom: 36%; }
.berg { background: linear-gradient(160deg, var(--land-hi), var(--land)); clip-path: polygon(0 100%, 18% 40%, 34% 52%, 52% 0, 70% 45%, 84% 30%, 100% 100%); }
.berg.small { opacity: .7; }
.peak { background: linear-gradient(170deg, var(--land-hi) 0 22%, var(--land) 23%); clip-path: polygon(0 100%, 30% 12%, 42% 30%, 58% 0, 76% 38%, 100% 100%); }
.hill { background: var(--land); border-radius: 50% 50% 0 0 / 100% 100% 0 0; bottom: 34%; }
.crag { background: linear-gradient(180deg, var(--land-hi), var(--land)); clip-path: polygon(0 100%, 8% 50%, 20% 40%, 28% 10%, 44% 20%, 52% 0, 66% 30%, 80% 26%, 92% 60%, 100% 100%); }
.pine { position: absolute; bottom: 36%; line-height: 1; filter: saturate(.7) brightness(.9); }
.pine.far { bottom: 44%; opacity: .55; filter: saturate(.4) brightness(.7); }
.sun {
  position: absolute; right: 14%; top: 16%; width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle, #fff3c4 0 45%, #ffd27a 60%, rgba(255, 181, 98, 0) 72%);
  box-shadow: 0 0 40px 14px rgba(255, 196, 110, .45); animation: sunPulse 6s ease-in-out infinite alternate;
}
@keyframes sunPulse { to { box-shadow: 0 0 52px 20px rgba(255, 196, 110, .6); } }
.colony.night .sun { background: radial-gradient(circle at 35% 35%, #fbf6e6 0 50%, rgba(251, 246, 230, 0) 68%); box-shadow: 0 0 22px 6px rgba(240, 235, 210, .25); animation: none; }
/* Open water on the horizon, behind the beach */
.sea { position: absolute; left: 0; right: 0; bottom: 28%; height: 22%; overflow: hidden;
  background: linear-gradient(180deg, #4fb3bf, #2a7f96); }
.harbour-water { background: linear-gradient(180deg, #3f5f86, #2a4266); }
.colony.night .sea { background: linear-gradient(180deg, #2a5f78, #173a52); }
.colony.night .harbour-water { background: linear-gradient(180deg, #1e2c48, #141d33); }
.moored { position: absolute; bottom: 44%; font-size: 1rem; animation: rock 3.5s ease-in-out infinite; }
.waves { position: absolute; left: -20px; right: -20px; top: 4px; height: 8px; animation: waves 3s ease-in-out infinite alternate;
  background: radial-gradient(circle at 10px -2px, transparent 7px, rgba(255, 255, 255, .55) 8px, transparent 9px) 0 0 / 20px 8px repeat-x; }
@keyframes waves { to { translate: 14px 2px; } }
.fog { position: absolute; inset: 20% -30% 0 -30%; opacity: .55; animation: fog 9s linear infinite;
  background: radial-gradient(ellipse 30% 40% at 20% 60%, rgba(235, 242, 255, .6), transparent 70%),
              radial-gradient(ellipse 25% 35% at 65% 40%, rgba(235, 242, 255, .5), transparent 70%); }
.fog.two { animation-duration: 14s; animation-delay: -6s; opacity: .4; top: 40%; }
@keyframes fog { from { translate: -18% 0; } to { translate: 18% 0; } }
.town { position: absolute; left: 2%; bottom: 49%; display: flex; align-items: flex-end; gap: 3px; }
.town i { width: 16px; background: var(--land); border-radius: 2px 2px 0 0;
  background-image: radial-gradient(circle at 50% 30%, #ffd27a 0 1.5px, transparent 2px); background-size: 8px 10px; }
.lighthouse { position: absolute; right: 9%; bottom: 40%; width: 14px; height: 58px;
  background: repeating-linear-gradient(180deg, #f3ecf6 0 10px, #e8735a 10px 20px); clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%); }
.lighthouse .beam { position: absolute; left: -40px; top: -2px; width: 94px; height: 10px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 230, 160, .8), transparent 70%); animation: beam 4s ease-in-out infinite; }
@keyframes beam { 0%, 100% { opacity: .2; transform: scaleX(.3); } 50% { opacity: 1; transform: scaleX(1); } }

.colony[data-shore="krillbay"] {
  --sky: linear-gradient(180deg, #2a2350 0%, #5a3f6e 55%, #b06a7c 100%);
  --sky-night: linear-gradient(180deg, #0b1024 0%, #1b2340 60%, #263252 100%);
  --ground: linear-gradient(180deg, #efe3d2, #d6c3a8); --land: #6d5a86; --land-hi: #cbbfe0;
}
.colony[data-shore="sunnycove"] {
  --sky: linear-gradient(180deg, #3b2d5c 0%, #c4677a 60%, #ffb562 100%);
  --sky-night: linear-gradient(180deg, #120d26 0%, #2b1d3c 60%, #4a2c3e 100%);
  --ground: linear-gradient(180deg, #fff4e0, #f1d9b0); --land: #b8746a; --land-hi: #ffd2a8;
}
.colony[data-shore="blizzard"] {
  --sky: linear-gradient(180deg, #2b3142 0%, #4a5466 60%, #7a8698 100%);
  --sky-night: linear-gradient(180deg, #11141d 0%, #222a38 60%, #3a4454 100%);
  --ground: linear-gradient(180deg, #f2f6fa, #cdd7e2); --land: #56627a; --land-hi: #e8eef6;
}
.colony[data-shore="blizzard"] .stars, .colony[data-shore="blizzard"] .aurora { display: none; }   /* nothing gets through the clouds */
.colony[data-shore="aurorafields"] {
  --sky: linear-gradient(180deg, #070b1f 0%, #14183a 60%, #262c56 100%);
  --sky-night: linear-gradient(180deg, #03050f 0%, #0b0f28 60%, #181d3e 100%);
  --ground: linear-gradient(180deg, #d4efe8, #a8cfd2); --land: #1e2a4a; --land-hi: #4c6a8a;
}
.colony[data-shore="aurorafields"] .stars { opacity: 1; }
.colony[data-shore="aurorafields"] .aurora {
  inset: 0 0 35% 0;
  background: radial-gradient(ellipse 60% 55% at 35% 0%, rgba(120, 240, 190, .5), transparent 70%),
              radial-gradient(ellipse 45% 50% at 75% 10%, rgba(190, 150, 255, .45), transparent 70%);
}
.colony[data-shore="quiethollow"] {
  --sky: linear-gradient(180deg, #1a2633 0%, #2c4250 60%, #4a6a6e 100%);
  --sky-night: linear-gradient(180deg, #0a1016 0%, #16222c 60%, #24363c 100%);
  --ground: linear-gradient(180deg, #edf3ec, #c7d8ca); --land: #2a4440; --land-hi: #8fb3a4;
}
.colony[data-shore="harbour"] {
  --sky: linear-gradient(180deg, #1b2238 0%, #2f3a5c 60%, #5a5f7e 100%);
  --sky-night: linear-gradient(180deg, #080b16 0%, #141a2e 60%, #262c44 100%);
  --ground: linear-gradient(180deg, #dcd8e6, #b7b0c8); --land: #2a2f48; --land-hi: #6a7090;
}
.colony[data-shore="rookery"] {
  --sky: linear-gradient(180deg, #2a1f2e 0%, #4a3346 60%, #7a5862 100%);
  --sky-night: linear-gradient(180deg, #100b12 0%, #22171f 60%, #3a2a30 100%);
  --ground: linear-gradient(180deg, #ece2dc, #cbbab0); --land: #4e3a44; --land-hi: #a8908e;
}

/* Residents chatting */
.chat-bubble {
  position: absolute; z-index: 3; translate: -50% 0; max-width: 140px; width: max-content;
  padding: 3px 8px; border-radius: 10px; background: #fffaf2; color: #3a2a30;
  font: 700 .68rem/1.25 "Nunito", sans-serif; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  animation: bubbleIn .25s var(--ease-pop); pointer-events: none;
}
.chat-bubble::after {
  content: ""; position: absolute; top: 100%; left: calc(50% + var(--tail, 0px)); translate: -50% 0;
  border: 5px solid transparent; border-top-color: #fffaf2; border-bottom: 0;
}
@keyframes bubbleIn { from { opacity: 0; scale: .6; transform-origin: 50% 100%; } }
.waddler.talking .w-body { animation: chat .32s ease-in-out infinite alternate; }
@keyframes chat { to { transform: translateY(-2px) rotate(-3deg); } }

/* Residents at work: fishing at the hole, carrying fish to the basket by the fire */
.work { position: absolute; inset: 0; pointer-events: none; }
.ice-hole {
  position: absolute; left: 17%; bottom: 34px; width: 26px; height: 8px; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #1d3550, #2f5878); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
}
.basket { position: absolute; z-index: 2; left: 37%; bottom: 3px; translate: -50% 0; font-size: 1.35rem; line-height: 1; }   /* in front of the residents */
.basket.bump { animation: bump .35s var(--ease-pop); }
@keyframes bump { 40% { transform: scale(1.15, .88); } }
.basket-body { position: relative; z-index: 1; display: inline-block; }
.pile { position: absolute; left: 50%; bottom: 55%; width: 0; }
.pile span { position: absolute; font-size: .62rem; translate: -50% 0; animation: popIn .35s var(--ease-pop); }
.w-held { position: absolute; left: -7px; bottom: 3px; font-size: .5em; pointer-events: none; }
.w-held[data-item="rod"] { left: -12px; bottom: 7px; font-size: .62em; scale: -1 1; transform-origin: 50% 100%; }
.waddler.fishing .w-held { animation: rod 1.6s ease-in-out infinite; }
@keyframes rod { 50% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.waddler { transition: opacity .35s; }
.waddler.inside { opacity: 0; }
.fly-fish { position: absolute; left: 0; top: 0; z-index: 3; font-size: .8rem; margin: -.5em 0 0 -.5em; pointer-events: none; }
.catch-pop {
  position: absolute; z-index: 3; translate: -50% 0; font: 800 .72rem "Nunito", sans-serif; color: #ffe08a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7); animation: catchPop 1.6s var(--ease-out) forwards; pointer-events: none; white-space: nowrap;
}
.waddlers { pointer-events: none; }   /* so hovering reaches the props behind */
.landed-fish {
  position: absolute; z-index: 2; font-size: .7rem; translate: -50% -50%; pointer-events: none;
  animation: flop .3s ease-in-out 3 alternate, fadeAway .5s 1.3s forwards;
}
@keyframes flop { to { rotate: 25deg; translate: -50% -60%; } }
@keyframes fadeAway { to { opacity: 0; } }
.puff {
  position: absolute; z-index: 3; font-size: .75rem; translate: -50% 0; pointer-events: none;
  animation: catchPop 1.4s var(--ease-out) forwards;
}
@keyframes catchPop { from { opacity: 0; transform: translateY(4px); } 15% { opacity: 1; } 70% { opacity: 1; } to { opacity: 0; transform: translateY(-22px); } }

.decor-layer { position: absolute; inset: 0; pointer-events: none; }
.decor { position: absolute; font-size: 1.3rem; }
.decor.bunting { top: 18px; left: 0; right: 0; text-align: center; letter-spacing: 12px; font-size: 1rem; }
.shore-pill {
  position: absolute; left: 8px; bottom: 6px; z-index: 2; font-size: .75rem; font-weight: 700;
  background: rgba(40, 26, 30, .7); color: var(--cream); padding: 2px 8px; border-radius: 999px;
}
.arrival { position: absolute; left: -40px; font-size: 22px; animation: arrive 3.2s var(--ease-out) forwards; z-index: 1; }
.arrival small { font-size: 12px; vertical-align: top; }
@keyframes arrive { 0% { left: -40px; } 70% { left: 38%; opacity: 1; } 100% { left: 42%; opacity: 0; } }

/* ---------- Touch info sheet ---------- */
.info-sheet {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 65;
  width: min(520px, calc(100vw - 24px)); background: var(--panel-2); border: 1px solid var(--border); border-radius: 18px;
  padding: 14px 16px 12px; box-shadow: var(--shadow); animation: sheetUp .3s var(--ease-pop);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.info-sheet .sheet-body { margin-bottom: 10px; font-size: .95rem; padding-right: 28px; }
.info-sheet .btn { width: 100%; }
.info-sheet .sheet-close { position: absolute; right: 8px; top: 6px; background: none; border: none; font-size: 1.1rem; padding: 8px; color: var(--muted); }
.info-sheet hr { border: none; border-top: 1px dashed var(--border); }
.info-sheet .t-name { font-weight: 800; }
.info-sheet .t-sub { color: var(--muted); font-size: .8rem; }
.info-sheet .t-cost { color: var(--gold); }
.sheet-selected { outline: 3px solid var(--text); outline-offset: 2px; }

/* ---------- Shores ---------- */
.shore-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.shore {
  display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; text-align: left;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 14px; padding: 10px 12px;
}
.shore .sh-icon { font-size: 1.7rem; text-align: center; }
.shore .name { font-weight: 800; }
.shore .desc { font-size: .84rem; color: var(--muted); }
.shore.next { border-color: var(--good); }
.shore.here { background: radial-gradient(circle at 10% 50%, rgba(255, 210, 122, .18), var(--panel-2) 60%); }
.shore.locked { opacity: .5; cursor: default; }
.tag { font-size: .66rem; font-weight: 800; border-radius: 8px; padding: 1px 6px; margin-left: 4px; background: var(--gold); color: #2a1810; vertical-align: middle; }
.tag.next { background: var(--good); }
.shore-pick { border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; margin: 8px 0 0; }
.shore-pick legend { font-weight: 800; padding: 0 4px; }
.shore-radio { display: block; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.shore-radio:hover { background: rgba(255,255,255,.05); }
.shore-radio input { accent-color: var(--accent); margin-right: 6px; }

/* ---------- Helpers ---------- */
.helper-list { display: flex; flex-direction: column; gap: 8px; }
.helper {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 14px; padding: 10px 12px;
}
.helper .hp-icon { font-size: 1.8rem; text-align: center; }
.helper .name { font-weight: 800; }
.helper .desc { font-size: .84rem; color: var(--muted); }
.helper.hired { border-color: rgba(255, 210, 122, .5); }
.helper.on { border-color: var(--good); }
.helper.on .hp-icon { animation: busy 1.6s ease-in-out infinite; }
@keyframes busy { 50% { transform: translateY(-3px) rotate(-6deg); } }
.btn.toggle { min-width: 64px; }
.btn.toggle.on { background: var(--good); color: #10301e; border-color: var(--good); }
@media (max-width: 520px) { .helper { grid-template-columns: 36px 1fr; } .helper .btn { grid-column: 1 / -1; } }

/* ---------- Mailbox ---------- */
.letter-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.letter {
  position: relative; background: #f8ecd9; color: #4a3330; border-radius: 6px 6px 14px 14px; padding: 12px 14px 10px;
  box-shadow: var(--shadow); border-top: 6px solid var(--rose);
  background-image: repeating-linear-gradient(0deg, transparent 0 23px, rgba(74, 51, 48, .08) 23px 24px);
}
.letter .l-from { font-size: .85rem; }
.letter .l-text { margin: 6px 0 8px; font-size: .95rem; min-height: 2.6em; }
.letter .l-bar { height: 6px; border-radius: 3px; background: rgba(74, 51, 48, .15); overflow: hidden; }
.letter .l-bar > div { height: 100%; background: var(--rose); transition: width .3s var(--ease-out); }
.letter .l-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .85rem; gap: 6px; }
.letter .btn { color: var(--text); }
.letter .btn.primary { color: #3a2312; }
.letter .muted { color: #7a625a; }
.letter.ready { animation: wiggle-letter 2.4s ease-in-out infinite; }
@keyframes wiggle-letter { 0%, 85%, 100% { rotate: 0deg; } 90% { rotate: -1.5deg; } 95% { rotate: 1.5deg; } }
.letter.claimed { opacity: .65; }
.letter-bonus { margin-top: 10px; }

/* ---------- Wardrobe ---------- */
.ward-slot h3 { margin: 10px 0 6px; font-size: .95rem; color: var(--muted); }
.ward-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ward {
  display: grid; justify-items: center; gap: 2px; width: 92px; padding: 8px 4px; text-align: center;
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 14px; font-size: .74rem;
}
.ward .w-swatch { font-size: 1.6rem; line-height: 1.2; min-height: 1.9rem; display: grid; place-items: center; }
.ward .swatch { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); }
.ward .w-lock { color: var(--muted); font-size: .66rem; }
.ward.worn { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 210, 122, .35); }
.ward.locked { opacity: .55; cursor: default; }

/* ---------- Stats graph ---------- */
.stats-graph svg { width: 100%; height: 140px; display: block; background: var(--panel-2); border-radius: 12px; border: 1px solid var(--border); }
.stats-graph .g-line { fill: none; stroke: var(--gold); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.stats-graph .g-fill { fill: rgba(255, 210, 122, .15); stroke: none; }
.stats-graph .g-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin: 4px 2px 10px; gap: 8px; }
.hotkeys dt { white-space: nowrap; }

/* Memory toast: a little polaroid that develops */
.polaroid { display: inline-block; background: #fff; padding: 2px 3px 6px; border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.3); animation: develop 1.2s ease-out; }
@keyframes develop { from { filter: sepia(1) brightness(1.8) blur(1px); rotate: -8deg; } }

html.reduce-motion .arrival { display: none; }
html.reduce-motion .big-penguin.sleeping .p-zzz text { opacity: .8; }
