/* Happy Farm UI — cozy mobile-farm look: wooden frames, ribbon titles, candy buttons, paper cards. */

:root {
  --paper: #fff6e0;
  --paper-2: #fde9bf;
  --paper-3: #f6d99a;
  --wood-light: #d9a15e;
  --wood: #b06e33;
  --wood-dark: #7a4418;
  --wood-ink: #4e2a0c;
  --ink: #4a2e14;
  --muted: #8c6a45;
  --green: #6cc334;
  --green-top: #8fe04d;
  --green-dark: #3e8a16;
  --gold: #ffc93a;
  --gold-top: #ffe27a;
  --gold-dark: #cf8a0c;
  --red: #e2483a;
  --red-dark: #a82a1f;
  --sky: #4fb4ea;
  --sky-dark: #2479b3;
  --hud-dark: rgba(46, 30, 14, 0.62);
  --shadow: 0 6px 0 rgba(78, 42, 12, 0.35), 0 16px 34px rgba(0, 0, 0, 0.28);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --outline: 0 2px 0 var(--wood-ink), 2px 0 0 var(--wood-ink), -2px 0 0 var(--wood-ink), 0 -2px 0 var(--wood-ink),
    1.5px 1.5px 0 var(--wood-ink), -1.5px 1.5px 0 var(--wood-ink), 1.5px -1.5px 0 var(--wood-ink), -1.5px -1.5px 0 var(--wood-ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fd8f5;
  font-family: var(--font);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}

#game { display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; }

#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #c9ecff, #8fcdf0);
}
.loading-card { width: min(320px, 80vw); text-align: center; }
.loading-title { font: 700 44px var(--display); color: #fff; text-shadow: var(--outline); margin-bottom: 14px; }
.loading-bar { height: 18px; border-radius: 999px; background: #5b3a1c; overflow: hidden; box-shadow: inset 0 2px 3px rgba(0,0,0,.45), 0 0 0 3px #fff; }
#loading-fill { height: 100%; width: 0; background: linear-gradient(var(--green-top), var(--green)); border-radius: 999px; transition: width .2s; }
.loading-text { margin-top: 10px; font-weight: 800; color: var(--wood-ink); }

#fade {
  position: fixed; inset: 0; background: #120c06; opacity: 0; pointer-events: none;
  transition: opacity 0.45s ease; z-index: 30;
}
#fade.on { opacity: 1; pointer-events: auto; }

button { font-family: inherit; }

/* ======================================================================
   HUD
   ====================================================================== */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud[hidden] { display: none; }
#hud button { pointer-events: auto; }

/* --- profile card (top left) --- */
.hud-left { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; width: min(330px, 44vw); }
.profile {
  display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px;
  background: linear-gradient(#fffaf0, var(--paper-2)); border-radius: 999px;
  box-shadow: 0 3px 0 rgba(78, 42, 12, 0.35), 0 6px 16px rgba(0, 0, 0, 0.18);
}
.avatar {
  flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #bfe8ff, #6bbbe8);
  border: 4px solid var(--gold); box-shadow: 0 0 0 3px var(--gold-dark), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}
.avatar span { font-size: 34px; line-height: 1; transform: translateY(2px); }
.profile-main { flex: 1; min-width: 0; }
.profile-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.lv { font: 700 21px var(--display); color: var(--wood-ink); }
.pname { font-weight: 800; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xpbar {
  position: relative; height: 20px; border-radius: 999px; overflow: hidden;
  background: #5b3a1c; box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.45);
}
#xp-fill {
  height: 100%; width: 0; border-radius: 999px; transition: width .6s cubic-bezier(.2, .8, .2, 1);
  background: linear-gradient(#7fd4ff, #2f9be0 60%, #2280c4); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
#xp-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 12.5px var(--display); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums;
}

/* --- resources + clock (top right) --- */
.hud-top { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 10px; }
.res-pill {
  display: flex; align-items: center; gap: 8px; padding: 4px 18px 4px 4px; min-width: 128px;
  background: var(--hud-dark); border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.25);
  color: #fff; font: 700 20px var(--display); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.coin-dot {
  display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3a6 0 20%, #ffd23b 35%, #e8a212 75%);
  box-shadow: inset 0 0 0 2px #c07c08, 0 1px 0 rgba(0, 0, 0, 0.25); vertical-align: -3px;
}
.coin-dot.big { width: 34px; height: 34px; box-shadow: inset 0 0 0 3px #c07c08, 0 2px 0 rgba(0, 0, 0, 0.3); position: relative; }
.coin-dot.big::after { content: "★"; position: absolute; inset: 0; display: grid; place-items: center; color: #c98300; font-size: 16px; text-shadow: none; }
.clock-card {
  display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 16px;
  background: linear-gradient(#6cc6f3, #3a9ad8); border: 2px solid rgba(255, 255, 255, 0.55);
  color: #fff; box-shadow: 0 3px 0 var(--sky-dark), 0 6px 14px rgba(0, 0, 0, 0.18);
}
.wx { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25)); width: 34px; text-align: center; }
#hud-time { font: 700 19px var(--display); line-height: 1.05; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); font-variant-numeric: tabular-nums; }
#hud-date { font-weight: 800; font-size: 11.5px; opacity: 0.95; }

.round-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; font-size: 22px;
  background: linear-gradient(#69b8e8, #2e86c5); box-shadow: 0 3px 0 var(--sky-dark), 0 6px 12px rgba(0, 0, 0, 0.2);
  display: grid; place-items: center; transition: transform .08s;
}
.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sky-dark); }

/* --- side buttons (right) --- */
.hud-side { position: absolute; right: 12px; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.side-btn {
  width: 70px; padding: 6px 4px 5px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(122, 68, 24, 0.55), 0 8px 14px rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font: 700 12.5px var(--display); color: var(--wood-ink); transition: transform .08s;
}
.side-btn:hover { transform: translateY(-2px); }
.side-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(122, 68, 24, 0.55); }
.side-ico { font-size: 28px; line-height: 1.1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.15)); }

/* --- bottom: prompt, hotbar --- */
.hud-bottom {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#hotbar {
  display: flex; gap: 6px; padding: 8px 10px; pointer-events: auto; border-radius: 20px;
  background: linear-gradient(var(--wood-light), var(--wood) 55%, #955a26);
  border: 3px solid var(--wood-dark); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), var(--shadow);
}
#held-name {
  font: 700 15px var(--display); color: #fff; min-height: 19px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 6px rgba(0, 0, 0, 0.5);
}
#prompt {
  background: var(--hud-dark); color: #fff; padding: 5px 14px 5px 6px; border-radius: 999px;
  font-weight: 800; font-size: 14px; border: 2px solid rgba(255, 255, 255, 0.25);
}
#prompt[hidden] { display: none; }
kbd {
  display: inline-block; min-width: 24px; padding: 2px 8px; margin-right: 3px; border-radius: 999px;
  background: linear-gradient(var(--gold-top), var(--gold)); color: var(--wood-ink); font: 700 12px var(--display); text-align: center;
  box-shadow: 0 2px 0 var(--gold-dark);
}
#controls-hint { font-size: 11.5px; font-weight: 700; color: #fff; opacity: 0.9; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }

/* --- round action buttons (bottom right) --- */
.hud-actions { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: flex-end; gap: 10px; }
.act-btn {
  width: 62px; height: 62px; border-radius: 50%; cursor: pointer; font-size: 28px;
  background: radial-gradient(circle at 50% 30%, #fffdf6, var(--paper-2) 70%, var(--paper-3));
  border: 4px solid #fff; box-shadow: 0 0 0 3px var(--wood-light), 0 5px 0 3px var(--wood), 0 10px 18px rgba(0, 0, 0, 0.25);
  display: grid; place-items: center; transition: transform .08s;
}
.act-btn.big { width: 80px; height: 80px; }
.act-btn.big .icon { width: 46px; height: 46px; }
.act-btn.big .icon .emoji { font-size: 36px; }
.act-btn:active { transform: translateY(3px); }

/* --- toasts & floating text --- */
#toasts {
  position: absolute; bottom: 168px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.toast {
  background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid #fff; border-radius: 14px;
  padding: 8px 16px; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 var(--wood-light), 0 6px 14px rgba(0, 0, 0, 0.22);
  animation: toast-in 0.2s ease, toast-out 0.4s ease 2.2s forwards; max-width: min(90vw, 520px); text-align: center;
}
.toast.warn { box-shadow: 0 3px 0 var(--gold-dark), 0 6px 14px rgba(0, 0, 0, 0.22); background: linear-gradient(#fff8d8, #ffe79a); }
.toast.error { color: var(--red-dark); box-shadow: 0 3px 0 var(--red), 0 6px 14px rgba(0, 0, 0, 0.22); }
.toast.bump { animation: toast-bump 0.25s ease, toast-out 0.4s ease 2.2s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-bump { 50% { transform: scale(1.06); } }

.float-text {
  position: fixed; transform: translate(-50%, -50%); pointer-events: none; z-index: 12;
  font: 700 19px var(--display); color: #fff; text-shadow: 0 2px 0 var(--green-dark), 0 0 6px rgba(0, 0, 0, 0.4);
  animation: float-up 1.1s ease-out forwards;
}
@keyframes float-up { to { opacity: 0; transform: translate(-50%, -140%); } }
.float-text.xp { color: #fff6a8; font-size: 16px; text-shadow: 0 2px 0 #8a6d00, 0 0 6px rgba(0,0,0,.4); }
.float-text.combo { color: #ffd23f; font-size: 28px; text-shadow: 0 3px 0 #b5471f, 0 0 8px rgba(0,0,0,.35); animation: combo-pop .9s ease-out forwards; }
@keyframes combo-pop {
  0% { transform: translate(-50%, -50%) scale(.4); }
  25% { transform: translate(-50%, -60%) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}
.coin { position: fixed; left: 0; top: 0; z-index: 60; font-size: 22px; pointer-events: none; will-change: transform; }
.item-fly {
  position: fixed; left: 0; top: 0; z-index: 60; width: 44px; height: 44px; display: grid; place-items: center; pointer-events: none; will-change: transform;
  background: radial-gradient(circle, #fffaf0 55%, rgba(255, 250, 240, 0.85) 70%, rgba(255, 250, 240, 0) 72%); border-radius: 50%;
  filter: drop-shadow(0 2px 3px rgba(60, 40, 10, 0.35));
}
.item-fly .icon { width: 32px; height: 32px; font-size: 26px; }
.float-text.loot { color: #fff; font-size: 16px; text-shadow: 0 2px 0 var(--green-dark), 0 0 6px rgba(0,0,0,.4); }
.chip.bump, .bump { animation: chip-bump .35s ease; }
@keyframes chip-bump { 40% { transform: scale(1.15); } }

/* --- order tracker + hint (under the profile) --- */
#tracker:empty { display: none; }
#tracker {
  background: rgba(255, 250, 238, 0.94); border-radius: 16px; padding: 7px 10px 8px;
  box-shadow: 0 3px 0 rgba(78, 42, 12, 0.3), 0 6px 14px rgba(0, 0, 0, 0.14);
  font-size: 13px; display: flex; flex-direction: column; gap: 5px;
}
.track-head { display: flex; align-items: center; gap: 6px; font: 700 13px var(--display); color: var(--wood); text-transform: uppercase; letter-spacing: .05em; }
#tracker { pointer-events: auto; cursor: pointer; }
#tracker .toggle { margin-left: auto; text-transform: none; letter-spacing: 0; }
.track-sum { font-size: 11.5px; font-weight: 800; color: var(--red); text-transform: none; letter-spacing: 0; }
.track-sum.ready { color: var(--green-dark); }
.track-more { text-align: center; font-weight: 800; }
/* the farmer is right under the left column's cards: see through them (still clickable; full again under the mouse) */
#hud .hud-left.see-through { opacity: .45; }
#hud .hud-left.see-through:hover { opacity: 1; }
.track { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; font-weight: 800; }
.track .who { font-size: 18px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); }
.what { min-width: 0; }
.what-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar { height: 6px; border-radius: 999px; background: #ecd8ae; margin-top: 3px; overflow: hidden; }
.mini-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9be35d, var(--green)); transition: width .4s; }
.track .due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.track.rush .due { color: var(--red); }
.track.done .what-text { color: var(--green-dark); }
.track.done .due { color: #fff; background: var(--green); padding: 2px 8px; border-radius: 999px; box-shadow: 0 2px 0 var(--green-dark); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
#hint {
  background: var(--hud-dark); color: #fff; font-weight: 800; font-size: 13px; padding: 8px 12px; border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.22); animation: hint-in .4s ease;
}
#hint[hidden] { display: none; }
@keyframes hint-in { from { opacity: 0; transform: translateY(-6px); } }

/* ======================================================================
   Slots & icons
   ====================================================================== */

.slot {
  position: relative; width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid #f0cf94;
  box-shadow: inset 0 -3px 0 rgba(176, 110, 51, 0.25);
  display: grid; place-items: center; cursor: pointer; pointer-events: auto; transition: transform .1s, box-shadow .1s;
}
.slot:hover { transform: translateY(-1px); }
.slot.selected {
  border-color: #fff; transform: translateY(-5px);
  box-shadow: 0 0 0 3px var(--gold), 0 0 16px 2px rgba(255, 214, 72, 0.85), inset 0 -3px 0 rgba(176, 110, 51, 0.25);
}
.slot.dragging { opacity: 0.35; }
.slot.disabled, .slot.dim { opacity: 0.35; }
.slot.disabled { cursor: not-allowed; }
.slot .qty {
  position: absolute; right: 3px; bottom: 0; font: 700 14px var(--display); color: #fff;
  text-shadow: var(--outline);
}
.slot .key {
  position: absolute; left: -4px; top: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  font: 700 10.5px/17px var(--display); text-align: center; color: #fff; background: var(--wood-dark);
}
.slot.hot { border-color: #ffab5c; }
.slot .hot-badge { position: absolute; top: -9px; right: -7px; font-size: 14px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }

.icon { width: 38px; height: 38px; display: grid; place-items: center; pointer-events: none; }
.icon svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.15)); }
.icon .emoji { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.12)); }
.icon.packet {
  background: linear-gradient(#fbe9c2, #e6c182); border: 2px solid #b08a4f; border-radius: 6px 6px 4px 4px;
  width: 32px; height: 38px; position: relative; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.icon.packet::before {
  content: ""; position: absolute; top: 4px; left: 3px; right: 3px; height: 2px; background: #b08a4f; opacity: 0.6;
}
.packet-art { width: 23px; height: 23px; display: grid; place-items: center; margin-top: 6px; }
.packet-art svg { width: 100%; height: 100%; }
.packet-art .emoji { font-size: 18px; }
.mini-icon .icon { width: 22px; height: 22px; display: inline-grid; vertical-align: middle; }
.mini-icon .icon .emoji { font-size: 17px; }
.mini-icon .icon.packet { width: 18px; height: 22px; }
.mini-icon .packet-art { width: 13px; height: 13px; margin-top: 4px; }
.mini-icon .packet-art .emoji { font-size: 10px; }
.mini-emoji { font-size: 20px; }

.drag-ghost {
  position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) scale(1.2);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

/* ======================================================================
   Modals & framed panels
   ====================================================================== */

#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.modal-backdrop {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 34px 16px 16px;
  background: rgba(34, 22, 8, 0.42); pointer-events: auto; animation: fade-in 0.15s ease;
}
.title-modal { margin-top: -4vh; }
@keyframes fade-in { from { opacity: 0; } }
.modal { max-width: 100%; max-height: 100%; overflow: visible; animation: pop 0.22s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }

.panel {
  position: relative; background: linear-gradient(var(--paper), #fdf0d3); border-radius: 22px;
  border: 5px solid var(--wood); box-shadow: 0 0 0 3px var(--wood-dark), inset 0 0 0 3px #fffaf0, var(--shadow);
  padding: 20px 22px; min-width: min(420px, 92vw); max-height: calc(100vh - 60px); overflow: auto;
}
.panel.framed { padding-top: 34px; overflow: visible; }
.panel.framed > :not(.ribbon):not(.close-x):not(.frame-extra) { max-height: none; }
.panel h2 { margin: 0 0 10px; font: 700 22px var(--display); }

/* ribbon title across the top edge */
.ribbon {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 34px 10px; border-radius: 14px;
  background: linear-gradient(#c98543, #9a5a22 60%, #874b18); border: 3px solid var(--wood-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 4px 0 rgba(0, 0, 0, 0.25);
  font: 700 23px var(--display); color: #fff9e6; text-shadow: var(--outline); letter-spacing: .01em;
}
.ribbon::before, .ribbon::after {
  content: ""; position: absolute; top: 12px; width: 22px; height: 30px; z-index: -1;
  background: #7a4418; border: 3px solid var(--wood-ink);
}
.ribbon::before { left: -15px; border-right: none; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 35% 50%); }
.ribbon::after { right: -15px; border-left: none; clip-path: polygon(0 0, 100% 0, 65% 50%, 100% 100%, 0 100%); }
.ribbon-icon { font-size: 22px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3)); }
.ribbon.big { font-size: 34px; padding: 10px 44px 12px; }

.close-x {
  position: absolute; top: -16px; right: -16px; z-index: 3; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 50% 30%, #ff8b7c, var(--red) 60%, #c7362a); border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--red-dark), 0 4px 0 3px rgba(0, 0, 0, 0.2);
  color: #fff; font: 900 20px var(--display); text-shadow: 0 2px 0 var(--red-dark); display: grid; place-items: center;
}
.close-x:hover { filter: brightness(1.08); }
.close-x:active { transform: translateY(2px); }
.frame-extra { position: absolute; top: 12px; right: 30px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
  padding-top: 12px; border-top: 3px dotted var(--paper-3);
}
.label { font: 700 12.5px var(--display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--wood); margin: 10px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.warn { color: var(--red); font-weight: 800; }
.empty { color: var(--muted); text-align: center; padding: 22px 8px; font-weight: 700; }

/* candy buttons */
.btn {
  font: 700 16px var(--display); color: var(--wood-ink); cursor: pointer; letter-spacing: .01em;
  background: linear-gradient(#fffdf5, var(--paper-2)); border: 3px solid #fff; border-radius: 14px;
  padding: 8px 18px; box-shadow: 0 0 0 2px var(--wood-light), 0 4px 0 2px var(--wood-light); transition: transform 0.06s, filter .1s;
  margin: 2px;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 2px var(--wood-light), 0 1px 0 2px var(--wood-light); }
.btn:disabled { filter: grayscale(.6); opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.btn.primary {
  background: linear-gradient(var(--green-top), var(--green) 55%, #56aa22); color: #fff; text-shadow: 0 2px 0 var(--green-dark);
  box-shadow: 0 0 0 2px var(--green-dark), 0 4px 0 2px var(--green-dark);
}
.btn.primary:active:not(:disabled) { box-shadow: 0 0 0 2px var(--green-dark), 0 1px 0 2px var(--green-dark); }
.btn.gold {
  background: linear-gradient(var(--gold-top), var(--gold) 55%, #f5ae17); color: var(--wood-ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  box-shadow: 0 0 0 2px var(--gold-dark), 0 4px 0 2px var(--gold-dark);
}
.btn.gold:active:not(:disabled) { box-shadow: 0 0 0 2px var(--gold-dark), 0 1px 0 2px var(--gold-dark); }
.btn.small { padding: 4px 11px; font-size: 14px; border-radius: 11px; }
.btn.wide { width: calc(100% - 4px); display: flex; flex-direction: column; align-items: center; }
.btn small { font: 700 12px var(--font); opacity: 0.9; margin-top: 2px; }
.link-btn {
  background: none; border: none; padding: 2px 4px; cursor: pointer; font: 800 12px var(--font); color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }

.gold-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 4px; border-radius: 999px;
  background: #fff3cf; box-shadow: inset 0 0 0 2px #f1d58f; font: 700 14px var(--display); color: #8a5a00; white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--paper-2); border-radius: 999px;
  padding: 4px 12px; font-weight: 800; font-size: 13px;
}
.pill.hot { background: #ffe0b8; color: #8a4200; }
.pill.sky { background: #dff2fd; color: var(--sky-dark); }
.center-pill { display: flex; justify-content: center; margin: 6px auto 0; width: fit-content; }

/* side tabs (shop, backpack) */
.with-tabs { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.side-tabs { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 16px; background: var(--paper-2); box-shadow: inset 0 2px 4px rgba(122, 68, 24, 0.18); }
.side-tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 11px; border: none; cursor: pointer;
  background: transparent; font: 700 14px var(--display); color: var(--muted); text-align: left; white-space: nowrap;
}
.side-tab:hover { background: rgba(255, 255, 255, .6); }
.side-tab.active { background: linear-gradient(var(--gold-top), var(--gold)); color: var(--wood-ink); box-shadow: 0 3px 0 var(--gold-dark); }
.side-tab-icon { font-size: 17px; }

/* ---------- title & menus ---------- */
.title { text-align: center; width: min(430px, 92vw); padding: 22px 26px 18px; overflow: visible; }
.logo { position: relative; display: flex; flex-direction: column; align-items: center; margin: -78px 0 8px; line-height: .86; transform: rotate(-4deg); }
.logo-line {
  font: 700 64px var(--display); letter-spacing: .01em;
  background: linear-gradient(#fff27a, #ffc21a 55%, #ff9a0d); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px #5b2c08; paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 #5b2c08) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.25));
}
.logo-line.two { background-image: linear-gradient(#c9f27a, #7ccf2d 55%, #3f9a14); margin-left: 34px; }
.logo-hen { position: absolute; right: 42px; top: -18px; font-size: 42px; transform: rotate(10deg); filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); }
.tagline { margin: 12px 0 16px; color: var(--muted); font-weight: 700; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.menu-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.new-game { width: min(420px, 92vw); }
.new-game label { display: flex; flex-direction: column; gap: 5px; font-weight: 800; margin: 10px 0; }
.new-game input {
  font: 700 16px var(--font); padding: 10px 14px; border-radius: 12px; border: 3px solid var(--paper-3);
  background: #fff; color: var(--ink); user-select: text; box-shadow: inset 0 2px 3px rgba(122, 68, 24, 0.12);
}
.new-game input:focus { outline: none; border-color: var(--gold); }
.pause { width: min(430px, 92vw); }
/* Short windows: the menu fits the screen and its body scrolls inside the frame (ribbon and ✕ stay visible). */
.pause.framed { display: flex; flex-direction: column; max-height: calc(100dvh - 60px); box-sizing: border-box; }
.pause-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px 2px; }
.controls { background: var(--paper-2); border-radius: 14px; padding: 2px 14px 12px; margin-top: 8px; }
.controls dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.controls dt { font-weight: 900; }
.controls dd { margin: 0; color: var(--muted); font-weight: 700; }
.confirm { width: min(410px, 92vw); text-align: center; }
.confirm p { font-weight: 700; }
.confirm .menu-row { justify-content: center; }

/* ---------- backpack ---------- */
.inventory-panel { width: min(820px, 96vw); }
.inv-body { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(10, 56px); gap: 7px; }
.inventory-panel .grid { grid-template-columns: repeat(10, minmax(0, 56px)); gap: clamp(3px, 0.8vw, 7px); }
.inventory-panel .slot { width: auto; height: auto; aspect-ratio: 1; }
.inventory-panel .grid.scroll { max-height: min(44vh, 360px); overflow-y: auto; padding: 4px; margin: -4px; }
.inventory-panel .slot .icon { width: 68%; height: 68%; }
.detail {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 10px 14px; min-height: 78px;
  background: #fffdf6; border-radius: 16px; box-shadow: inset 0 0 0 3px var(--paper-2);
}
.detail p { margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.detail strong { font: 700 17px var(--display); }
.detail-icon .icon { width: 52px; height: 52px; }
.detail-icon .icon .emoji { font-size: 42px; }

/* ---------- shop cards ---------- */
.shop-panel { width: min(700px, 96vw); }
.awning { border-top-left-radius: 26px; border-top-right-radius: 26px; }
.awning::before {
  content: ""; position: absolute; left: -5px; right: -5px; top: -5px; height: 30px; border-radius: 22px 22px 0 0;
  background: repeating-linear-gradient(90deg, #e8483a 0 34px, #fff6e6 34px 68px);
  border: 3px solid var(--wood-dark); border-bottom: none;
  -webkit-mask: radial-gradient(18px 12px at 17px 100%, transparent 98%, #000) 0 0 / 34px 100% repeat-x;
          mask: radial-gradient(18px 12px at 17px 100%, transparent 98%, #000) 0 0 / 34px 100% repeat-x;
}
.shop-panel.framed { padding-top: 44px; }
.shop-body { min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 12px; }
/* Long lists scroll inside the panel so its footer (Total + Buy) always stays on screen. */
.shop-panel .card-grid { max-height: min(56vh, 600px); overflow-y: auto; padding: 4px 6px 4px 4px; overscroll-behavior: contain; }
.shop-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 8px 10px;
  background: #fffdf6; border-radius: 16px; text-align: center;
  box-shadow: inset 0 0 0 3px var(--paper-2), 0 3px 0 var(--paper-3);
}
.shop-card.picked { box-shadow: inset 0 0 0 3px var(--green), 0 3px 0 var(--green-dark); }
.shop-card.hot { box-shadow: inset 0 0 0 3px #ffb56a, 0 3px 0 #e0873a; }
.shop-card.locked { opacity: .62; filter: grayscale(.4); }
.card-art {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #fff, var(--paper-2));
}
.card-art .icon { width: 46px; height: 46px; }
.card-art .icon .emoji { font-size: 38px; }
.card-art .icon.packet { width: 38px; height: 46px; }
.card-art .packet-art { width: 28px; height: 28px; margin-top: 8px; }
.card-art .packet-art .emoji { font-size: 22px; }
.card-name { font: 700 15px var(--display); }
.card-info { font-size: 11.5px; font-weight: 700; color: var(--muted); min-height: 28px; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.card-badge { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 900; color: #8a4200; background: #ffe0b8; padding: 1px 6px; border-radius: 999px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .count { min-width: 26px; text-align: center; font: 700 17px var(--display); font-variant-numeric: tabular-nums; }
.lock { font-weight: 900; font-size: 13px; color: var(--muted); white-space: nowrap; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #fffdf6; border-radius: 14px;
  box-shadow: inset 0 0 0 2px var(--paper-2);
}
.rows { display: flex; flex-direction: column; gap: 6px; }
.row-icon .icon { width: 34px; height: 34px; }
.row-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-main .muted { font-size: 12px; font-weight: 700; }
.price { font-weight: 800; color: #7a4d00; min-width: 48px; text-align: right; }
.row.hot { background: #fff1de; }
.row.locked { opacity: .6; }

/* ---------- shipping bin ---------- */
.bin-panel { width: min(800px, 96vw); }
.split { display: grid; grid-template-columns: auto 1fr; gap: 18px; }
.grid.bag { grid-template-columns: repeat(6, 56px); }
.bin-rows { max-height: 320px; overflow: auto; padding: 2px; }

/* ---------- orders (quest list) ---------- */
.orders-panel { width: min(760px, 96vw); }
.orders-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.order-list { display: flex; flex-direction: column; gap: 10px; max-height: min(58vh, 520px); overflow: auto; padding: 4px; }
.order-row {
  position: relative; display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: #fffdf6; border-radius: 16px; overflow: hidden;
  box-shadow: inset 0 0 0 3px var(--paper-2), 0 3px 0 var(--paper-3);
}
.order-row.ready { box-shadow: inset 0 0 0 3px var(--green), 0 3px 0 var(--green-dark); background: #f6ffe9; }
.order-row.rush { background: #fff4ec; }
.order-portrait {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  background: radial-gradient(circle at 50% 35%, #ffe9b8, #f6c46a); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--wood-light);
}
.order-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.order-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-who strong { font: 700 16px var(--display); }
.tag.rush { background: var(--red); color: #fff; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; box-shadow: 0 2px 0 var(--red-dark); }
.order-row.special { background: #fff8e3; }
.tag.special { background: #ffe0b8; color: #8a4200; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; }
.order-note { margin: 0; font-size: 12px; color: var(--muted); font-style: italic; font-weight: 700; }
.order-line { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; }
.order-line .row-icon .icon { width: 28px; height: 28px; }
.order-line .row-icon .icon .emoji { font-size: 22px; }
.order-line-text { display: flex; justify-content: space-between; font-weight: 800; font-size: 13.5px; }
.order-line.met strong { color: var(--green-dark); }
.progress { height: 10px; border-radius: 999px; background: #ecd8ae; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(#b5ef7e, var(--green)); transition: width .4s; }
.order-line.met .progress > div { background: linear-gradient(#9be35d, var(--green-dark)); }
.order-side { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 150px; }
.order-reward { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.reward { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 999px; font: 700 13px var(--display); }
.reward.gold { background: #fff3cf; color: #8a5a00; }
.reward.xp { background: #e6f4ff; color: var(--sky-dark); padding-left: 8px; }
.reward.bonus { background: #eaf8dc; color: var(--green-dark); padding-left: 8px; }
.order-due { font-size: 12px; font-weight: 800; color: var(--muted); margin-left: auto; }
.order-due.urgent { color: var(--red); }
.orders-foot { margin-top: 10px; text-align: center; font-size: 12.5px; font-weight: 700; }
.stamp {
  position: absolute; inset: 0; display: grid; place-items: center; font: 700 38px var(--display); color: var(--green-dark);
  background: rgba(255, 255, 255, .6); letter-spacing: .1em; animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp::after { content: ""; position: absolute; width: 150px; height: 60px; border: 5px solid var(--green-dark); border-radius: 12px; transform: rotate(-8deg); }
@keyframes stamp { from { transform: scale(2.2) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(-8deg); opacity: 1; } }

/* ---------- level up ---------- */
.modal.bare { overflow: visible; }
.level-up { position: relative; width: min(360px, 90vw); display: flex; flex-direction: column; align-items: center; padding-top: 30px; }
.rays {
  position: absolute; left: 50%; top: 110px; width: 640px; height: 640px; margin: -320px 0 0 -320px; z-index: -1; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 110, .55) 0 10deg, rgba(255, 226, 110, 0) 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sparkles {
  position: absolute; left: 0; right: 0; top: 62px; pointer-events: none; text-align: center; letter-spacing: 60px;
  color: #fff6b0; font-size: 22px; text-shadow: 0 0 8px #ffd23b; animation: twinkle 1.4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .45; transform: translateY(-4px); } }
.level-up .ribbon { position: relative; top: auto; left: auto; transform: none; animation: banner .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes banner { from { transform: scale(.3); opacity: 0; } }
.level-portrait {
  position: relative; margin: 12px 0 -18px; width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: radial-gradient(circle at 50% 35%, #bfe8ff, #5fb3e6); border: 6px solid var(--gold);
  box-shadow: 0 0 0 4px var(--gold-dark), 0 0 30px 8px rgba(255, 214, 72, .6); animation: pop .5s .15s cubic-bezier(.2, 1.6, .4, 1) both;
}
.portrait-face { font-size: 76px; line-height: 1; transform: translateY(6px); }
.portrait-lv {
  position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  padding: 3px 16px; border-radius: 999px; background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid var(--gold-dark);
  font: 700 22px var(--display); color: var(--wood-ink);
}
.level-body {
  width: 100%; padding: 30px 18px 16px; border-radius: 22px; background: linear-gradient(var(--paper), #fdf0d3);
  border: 5px solid var(--wood); box-shadow: 0 0 0 3px var(--wood-dark), var(--shadow); text-align: center;
}
.unlocks { list-style: none; padding: 0; margin: 6px 0 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.unlocks li { display: flex; align-items: center; gap: 10px; background: #fffdf6; box-shadow: inset 0 0 0 2px var(--paper-2); border-radius: 12px; padding: 8px 12px; font-weight: 800; animation: pop .3s ease both; }
.unlocks li:nth-child(2) { animation-delay: .1s; }
.unlocks li:nth-child(3) { animation-delay: .2s; }

/* ---------- settings ---------- */
.settings { width: min(460px, 92vw); }
.setting { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; margin: 12px 0; font-weight: 800; }
.setting input[type="range"] { accent-color: var(--green); }
.setting.check { grid-template-columns: auto 1fr; font-weight: 700; font-size: 14px; }
.setting.check input { width: 18px; height: 18px; accent-color: var(--green); }
.slider-val { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }

/* ---------- day summary ---------- */
.summary { width: min(620px, 94vw); }
.summary-grid { display: grid; grid-template-columns: 1fr 190px; gap: 14px; align-items: stretch; }
.sum-section { background: #fffdf6; box-shadow: inset 0 0 0 3px var(--paper-2); border-radius: 16px; padding: 4px 14px 10px; text-align: left; }
.sum-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-weight: 700; }
.sum-item { display: flex; align-items: center; gap: 4px; }
.sum-item .icon { width: 24px; height: 24px; }
.sum-item .icon .emoji { font-size: 19px; }
.sum-row.total { border-top: 3px dotted var(--paper-3); margin-top: 6px; padding-top: 6px; }
.sum-row.net { font: 700 19px var(--display); }
.sum-row.net.pos strong { color: var(--green-dark); }
.sum-row.net.neg strong { color: var(--red); }
.sum-row.xp span:last-child { font-weight: 900; color: #8a6d00; }
.weather-card {
  border-radius: 18px; padding: 12px 10px; color: #fff; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: linear-gradient(#7fd0f7, #3a9ad8); border: 3px solid rgba(255, 255, 255, 0.7); box-shadow: 0 4px 0 var(--sky-dark);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.weather-card.rain { background: linear-gradient(#9fb6c8, #5c7a95); box-shadow: 0 4px 0 #3e5870; }
.weather-card.snow { background: linear-gradient(#c9e4f5, #7fa8c9); box-shadow: 0 4px 0 #5a7f9e; }
.season-banner {
  margin: 8px auto 0; padding: 8px 14px; border-radius: 14px; text-align: center; font-weight: 700; width: fit-content; max-width: 100%;
  background: #e7f6dc; color: #2f5e1f; border: 2px solid #b9de9c;
}
.season-banner strong { font: 700 17px var(--display); }
.season-banner.warn { background: #fff0d6; color: #8a4a00; border-color: #f2c98a; }
.wc-label { font-size: 12px; font-weight: 800; opacity: .9; }
.wc-date { font: 700 16px var(--display); }
.wc-icon { font-size: 54px; line-height: 1.1; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .2)); }
.wc-name { font: 700 22px var(--display); }
.wc-note { font-size: 12px; font-weight: 800; }
.wc-tomorrow { margin-top: 6px; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 2px 10px; }
.sum-news { background: #eef9e2; border-radius: 14px; padding: 8px 12px; text-align: left; font-weight: 800; font-size: 14px; display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.sum-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0; font-weight: 700; font-size: 14px; }

/* ---------- debug ---------- */
#debug {
  position: fixed; top: 80px; left: 12px; z-index: 20; display: flex; flex-direction: column; gap: 5px;
  background: rgba(255, 248, 232, 0.96); border: 2px dashed var(--wood); border-radius: 12px; padding: 8px 10px;
}
#debug[hidden] { display: none; }
#debug .label { margin: 0 0 2px; }

/* ======================================================================
   Small screens
   ====================================================================== */

@media (max-width: 1000px) {
  .hud-actions { bottom: 104px; flex-direction: column-reverse; align-items: flex-end; right: 12px; }
  .act-btn { width: 52px; height: 52px; font-size: 24px; }
  .act-btn.big { width: 64px; height: 64px; }
  .act-btn.big .icon { width: 38px; height: 38px; }
  .hud-side { top: auto; bottom: 280px; }
}

@media (max-width: 900px) {
  .with-tabs { grid-template-columns: minmax(0, 1fr); } /* the tab strip scrolls instead of widening the panel */
  .side-tabs { flex-direction: row; overflow-x: auto; }
}

@media (max-width: 720px) {
  .slot { width: 42px; height: 42px; border-radius: 11px; }
  #hotbar .slot { width: min(42px, calc((100vw - 64px) / 10)); height: min(42px, calc((100vw - 64px) / 10)); border-width: 2px; }
  #hotbar .icon { width: 72%; height: 72%; }
  #hotbar .key { display: none; }
  #hotbar { gap: 3px; padding: 5px; border-radius: 14px; }
  .hud-left { width: min(250px, 60vw); }
  .avatar { width: 44px; height: 44px; border-width: 3px; }
  .avatar span { font-size: 25px; }
  .lv { font-size: 17px; }
  .xpbar { height: 16px; }
  #xp-text { font-size: 11px; }
  .hud-top { flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 38vw; }
  .clock-card { order: 3; }
  .res-pill { font-size: 16px; min-width: 0; padding-right: 12px; }
  .coin-dot.big { width: 26px; height: 26px; }
  .clock-card { padding: 3px 10px 3px 4px; }
  .wx { font-size: 22px; width: 26px; }
  #hud-time { font-size: 15px; }
  .round-btn { width: 36px; height: 36px; font-size: 17px; border-width: 2px; }
  .hud-side { right: 8px; bottom: 250px; }
  .side-btn { width: 56px; font-size: 11px; }
  .side-ico { font-size: 22px; }
  #tracker { font-size: 12px; padding: 5px 8px; }
  #hint { font-size: 12px; }
  #toasts { bottom: 200px; }
  .icon { width: 30px; height: 30px; }
  .grid { grid-template-columns: repeat(5, 44px); }
  .inventory-panel .grid { grid-template-columns: repeat(5, minmax(0, 52px)); }
  .grid.bag { grid-template-columns: repeat(5, 44px); }
  .with-tabs { grid-template-columns: 1fr; }
  .side-tabs { flex-direction: row; overflow-x: auto; }
  .split { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: 44px 1fr; }
  .order-portrait { width: 44px; height: 44px; font-size: 24px; }
  .order-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .packet-art { width: 60%; height: 60%; margin-top: 3px; }
  #hotbar .icon.packet { width: 62%; }
  #controls-hint { display: none; }
  .ribbon { font-size: 19px; padding: 6px 24px 8px; }
  .logo-line { font-size: 50px; }
  .panel { padding: 18px 14px; }
}

/* ===== 1.5b: fishing UI (fishingUI.js) ===== */
#fishing { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
#fishing .fish-hint, #fishing .fish-reel { display: none; }
#fishing.open .fish-hint { display: block; }
#fishing.open[data-phase="reel"] .fish-reel { display: flex; }

/* hint pill above the hotbar */
.fish-hint {
  position: absolute; left: 50%; bottom: 176px; transform: translateX(-50%);
  background: var(--hud-dark); color: #fff; font: 800 14px var(--font); white-space: nowrap;
  padding: 8px 16px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.25);
  animation: fish-in .25s ease;
}
#fishing[data-phase="bite"] .fish-hint {
  background: linear-gradient(var(--gold-top), var(--gold) 55%, #f5ae17); color: var(--wood-ink); border-color: #fff;
  box-shadow: 0 0 0 2px var(--gold-dark), 0 4px 0 2px var(--gold-dark); font: 700 17px var(--display);
  animation: pulse .5s ease-in-out infinite;
}
#fishing[data-phase="reel"] .fish-hint { bottom: 150px; }
@keyframes fish-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* the reel bar: wooden frame, water track, green catch zone, fish, progress meter */
.fish-reel {
  position: absolute; left: calc(50% + 84px); top: 50%; transform: translateY(-56%);
  flex-direction: column; align-items: center; animation: fish-reel-in .28s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes fish-reel-in { from { opacity: 0; transform: translateY(-50%) scale(.85); } }
.fish-tag {
  position: relative; z-index: 2; margin-bottom: -12px; padding: 3px 16px 5px; border-radius: 12px;
  background: linear-gradient(#c98543, #9a5a22 60%, #874b18); border: 3px solid var(--wood-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 rgba(0, 0, 0, 0.25);
  font: 700 17px var(--display); color: #fff9e6; text-shadow: var(--outline);
}
.fish-frame {
  position: relative; display: flex; gap: 8px; padding: 18px 10px 12px 12px; border-radius: 22px;
  background: linear-gradient(90deg, #c98543, #b06e33 45%, #9a5a22);
  border: 3px solid var(--wood-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.2), var(--shadow);
}
.fish-track {
  position: relative; width: 50px; height: min(260px, 56vh); border-radius: 16px; overflow: hidden;
  background: linear-gradient(#9fe0ff, #4fb4ea 45%, #2479b3);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--paper-3);
}
.fish-bubbles {
  position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(circle at 30% 40%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 70% 75%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 55% 15%, #fff 0 2.5px, transparent 3.5px);
  background-size: 50px 90px; animation: fish-bubbles 3s linear infinite;
}
@keyframes fish-bubbles { to { background-position: 0 -90px; } }
.fish-zone {
  position: absolute; left: 4px; right: 4px; bottom: 0; height: 25%; border-radius: 12px; will-change: transform;
  background: linear-gradient(90deg, rgba(143, 224, 77, .7), rgba(108, 195, 52, .8));
  border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 2px rgba(62, 138, 22, .6);
  transition: background-color .15s, box-shadow .15s;
}
.fish-zone.in {
  background: linear-gradient(90deg, rgba(170, 255, 110, .9), rgba(120, 220, 60, .95));
  box-shadow: 0 0 0 2px var(--green-dark), 0 0 16px 4px rgba(200, 255, 140, .85);
}
.fish-icon {
  position: absolute; left: 50%; bottom: -18px; width: 36px; height: 36px; margin-left: -18px; will-change: transform;
  display: grid; place-items: center; font-size: 28px; line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}
.fish-icon-inner { display: block; animation: fish-wiggle .45s ease-in-out infinite alternate; }
@keyframes fish-wiggle { from { transform: rotate(-14deg) scaleX(-1); } to { transform: rotate(10deg) scaleX(-1); } }
.fish-meter {
  position: relative; width: 16px; height: min(260px, 56vh); border-radius: 999px; overflow: hidden;
  background: #5b3a1c; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5), 0 0 0 3px var(--paper-3);
}
.fish-meter-fill {
  position: absolute; inset: 0; transform-origin: 50% 100%; transform: scaleY(0); background-color: hsl(0, 78%, 50%);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%);
  border-radius: 999px; will-change: transform;
}
.fish-knob {
  position: absolute; right: -16px; bottom: -14px; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fffdf5, var(--paper-3) 70%); border: 3px solid var(--wood-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.fish-knob-handle {
  position: absolute; left: 50%; top: 3px; width: 8px; height: 13px; margin-left: -4px; border-radius: 4px;
  background: var(--red); box-shadow: inset 0 -2px 0 var(--red-dark);
}

/* the bite "!" */
.fish-bang {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); opacity: 0; visibility: hidden;
  font: 700 86px/1 var(--display); color: var(--gold); text-shadow: var(--outline), 0 6px 0 var(--wood-ink), 0 10px 18px rgba(0, 0, 0, .35);
}
.fish-bang::before {
  content: ""; position: absolute; left: 50%; top: 55%; width: 110px; height: 110px; margin: -55px 0 0 -55px; z-index: -1;
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .9), rgba(255, 240, 160, .5) 45%, transparent 70%);
}
.fish-bang.show { visibility: visible; animation: fish-bang-pop .3s cubic-bezier(.2, 1.6, .4, 1) forwards, fish-bang-bounce .42s ease-in-out .3s infinite alternate; }
@keyframes fish-bang-pop { from { opacity: 0; transform: translate(-50%, -60%) scale(.2) rotate(-20deg); } to { opacity: 1; transform: translate(-50%, -100%) scale(1) rotate(-6deg); } }
@keyframes fish-bang-bounce { from { opacity: 1; transform: translate(-50%, -100%) scale(1) rotate(-6deg); } to { opacity: 1; transform: translate(-50%, -118%) scale(1.08, .95) rotate(6deg); } }

/* catch result cards (top centre) */
.fish-catches { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fish-catch {
  display: flex; align-items: center; gap: 12px; padding: 7px 18px 7px 7px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--wood-light), 0 4px 0 2px var(--wood-light), 0 10px 22px rgba(0, 0, 0, .25);
  animation: fish-catch-in .4s cubic-bezier(.2, 1.5, .4, 1);
  transition: opacity .4s ease, transform .4s ease;
}
.fish-catch.out { opacity: 0; transform: translateY(-10px) scale(.96); }
@keyframes fish-catch-in { from { opacity: 0; transform: translateY(14px) scale(.7); } }
.fish-catch-icon {
  position: relative; flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  background: radial-gradient(circle at 50% 35%, #d4f1ff, #7cc8ef); box-shadow: inset 0 -3px 0 rgba(36, 121, 179, .35), 0 0 0 3px #fff;
}
.fish-q {
  position: absolute; right: -6px; bottom: -4px; font-size: 18px; line-height: 1;
  text-shadow: 0 1px 0 var(--wood-ink), 1px 0 0 var(--wood-ink), -1px 0 0 var(--wood-ink), 0 -1px 0 var(--wood-ink);
}
.fish-q.silver { color: #e3e8ee; }
.fish-q.gold { color: var(--gold); }
.fish-q.iridium { color: #c77dff; }
.fish-catch-name { font: 700 19px/1.1 var(--display); color: var(--ink); }
.fish-catch-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-weight: 800; font-size: 13.5px; color: var(--muted); }
.fish-record {
  color: var(--wood-ink); padding: 1px 9px; border-radius: 999px; font-size: 12.5px;
  background: linear-gradient(var(--gold-top), var(--gold)); box-shadow: 0 2px 0 var(--gold-dark);
  animation: pulse 1s ease-in-out infinite;
}
.fish-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 720px) {
  .fish-reel { left: calc(50% + 44px); }
  .fish-hint { bottom: 150px; font-size: 13px; }
  .fish-catches { top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .fish-icon-inner, .fish-bubbles, .fish-record, #fishing[data-phase="bite"] .fish-hint { animation: none; }
  .fish-bang.show { animation: fish-bang-pop .01s forwards; }
}
/* ===== end 1.5b: fishing UI ===== */

/* ===== 1.5b: quality stars, craft tab, pet chooser ===== */
.slot .star {
  position: absolute; left: 2px; bottom: -1px; font-size: 15px; line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .45));
}
.slot .star.q1 { color: #dfe7ef; }
.slot .star.q2 { color: #ffd23b; }
.star-inline.q1 { color: #8d9aa6; }
.star-inline.q2 { color: #e5a50a; }
.icon.golden .emoji { filter: sepia(1) saturate(4) hue-rotate(5deg) brightness(1.15) drop-shadow(0 0 4px rgba(255, 210, 60, .8)); }

.craft-view .card-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.recipe-cost { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.recipe-cost .cost {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 4px; border-radius: 999px;
  background: #fde3dc; color: var(--red-dark); font: 700 13px var(--display);
}
.recipe-cost .cost.met { background: #eaf8dc; color: var(--green-dark); }

.pet-choice { display: flex; flex-direction: column; gap: 6px; }
.pet-cards { display: flex; gap: 10px; }
.pet-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; cursor: pointer;
  background: #fffdf6; border: 3px solid var(--paper-2); border-radius: 16px; font: 700 15px var(--display); color: var(--ink);
  box-shadow: 0 3px 0 var(--paper-3); transition: transform .08s;
}
.pet-card.active { border-color: var(--green); box-shadow: 0 3px 0 var(--green-dark); background: #f6ffe9; }
.pet-card:active { transform: translateY(2px); }
.pet-emoji { font-size: 36px; line-height: 1.1; }
/* ===== end 1.5b: quality stars, craft tab, pet chooser ===== */

/* ===== 1.5c: tasks card, HUD extras, character select & sheet, land prompt, house menu ===== */
#tasks:empty { display: none; }
#tasks {
  pointer-events: auto; cursor: pointer;
  background: rgba(255, 250, 238, 0.94); border-radius: 16px; padding: 7px 10px 8px;
  box-shadow: 0 3px 0 rgba(78, 42, 12, 0.3), 0 6px 14px rgba(0, 0, 0, 0.14);
  font-size: 13px; display: flex; flex-direction: column; gap: 4px;
}
#tasks .toggle { margin-left: auto; text-transform: none; letter-spacing: 0; }
.task { display: grid; grid-template-columns: 20px 1fr auto; gap: 6px; align-items: center; font-weight: 800; }
.task .check {
  width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: #fff;
  background: #fff; box-shadow: inset 0 0 0 2px var(--paper-3);
}
.task.done .check { background: var(--green); box-shadow: 0 2px 0 var(--green-dark); }
.task.done .task-text { color: var(--green-dark); text-decoration: line-through; text-decoration-thickness: 2px; }
.task-prog { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.task.done .task-prog { color: var(--green-dark); }
.task-bonus { text-align: center; font-weight: 900; color: var(--green-dark); font-size: 12.5px; }

.hud-sub { display: flex; flex-wrap: wrap; gap: 6px; }
.hud-sub:not(:has(> div:not([hidden]))) { display: none; }
.hud-sub > div[hidden] { display: none; }
#saving, #buff-chip, #cozy-chip {
  background: var(--hud-dark); color: #fff; font-weight: 800; font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
#buff-chip { background: rgba(62, 138, 22, 0.78); pointer-events: auto; }
#cozy-chip { background: rgba(176, 110, 51, 0.82); }
body.indoors #tracker, body.indoors #tasks, body.indoors #hint { display: none; }
#btn-decor[hidden] { display: none; }
button.avatar { border: none; cursor: pointer; pointer-events: auto; position: relative; padding: 0; font: inherit; }
#stat-badge {
  position: absolute; right: -4px; top: -4px; font-size: 16px; line-height: 1; animation: pulse 1.2s ease-in-out infinite;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .4));
}
#stat-badge[hidden] { display: none; }

.char-select { width: min(640px, 96vw); }
.char-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 12px; }
.char-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 8px; cursor: pointer; position: relative;
  background: #fffdf6; border: 3px solid var(--paper-2); border-radius: 16px; font: 700 15px var(--display); color: var(--ink);
  box-shadow: 0 3px 0 var(--paper-3); transition: transform .08s;
}
.char-card.active { border-color: var(--green); box-shadow: 0 3px 0 var(--green-dark); background: #f6ffe9; transform: translateY(-2px); }
.char-card .tag { font: 800 10.5px var(--font); color: #8a4200; background: #ffe0b8; padding: 1px 6px; border-radius: 999px; }
.char-face {
  font-size: 40px; line-height: 1; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff, var(--paper-2)); box-shadow: 0 0 0 4px var(--hat, #f0c96a);
}
.char-face.big { font-size: 48px; width: 72px; height: 72px; }
.char-detail { background: #fffdf6; border-radius: 16px; padding: 8px 14px 6px; box-shadow: inset 0 0 0 3px var(--paper-2); }
.char-title { font: 700 20px var(--display); margin-bottom: 4px; }
.char-detail .pro { color: var(--green-dark); font-weight: 800; margin: 6px 0 0; }
.char-detail .con { color: var(--red-dark); font-weight: 800; margin: 2px 0 4px; }
.stat-bars { display: flex; flex-direction: column; gap: 4px; }
.stat-row { display: grid; grid-template-columns: 138px 1fr 22px auto; gap: 8px; align-items: center; font-weight: 800; font-size: 13.5px; }
.stat-pips { display: flex; gap: 3px; }
.pip { width: 20px; height: 11px; border-radius: 4px; background: #ecd8ae; }
.pip.on { background: linear-gradient(#9be35d, var(--green)); box-shadow: 0 1px 0 var(--green-dark); }
.pip.extra { opacity: .55; }
.pip.extra.on { opacity: 1; background: linear-gradient(var(--gold-top), var(--gold)); box-shadow: 0 1px 0 var(--gold-dark); }
.stat-val { font: 700 16px var(--display); text-align: center; }
.stat-row .plus { padding: 0 9px; }
.sheet { width: min(560px, 94vw); }
.sheet-top { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.milestones { display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow: auto; padding-right: 4px; }
.ms { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; font-weight: 700; font-size: 13px; padding: 2px 6px; border-radius: 8px; }
.ms.done { background: #eaf8dc; color: var(--green-dark); }
.ms-prog { color: var(--muted); font-variant-numeric: tabular-nums; }
.ms.done .ms-prog { color: var(--green-dark); }

.land-prompt { width: min(380px, 92vw); }
.land-zone { text-align: center; font: 700 17px var(--display); color: var(--wood); }
.land-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 4px; }

.house-menu { width: min(480px, 94vw); }
.house-cozy { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-weight: 800; margin-bottom: 6px; }
.center-row { justify-content: center; margin-top: 4px; }
.house-next { background: #fffdf6; border-radius: 16px; padding: 4px 14px 12px; margin-top: 10px; box-shadow: inset 0 0 0 3px var(--paper-2); }
.reqs { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 6px; }
.req { font-weight: 800; }
.req.met { color: var(--green-dark); }
.req.miss { color: var(--red-dark); }

/* ===== 1.5d: catalog, decorate tray, cooking ===== */
.furn-emoji { font-size: 36px; line-height: 1; }
.furn-emoji.small { font-size: 26px; width: 34px; text-align: center; }
.catalog .card-grid { max-height: min(46vh, 420px); overflow: auto; padding: 4px; }
.shop-card.furn .card-info { min-height: 0; }

#decor-tray {
  position: fixed; right: 8px; top: 8px; bottom: 8px; width: min(280px, 44vw); z-index: 20; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(#fffaf0, var(--paper-2)); border: 3px solid #fff; border-radius: 18px; padding: 8px 10px;
  box-shadow: 0 0 0 3px var(--wood-light), 0 8px 0 3px var(--wood), 0 16px 34px rgba(0, 0, 0, .3);
}
#decor-tray[hidden] { display: none; }
.decor-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.decor-head strong { font: 700 18px var(--display); }
.decor-cozy { align-self: flex-start; }
.decor-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.decor-tray .btn.small, #decor-tray .btn.small { padding: 3px 10px; font-size: 13px; }
.decor-msg { min-height: 34px; font-weight: 800; font-size: 13px; color: var(--red-dark); }
.decor-msg.ok { color: var(--green-dark); }
.decor-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.decor-tab {
  border: none; cursor: pointer; font: 800 12px var(--font); color: var(--wood-ink); padding: 4px 9px; border-radius: 999px;
  background: var(--paper-2);
}
.decor-tab.active { background: var(--wood); color: #fff; }
.decor-items {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; align-content: start;
  padding: 4px 2px; overscroll-behavior: contain;
}
.decor-items > .muted { grid-column: 1 / -1; }
.decor-items .furn-emoji { font-size: 26px; }
.decor-item {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; cursor: pointer; position: relative; min-width: 0;
  background: #fffdf6; border: 3px solid var(--paper-2); border-radius: 14px; box-shadow: 0 3px 0 var(--paper-3);
}
.decor-item.active { border-color: var(--green); box-shadow: 0 3px 0 var(--green-dark); background: #f6ffe9; }
.decor-name { font: 800 11px var(--font); color: var(--ink); line-height: 1.1; text-align: center; }
.decor-count { position: absolute; top: 1px; right: 5px; font: 900 11px var(--font); color: var(--muted); }
.decor-sections { display: flex; gap: 6px; }
.decor-section {
  flex: 1; border: none; cursor: pointer; font: 700 15px var(--display); color: var(--wood-ink); padding: 6px 4px; border-radius: 12px;
  background: var(--paper-3); box-shadow: 0 2px 0 var(--wood-light);
}
.decor-section.active { background: linear-gradient(var(--green-top), var(--green)); color: #fff; box-shadow: 0 2px 0 var(--green-dark); }
.gold-mini { background: #fff3cf; color: #8a5a00; font-size: 12.5px; padding: 2px 8px; }
.decor-price { font: 800 11.5px var(--font); color: #8a5a00; }
.decor-item.locked { opacity: .55; }
.decor-new { position: absolute; top: 1px; left: 4px; font-size: 11px; }
.decor-note { grid-column: 1 / -1; text-align: center; }
.decor-help { font-size: 11.5px; font-weight: 800; color: var(--muted); text-align: center; }
/* Decorating: nothing in the HUD moves or resizes; it just fades out (the panel already shows gold) and slides back in after. */
#hud .hud-side, #hud .hud-left, #hud .hud-bottom, #hud .hud-actions, #hud .hud-top { transition: opacity .18s ease; }
body.decorating #hud .hud-side, body.decorating #hud .hud-left, body.decorating #hud .hud-bottom,
body.decorating #hud .hud-actions, body.decorating #hud .hud-top { opacity: 0; pointer-events: none; }
#decor-tray { animation: decor-in .18s ease-out; }
@keyframes decor-in { from { opacity: 0; transform: translateX(16px); } }

.cooking-panel { width: min(760px, 96vw); }
.cook-split { grid-template-columns: 250px 1fr; align-items: start; }
.recipe-list { display: flex; flex-direction: column; gap: 5px; max-height: min(56vh, 460px); overflow: auto; padding: 3px; }
.recipe-item {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 6px; padding: 5px 8px; cursor: pointer; text-align: left;
  background: #fffdf6; border: 2px solid var(--paper-2); border-radius: 12px; font: 800 13px var(--font); color: var(--ink);
}
.recipe-item.active { border-color: var(--green); background: #f6ffe9; }
.recipe-item.ready .recipe-name::after { content: " ✓"; color: var(--green-dark); }
.recipe-item.unknown { opacity: .55; cursor: default; }
.recipe-item .tag { font-size: 12px; }
.recipe-detail { background: #fffdf6; border-radius: 16px; padding: 10px 14px; box-shadow: inset 0 0 0 3px var(--paper-2); display: flex; flex-direction: column; gap: 8px; }
.recipe-head { display: flex; gap: 12px; align-items: center; }
.recipe-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.recipe-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.recipe-tags { display: flex; gap: 3px; align-items: center; white-space: nowrap; }
.recipe-item .tag.mastery, .mastery-stars { color: #e0a100; letter-spacing: 1px; }
.recipe-mastery { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.buff-effects { color: var(--green-dark); font-weight: 800; }
.recipe-special { background: #fff1d6; color: #8a4200; font-weight: 800; border-radius: 10px; padding: 4px 10px; }
.fridge-panel .grid.fridge { grid-template-columns: repeat(6, 56px); }
.xp-split { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-bottom: 2px; }

@media (max-height: 760px) {
  .char-cards { margin: 4px 0 8px; }
  .char-card { padding: 5px 4px 4px; font-size: 13px; gap: 1px; }
  .char-card .tag { display: none; }
  .char-face { width: 40px; height: 40px; font-size: 26px; box-shadow: 0 0 0 3px var(--hat, #f0c96a); }
  .char-select .char-title { font-size: 17px; margin-bottom: 2px; }
  .char-select .stat-bars { gap: 1px; }
  .char-select .stat-row { font-size: 12px; }
  .char-select .pip { height: 8px; }
  .char-select p { margin: 3px 0; font-size: 12.5px; }
  .char-select .char-detail { padding: 5px 12px 3px; }
  .char-select .menu-row { margin-top: 8px; }
  .char-select > p.small { display: none; }
}
@media (max-width: 720px) {
  .char-cards { gap: 6px; }
  .char-card .tag { font-size: 9.5px; }
  .cook-split { grid-template-columns: 1fr; }
  .cook-split .recipe-list { max-height: 150px; }
  .stat-row { grid-template-columns: 110px 1fr 20px auto; }
}
.house-menu .unlocks { gap: 3px; margin: 2px 0 6px; }
.house-menu .unlocks li { padding: 3px 10px; font-size: 13.5px; }
.house-menu .house-next .label { margin-top: 6px; }
.house-menu p { margin: 4px 0; }
/* fish icon tints (emoji variations) */
.icon.tint-gold .emoji { filter: hue-rotate(-40deg) saturate(1.6) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-blue .emoji { filter: hue-rotate(20deg) saturate(1.4) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-rainbow .emoji { filter: hue-rotate(120deg) saturate(1.8) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-green .emoji { filter: hue-rotate(-110deg) saturate(1.2) brightness(.9) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-dark .emoji { filter: grayscale(.6) brightness(.75) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-pale .emoji { filter: saturate(.45) brightness(1.15) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-eel .emoji { filter: hue-rotate(160deg) saturate(.6) brightness(.8) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }

/* ===== Fishing update: rarities, baits, Fish journal (fishingUI.js, inventoryPanel.js, icons.js) ===== */
:root {
  --r-common: #b8c0c8; --r-uncommon: #6cc334; --r-rare: #3b9be0; --r-epic: #a860e0; --r-legendary: #ffc93a; --r-junk: #a08a70;
}
.r-common { --rarity: var(--r-common); }
.r-uncommon { --rarity: var(--r-uncommon); }
.r-rare { --rarity: var(--r-rare); }
.r-epic { --rarity: var(--r-epic); }
.r-legendary { --rarity: var(--r-legendary); }
.r-junk { --rarity: var(--r-junk); }

/* rarity pill (catch card + journal): dark ink on the rarity colour keeps ≥ 4.5:1 contrast */
.fish-rarity {
  display: inline-block; padding: 1px 9px; border-radius: 999px; font: 800 11.5px/1.5 var(--font); letter-spacing: .03em;
  text-transform: uppercase; color: #22160a; background: var(--rarity, var(--r-common)); box-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}

/* catch card */
.fish-catch-title { display: flex; align-items: center; gap: 8px; }
.fish-catch.r-common, .fish-catch.r-uncommon, .fish-catch.r-rare, .fish-catch.r-epic, .fish-catch.r-legendary {
  box-shadow: 0 0 0 3px var(--rarity), 0 4px 0 3px color-mix(in srgb, var(--rarity) 70%, #000), 0 10px 22px rgba(0, 0, 0, .25);
}
.fish-catch .fish-catch-icon .icon { width: 40px; height: 40px; }
.fish-catch .fish-catch-icon .icon .emoji { font-size: 30px; }
.fish-pts { color: var(--green-dark); }
.fish-first {
  color: #fff; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; background: var(--green); box-shadow: 0 2px 0 var(--green-dark);
  text-shadow: 0 1px 0 var(--green-dark);
}
.fish-catch.big { padding: 10px 24px 10px 10px; }
.fish-catch.big .fish-catch-icon { width: 64px; height: 64px; }
.fish-catch.big .fish-catch-icon .icon .emoji { font-size: 40px; }
.fish-catch.big .fish-catch-name { font-size: 23px; }
.fish-catch.r-epic .fish-catch-icon { background: radial-gradient(circle at 50% 35%, #f3e4ff, #b77ee8); }
.fish-catch.r-legendary .fish-catch-icon { background: radial-gradient(circle at 50% 35%, #fff6cf, #ffc93a); }
.fish-catch.r-legendary {
  background: linear-gradient(#fffbe8, #ffeeb0);
  animation: fish-catch-in .5s cubic-bezier(.2, 1.5, .4, 1), fish-legend-glow 1.2s ease-in-out .5s infinite alternate;
}
@keyframes fish-legend-glow {
  from { box-shadow: 0 0 0 3px var(--r-legendary), 0 4px 0 3px var(--gold-dark), 0 0 14px 4px rgba(255, 201, 58, .55); }
  to { box-shadow: 0 0 0 3px var(--r-legendary), 0 4px 0 3px var(--gold-dark), 0 0 34px 12px rgba(255, 201, 58, .9); }
}

/* reel bar: the fish glows in its rarity colour */
.fish-icon[data-rarity="uncommon"] { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 4px var(--r-uncommon)); }
.fish-icon[data-rarity="rare"] { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 5px var(--r-rare)); }
.fish-icon[data-rarity="epic"] { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 6px var(--r-epic)) drop-shadow(0 0 3px var(--r-epic)); }
.fish-icon[data-rarity="legendary"] { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 7px var(--r-legendary)) drop-shadow(0 0 4px #fff3b0); }

/* new fish & bait icon tints */
.icon.tint-sun .emoji { filter: hue-rotate(-25deg) saturate(1.8) brightness(1.1) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-bass .emoji { filter: hue-rotate(-95deg) saturate(.9) brightness(.8) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-cray .emoji { filter: hue-rotate(-10deg) saturate(.8) brightness(.85) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-sturgeon .emoji { filter: grayscale(.8) sepia(.4) brightness(.8) drop-shadow(0 2px 0 rgba(0, 0, 0, .12)); }
.icon.tint-silver .emoji { filter: grayscale(1) brightness(1.25) contrast(1.1) drop-shadow(0 0 3px rgba(220, 235, 255, .9)); }
.icon.tint-ghost .emoji { filter: grayscale(1) brightness(1.6) opacity(.8) drop-shadow(0 0 4px rgba(210, 230, 255, .95)); }
.icon.tint-prism .emoji { filter: hue-rotate(200deg) saturate(2.2) drop-shadow(0 0 4px rgba(200, 120, 255, .8)); }
.icon.tint-king { position: relative; container-type: inline-size; }
.icon.tint-king .emoji { filter: sepia(.9) saturate(2.6) hue-rotate(45deg) brightness(.72) drop-shadow(0 0 4px rgba(255, 201, 58, .95)); }
.icon.tint-king::after { content: "👑"; position: absolute; top: -14%; right: -8%; font-size: 42cqw; line-height: 1; transform: rotate(18deg); }
.icon.tint-jade .emoji { filter: hue-rotate(40deg) saturate(1.3) drop-shadow(0 0 4px rgba(90, 230, 160, .9)); }
.icon.tint-glow .emoji { filter: hue-rotate(160deg) saturate(2) brightness(1.2) drop-shadow(0 0 5px rgba(120, 255, 220, .95)); }

/* bait equip (backpack detail) */
.bait-equip { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.bait-tier { font: 800 12.5px var(--font); color: var(--muted); }
.bait-equipped {
  padding: 3px 12px; border-radius: 999px; font: 700 14px var(--display); color: var(--green-dark);
  background: #eaf8dc; box-shadow: inset 0 0 0 2px var(--green);
}

/* Fish journal tab */
.fish-journal .journal-head { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.journal-stat {
  flex: 1 1 120px; display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 14px;
  background: #fffdf6; box-shadow: inset 0 0 0 3px var(--paper-2);
}
.journal-num { font: 700 24px/1.1 var(--display); color: var(--ink); }
.journal-grid {
  list-style: none; margin: 0; padding: 4px; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); max-height: min(58vh, 520px); overflow-y: auto;
}
.journal-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 9px; text-align: center; border-radius: 16px;
  background: #fffdf6; box-shadow: inset 0 0 0 3px var(--rarity, var(--paper-2)), 0 3px 0 var(--paper-3);
}
.journal-card.r-legendary { background: linear-gradient(#fffbe8, #fff1c2); box-shadow: inset 0 0 0 3px var(--r-legendary), 0 3px 0 var(--gold-dark), 0 0 12px rgba(255, 201, 58, .55); }
.journal-art .icon { width: 46px; height: 46px; }
.journal-art .icon .emoji { font-size: 36px; }
.journal-name { font: 700 15px/1.15 var(--display); color: var(--ink); }
.journal-meta { font-weight: 800; font-size: 12.5px; color: var(--muted); }
.journal-card.unknown { background: #f3e6c8; box-shadow: inset 0 0 0 3px var(--paper-3), 0 3px 0 var(--paper-3); }
.journal-card.unknown .journal-art { filter: brightness(0) opacity(.38); }
.journal-card.unknown .journal-name { color: var(--muted); letter-spacing: .1em; }
.journal-hint { font-weight: 700; font-size: 12px; line-height: 1.3; color: #6d5031; }

@media (max-width: 720px) {
  .journal-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); max-height: none; }
  .journal-num { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .fish-catch.r-legendary { animation: none; box-shadow: 0 0 0 3px var(--r-legendary), 0 4px 0 3px var(--gold-dark), 0 0 22px 6px rgba(255, 201, 58, .75); }
}
/* ===== end Fishing update: rarities, baits, Fish journal ===== */

/* ---------- online panel (cloud save, leaderboards, invites) ---------- */
.online { width: min(640px, 94vw); }
.online-body { display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.online-msg { padding: 18px 6px; }
.online-msg p { margin: 0 0 8px; }
.online-avatar { font-size: 28px; line-height: 1; }
.online-avatar.small { font-size: 20px; }
.online-conflict { background: #fff1de; border-radius: 14px; padding: 8px 12px; }
.online-conflict p { margin: 0; font-weight: 700; }
.online-conflict .menu-row { margin-top: 8px; justify-content: flex-start; flex-wrap: wrap; }
.board-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; border-radius: 999px; padding: 4px 10px; font: 800 13px var(--font); background: var(--paper-2); color: inherit; cursor: pointer; }
.chip.active { background: var(--green); color: #fff; }
.board-rows { max-height: min(40vh, 360px); overflow: auto; padding: 2px; }
.board-rank { min-width: 34px; text-align: center; font: 700 16px var(--display); }
.invite-code { font: 700 22px var(--display); letter-spacing: 2px; }
.invite-input { margin-top: 4px; font: 700 16px var(--display); letter-spacing: 1px; text-transform: uppercase; width: 140px; }
@media (max-width: 560px) {
  .online .with-tabs { grid-template-columns: 1fr; }
}

/* ---------- friends & chat ---------- */
.side-btn { position: relative; }
.side-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font: 900 12px/20px var(--font); text-align: center; box-shadow: 0 0 0 2px #fff;
}
.side-badge[hidden] { display: none; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.friend-form { display: flex; gap: 8px; margin: 10px 0 14px; }
.friend-input { flex: 1; min-width: 0; font: 700 16px var(--font); }
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-log {
  display: flex; flex-direction: column; gap: 6px; height: min(44vh, 380px); overflow-y: auto; padding: 10px;
  background: #fffdf6; border-radius: 14px; box-shadow: inset 0 0 0 2px var(--paper-2);
}
.chat-older { align-self: center; }
.chat-empty { text-align: center; margin: auto; }
.chat-msg { display: flex; align-items: flex-end; gap: 6px; max-width: 82%; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.theirs { align-self: flex-start; }
.chat-bubble { padding: 7px 11px; border-radius: 16px; background: var(--paper-2); overflow-wrap: anywhere; white-space: pre-wrap; font-weight: 700; }
.chat-msg.mine .chat-bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-img { display: block; max-width: 100%; width: 240px; height: auto; border-radius: 10px; }
.chat-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chat-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; opacity: 0; }
.chat-msg:hover .chat-del, .chat-del:focus-visible { opacity: 1; }
.chat-form { display: flex; gap: 6px; }
.chat-input { flex: 1; min-width: 0; font: 700 15px var(--font); }
.online input[type="text"] {
  padding: 8px 12px; border-radius: 12px; border: 3px solid var(--paper-3); background: #fff; color: var(--ink);
  user-select: text; box-shadow: inset 0 2px 3px rgba(122, 68, 24, 0.12);
}
.online input[type="text"]:focus { outline: none; border-color: var(--gold); }
.online input[type="email"] {
  padding: 8px 12px; border-radius: 12px; border: 3px solid var(--paper-3); background: #fff; color: var(--ink);
  font: 700 15px var(--font); user-select: text; box-shadow: inset 0 2px 3px rgba(122, 68, 24, 0.12);
}
.online input[type="email"]:focus { outline: none; border-color: var(--gold); }
.code-input { width: 190px; font: 700 20px var(--display) !important; letter-spacing: 3px; text-align: center; }
.soft-rule { border: 0; border-top: 2px dashed var(--paper-3); margin: 6px 0; }
.online a { color: var(--green-dark, #2f7d32); font-weight: 800; }

/* ---------- language picker ---------- */
.setting.lang-setting { grid-template-columns: 130px 1fr; }
.lang-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-picker .lang-btn { min-width: 96px; }

/* ---------- visiting a friend's farm ---------- */
#visit-banner {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: auto;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: rgba(255, 249, 235, 0.96); box-shadow: 0 0 0 3px var(--wood-light, #c98a4b), 0 6px 16px rgba(0, 0, 0, 0.25);
  max-width: calc(100vw - 32px);
}
#visit-banner .visit-title { display: flex; flex-direction: column; font: 700 16px var(--display); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#visit-banner .visit-title small { font: 700 12px var(--font); color: var(--muted); }
.guestbook { width: min(420px, 92vw); }
.guestbook-input {
  width: 100%; box-sizing: border-box; resize: none; padding: 10px 12px; border-radius: 12px; border: 3px solid var(--paper-3);
  font: 700 15px var(--font); color: var(--ink); background: #fff; user-select: text;
}
.guestbook-input:focus { outline: none; border-color: var(--gold); }
.guestbook-note { font-weight: 700; font-style: italic; overflow-wrap: anywhere; }
/* your own orders, tasks and tips stay out of the way while you're away */
body.visiting #tracker, body.visiting #tasks, body.visiting #hint { display: none !important; }
@media (max-width: 560px) {
  #visit-banner { top: 76px; padding: 6px 8px 6px 12px; gap: 6px; }
  #visit-banner .visit-title { font-size: 14px; }
}
.sign-in { width: min(440px, 92vw); }
.sign-in-body { display: flex; flex-direction: column; gap: 4px; }

/* Short windows (a laptop browser with toolbars): tighter title screen and pause menu */
@media (max-height: 640px) {
  .title .logo-line { font-size: 52px; }
  .title .logo { margin-top: -60px; }
  .title .tagline { margin: 4px 0 8px; font-size: 14px; }
  .title .menu-buttons .btn.wide, .pause .menu-buttons .btn.wide { padding-top: 7px; padding-bottom: 7px; }
  .title .menu-buttons, .pause .menu-buttons { gap: 7px; }
  /* title: Continue / Load from cloud stay full width, the other choices pair up */
  .title .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .title .menu-buttons .btn.primary, .title .menu-buttons .btn.gold { grid-column: 1 / -1; }
  .title .menu-buttons .btn.wide { width: auto; }
  .title > .muted.small:last-child { display: none; } /* the "prototype" footnote */
}

/* --- Farm tiers (PRD §5.32, §7.19) --- */
.tier-next { margin: 4px 0 6px; text-align: center; }
.tier-next .tier-name { font-weight: 900; color: var(--green-dark); }
.tier-buildings { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.tier-buildings .chip { background: var(--paper-2); border-radius: 999px; padding: 3px 10px; font-weight: 800; font-size: 13px; }
.reqs .mats { display: flex; flex-wrap: wrap; gap: 6px; }
.reqs .mat { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; border-radius: 10px; padding: 2px 8px 2px 4px; background: #f4efe2; }
.reqs .mat .mini-icon .icon { width: 22px; height: 22px; }
.reqs .mat.met { color: var(--green-dark); }
.reqs .mat.miss { color: var(--red-dark); }
.house-next .buy-missing { margin-top: 6px; }

/* --- Ranch: the store's Farm tab and the animal panel (Milestone 1.5e) --- */
.farm-grid .grid-title { grid-column: 1 / -1; margin: 6px 0 0; font-size: 16px; font-weight: 900; color: var(--brown-dark, #6b4423); }
.shop-card.wide .card-info { min-height: 0; }
.shop-card.done { box-shadow: inset 0 0 0 3px var(--green), 0 3px 0 var(--green-dark); }
.shop-card .cost { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; }
.shop-card .mats { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.shop-card .mat { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 12px; border-radius: 8px; padding: 1px 6px 1px 2px; background: #f4efe2; }
.shop-card .mat .mini-icon .icon { width: 18px; height: 18px; }
.shop-card .mat.met { color: var(--green-dark); }
.shop-card .mat.miss { color: var(--red-dark); }
.shop-card .owned { font-weight: 900; color: var(--green-dark); font-size: 13px; }
.card-actions.col { flex-direction: column; align-items: stretch; }
.animal-panel .trough { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: #fffdf6; border-radius: 14px; padding: 8px 12px; box-shadow: inset 0 0 0 3px var(--paper-2); }
.animal-panel .trough .bar { flex: 1; height: 10px; border-radius: 6px; background: #eadfc6; overflow: hidden; }
.animal-panel .trough .bar > div { height: 100%; background: #e8c55a; }
.animal-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-height: 46vh; overflow-y: auto; }
.animal-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: #fffdf6; border-radius: 14px; padding: 8px 12px; box-shadow: inset 0 0 0 3px var(--paper-2); }
.animal-row .face { font-size: 32px; text-align: center; }
.animal-row .who strong { display: block; }
.animal-row .hearts { color: #e0476b; letter-spacing: 1px; font-size: 13px; }
.animal-row .state { font-size: 12px; color: var(--muted, #8a7a66); }
.animal-panel .menu-row { flex-wrap: wrap; }
.act-btn.ride.on { box-shadow: inset 0 0 0 3px var(--green), 0 3px 0 var(--green-dark); background: #e9f7dc; }
.act-btn[hidden] { display: none; }

/* --- zoom (camera) --- */
.zoom-btns { display: flex; gap: 4px; align-items: center; }
.round-btn.small { width: 34px; height: 34px; font-size: 19px; font-weight: 900; color: #fff; border-width: 2px; }

/* seed seasons in the shop (src/ui/shopPanel.js) */
.card-seasons { display: flex; gap: 2px; justify-content: center; font-size: 12px; line-height: 1; }
.card-seasons .off { filter: grayscale(1); opacity: .3; }
.shop-card.off-season { opacity: .72; }
.shop-card.off-season .card-art { filter: saturate(.5); }

/* --- 🎁 Gifts: the daily gift week and inviting friends (src/ui/giftPanel.js) --- */
.gift-body { display: flex; flex-direction: column; gap: 10px; }
.gift-week { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gift-day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 10px;
  border-radius: 14px; background: #fff; border: 2px solid #ecdcc0; text-align: center; min-height: 104px;
}
.gift-day.big { grid-column: span 2; background: linear-gradient(#fff6dd, #ffe7b0); border-color: #f2c66a; }
.gift-day.today { border-color: #6fbf3f; box-shadow: 0 0 0 3px rgba(111, 191, 63, .25); animation: gift-glow 1.6s ease-in-out infinite; }
.gift-day.taken { opacity: .55; }
.gift-day-n { font: 700 13px var(--display); color: #8a6a48; }
.gift-part { display: flex; flex-direction: column; align-items: center; }
.gift-part .icon { width: 36px; height: 36px; font-size: 26px; }
.gift-part small { font-weight: 800; font-size: 11px; line-height: 1.15; }
.gift-part.rare small { color: #b0660a; }
.gift-check { position: absolute; top: 4px; right: 8px; font-weight: 900; color: #3f8f2e; }
@keyframes gift-glow { 50% { box-shadow: 0 0 0 6px rgba(111, 191, 63, .12); } }
.invite-hero { background: #fff6dd; border: 2px solid #f2d79c; border-radius: 14px; padding: 10px 12px; }
.invite-hero p { margin: 0 0 8px; font-weight: 700; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-link { display: block; font-size: 12px; word-break: break-all; color: #5c3a1e; }
.milestones { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.milestone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px;
  border-radius: 14px; background: #fff; border: 2px dashed #e2cfa9; text-align: center;
}
.milestone.done { border-style: solid; border-color: #9fd36f; background: #f1fbe6; }
.ms-count { font: 700 13px var(--display); color: #8a6a48; }
.ms-icon { font-size: 30px; }
.ms-name { font-weight: 800; font-size: 12px; }
.invite-banner {
  display: flex; flex-direction: column; gap: 2px; margin: 4px auto 10px; padding: 10px 14px; max-width: 420px;
  border-radius: 14px; background: #fff0cc; border: 2px solid #f2c66a; color: #7a4a10; font-weight: 700; text-align: center;
}

/* --- 🏆 the weekly event tab (src/ui/giftPanel.js) --- */
.event-hero { display: flex; gap: 12px; align-items: center; background: #eef7ff; border: 2px solid #b9d9f2; border-radius: 14px; padding: 10px 12px; }
.event-hero p { margin: 4px 0 0; }
.eh-icon { font-size: 42px; }
.event-me { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: center; font-weight: 700; }
.event-me strong { font: 700 22px var(--display); color: #5c3a1e; }
.event-goals { display: flex; flex-direction: column; gap: 8px; }
.event-goal { background: #fff; border: 2px solid #ecdcc0; border-radius: 12px; padding: 8px 10px; position: relative; }
.event-goal.done { border-color: #9fd36f; background: #f1fbe6; }
.eg-head { display: flex; justify-content: space-between; }
.eg-bar { height: 8px; border-radius: 4px; background: #f0e4cf; overflow: hidden; margin: 6px 0; }
.eg-bar span { display: block; height: 100%; background: linear-gradient(90deg, #8fd16a, #5aa845); }
.eg-gifts { display: flex; flex-wrap: wrap; gap: 10px; }
.gift-part.inline { flex-direction: row; gap: 4px; align-items: center; }
.gift-part.inline .icon { width: 26px; height: 26px; font-size: 20px; }
.event-top { display: flex; flex-direction: column; gap: 4px; }
.event-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #fff; }
.event-row.me { background: #fff0cc; }
.er-rank { width: 34px; font-weight: 900; text-align: center; }
.er-name { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-hint { margin: -4px 0 6px; font-size: 13px; opacity: 0.75; text-align: right; }

/* ---------- phones (portrait): everything inside the screen, nothing on top of the action buttons ---------- */
@media (max-width: 720px) {
  .modal-backdrop { padding: 30px 10px 12px; }
  .panel { min-width: 0; max-width: calc(100vw - 20px); padding: 16px 14px; }
  .shop-panel { width: calc(100vw - 20px); }
  .panel.framed { padding-top: 32px; }
  .close-x { top: -14px; right: -6px; width: 38px; height: 38px; font-size: 18px; }
  .with-tabs, .online .with-tabs { grid-template-columns: minmax(0, 1fr); } /* the tab strip scrolls instead of widening the panel */
  .gift-week { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .setting { grid-template-columns: 104px minmax(0, 1fr) 40px; gap: 8px; }
  .setting input[type="range"] { min-width: 0; width: 100%; }
  .setting.lang-setting { grid-template-columns: 104px minmax(0, 1fr); }
  .gift-part small { font-size: 10px; overflow-wrap: anywhere; }
  /* the menu column sits above the tool / hand / ride buttons (which end ~300px up) */
  .hud-side { bottom: 304px; gap: 6px; }
  .side-btn { width: 52px; padding: 4px 2px 3px; font-size: 10px; border-radius: 14px; }
  .side-ico { font-size: 20px; }
}
@media (max-width: 720px) and (max-height: 860px) {
  .side-btn > span:not(.side-ico):not(.side-badge) { display: none; } /* phones: six buttons fit as icons only */
  .side-btn { width: 44px; padding: 5px 2px; }
}
/* touch screens: no keyboard, so no key chip on the "Go inside" style prompts */
@media (pointer: coarse) {
  #prompt kbd { display: none; }
}

/* ---------- Fishing Arena ---------- */
.arena-body { display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.arena-form, .arena-lobby { display: flex; flex-direction: column; gap: 10px; }
.arena-pick .btn { min-width: 110px; }
.arena-stake { width: 90px; font: 700 16px var(--font); padding: 4px 8px; border-radius: 8px; border: 2px solid #e0cfae; }
.arena-code { width: 96px; font: 700 16px var(--display); letter-spacing: 2px; text-transform: uppercase; padding: 4px 8px; border-radius: 8px; border: 2px solid #e0cfae; }
.arena-join { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arena-friends { max-height: 150px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }
.arena-friends .setting { margin: 4px 0; }
.arena-rules { border-top: 1px dashed #e0cfae; padding-top: 8px; }
.arena-players { display: flex; flex-direction: column; gap: 4px; }
.arena-player { display: grid; grid-template-columns: 28px 1fr auto auto auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #fff; }
.arena-player.me { background: #fff3cf; }
.arena-score { font: 700 18px var(--display); min-width: 44px; text-align: right; }
.arena-gold { font: 800 15px var(--font); }
.arena-gold.up { color: var(--green-dark); }
.arena-gold.down { color: #c0392b; }
.arena-gold.big { font-size: 26px; text-align: center; margin: 6px 0; }
.arena-room-code strong { font: 700 24px var(--display); letter-spacing: 3px; }
.arena-searching { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 0; }
.arena-bot-offer {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin: 6px 0 4px;
  padding: 10px 12px; border-radius: 14px; background: var(--paper-2); animation: decor-in .25s ease-out;
}
.arena-bot-offer p { margin: 0; }
.arena-spinner { font-size: 42px; animation: arena-bob 1s ease-in-out infinite; }
@keyframes arena-bob { 50% { transform: translateY(-8px) rotate(-12deg); } }
.arena-rank { font: 700 20px var(--display); min-width: 40px; text-align: center; }
.arena-invite-head, .arena-result-head { font: 700 22px var(--display); text-align: center; margin: 4px 0 8px; }
.arena-result-head.won { color: #b0660a; }
.arena-challenge, .arena-result { width: min(420px, calc(100vw - 20px)); }
/* the in-match banner, top centre: a VS bar for a 1v1, the top three for a room; catches announced under it */
#arena-hud {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 12; width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; pointer-events: none;
}
#arena-hud[hidden] { display: none; }
.arena-scores {
  padding: 6px 10px 7px; border-radius: 18px; background: rgba(255, 250, 240, 0.95);
  border: 3px solid var(--wood); box-shadow: 0 4px 0 rgba(122, 68, 24, 0.4);
}
.arena-clock { font: 700 20px var(--display); color: var(--wood-ink); text-align: center; line-height: 1; }
.arena-clock.hurry { color: #c0392b; animation: chip-bump .5s ease infinite; }
/* 1v1 */
.vs-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.vs-side { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vs-side.rival { flex-direction: row-reverse; text-align: right; }
.vs-face { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: var(--paper-2); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--wood-light); }
.vs-side.me .vs-face { box-shadow: 0 0 0 2px #5aa845; }
.vs-side.rival .vs-face { box-shadow: 0 0 0 2px #e3735e; }
.vs-side.ahead .vs-face { animation: chip-bump .6s ease; }
.vs-face.small { width: 24px; height: 24px; font-size: 14px; border-width: 1px; }
.vs-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vs-side.rival .vs-who { align-items: flex-end; }
.vs-name { font: 800 13px var(--font); color: var(--wood-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.vs-side.me .vs-name { color: var(--green-dark); }
.vs-pts { font: 700 24px var(--display); color: var(--wood-ink); min-width: 30px; text-align: center; }
.vs-mid { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.vs-x { font-size: 13px; }
.arena-doing { display: flex; align-items: center; gap: 4px; height: 16px; }
.vs-side.rival .arena-doing { flex-direction: row-reverse; }
.arena-st { font-size: 13px; line-height: 1; }
.arena-doing.s-bite .arena-st { animation: chip-bump .4s ease infinite; }
.arena-doing.s-caught .arena-st { animation: arena-pop .6s ease-out; }
.arena-reel { display: block; width: 46px; height: 5px; border-radius: 3px; background: rgba(122, 68, 24, 0.18); overflow: hidden; }
.arena-reel > span { display: block; height: 100%; background: linear-gradient(90deg, #62b34a, #9ad35a); transition: width .3s linear; }
.tug-bar { height: 10px; margin-top: 5px; border-radius: 6px; background: #e3735e; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.tug-me { height: 100%; background: linear-gradient(90deg, #4f9a3c, #7cc45c); border-right: 2px solid #fff; transition: width .5s ease; }
.tug-note { font: 800 11.5px var(--font); color: var(--wood-ink); text-align: center; margin-top: 2px; }
/* a room */
.arena-scores.room { display: flex; flex-direction: column; gap: 3px; }
.arena-row { display: grid; grid-template-columns: 22px 24px 1fr auto 34px; gap: 6px; align-items: center; font: 800 13px var(--font); color: var(--wood-ink); }
.arena-row.me { color: var(--green-dark); }
.arena-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arena-pts { font: 700 16px var(--display); text-align: right; }
/* someone else's catch, announced under the banner */
.arena-news { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arena-news-line {
  max-width: 100%; padding: 4px 12px; border-radius: 999px; background: rgba(255, 250, 240, 0.95); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--wood-light), 0 3px 8px rgba(0, 0, 0, .18); font: 800 13px var(--font); color: var(--wood-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: fish-catch-in .35s cubic-bezier(.2, 1.5, .4, 1); transition: opacity .5s ease;
}
.arena-news-line.big { font-size: 15px; box-shadow: 0 0 0 2px #e8b730, 0 3px 10px rgba(232, 183, 48, .45); }
.arena-news-line.lost { font-size: 12px; opacity: .85; }
.arena-news-line.gone { opacity: 0; }
/* my own catch card drops below the banner while in a match */
body.in-arena .fish-catches { top: 46%; }
/* the time of day steps aside for the match clock (on phones it sits right where the banner goes) */
body.in-arena .clock-card { display: none; }
#arena-count {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; pointer-events: none;
  font: 700 120px var(--display); color: #fff; text-shadow: 0 6px 0 var(--wood-dark), 0 0 24px rgba(0, 0, 0, 0.35);
}
#arena-count[hidden] { display: none; }
#arena-count.pop { animation: arena-pop .8s ease-out; }
@keyframes arena-pop { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: .9; } }
body.in-arena #tracker, body.in-arena #tasks, body.in-arena #hint { display: none !important; }
@media (max-width: 720px) {
  #arena-hud { top: 100px; } /* under the menu and zoom buttons */
  .vs-pts { font-size: 20px; }
  .vs-face { width: 28px; height: 28px; font-size: 16px; }
  .arena-player { grid-template-columns: 24px 1fr auto auto; }
  .arena-player .muted { display: none; }
}
/* "Sell your seeds?" asked right where you clicked */
.sell-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.sell-confirm > span { flex-basis: 100%; text-align: center; font-weight: 800; color: #9a4b0c; }
.bin-confirm { margin: 6px 0 10px; padding: 8px 10px; border-radius: 12px; background: #fff3cf; border: 2px solid #f2c66a; }
.bin-confirm[hidden] { display: none; }
/* the pet's card: guard training and the farm log */
.pet-panel { width: min(440px, calc(100vw - 20px)); }
.pet-card { display: flex; flex-direction: column; gap: 10px; }
.pet-head { display: flex; align-items: center; gap: 12px; }
.pet-face { font-size: 44px; }
.pet-hearts { font-size: 14px; letter-spacing: 1px; }
.pet-guard { padding: 8px 10px; border-radius: 12px; background: #fff; border: 2px solid #ecdcc0; }
.pet-guard p { margin: 4px 0 0; }
.pet-on { color: var(--green-dark); font-weight: 800; }
.pet-off { color: #b0660a; font-weight: 800; }
.pet-log { max-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.pet-log-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 4px 6px; border-radius: 8px; background: #fff; }

/* --- the Arcade (ui/arcadePanel.js): a wall of game screens, and a game played in a frame --- */
.arcade-panel { width: min(640px, calc(100vw - 20px)); }
.arcade-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; max-height: min(62vh, 560px); overflow-y: auto; padding: 4px; }
.arcade-screen {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 8px 8px 10px; text-align: left; cursor: pointer;
  border-radius: 16px; border: 3px solid #2a1d4a; background: linear-gradient(#6a4aa8, #4a3380); color: #fff3d6;
  box-shadow: 0 4px 0 #2a1d4a; font: inherit; transition: transform .12s ease;
}
.arcade-screen:hover { transform: translateY(-2px); }
.arcade-screen:active { transform: translateY(1px); }
.arcade-screen .muted { color: #d9c9ff; }
.arcade-glass {
  position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #101018;
  border: 3px solid #1b1230; box-shadow: inset 0 0 18px rgba(124, 240, 255, .35), 0 0 12px rgba(124, 240, 255, .25);
}
.arcade-glass img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arcade-play {
  position: absolute; inset: auto 8px 8px auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #ffd84a; color: #2a1d4a; font-size: 18px; box-shadow: 0 3px 0 #b8901a; animation: chip-bump 1.6s ease infinite;
}
.arcade-title { font: 700 17px var(--display); margin-top: 4px; }
.arcade-blurb { line-height: 1.3; }
.arcade-screen.soon { cursor: default; opacity: .75; }
.arcade-screen.soon:hover { transform: none; }
.arcade-static { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px;
  background: repeating-linear-gradient(0deg, #222 0 2px, #333 2px 4px); animation: arcade-static .25s steps(2) infinite; }
@keyframes arcade-static { to { background-position: 0 4px; } }
.arcade-player { width: auto; max-width: calc(100vw - 16px); }
.arcade-frame {
  height: min(calc(100vh - 170px), 800px); max-width: calc(100vw - 40px); margin: 0 auto; border-radius: 12px; overflow: hidden;
  background: #101018; border: 3px solid #2a1d4a; box-shadow: 0 0 16px rgba(124, 240, 255, .3);
}
.arcade-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@supports (height: 100dvh) { .arcade-frame { height: min(calc(100dvh - 170px), 800px); } }
