:root {
  --sky: #bfe2fb;
  --ink: #4a2f1c;
  --ink-soft: #7a5a40;
  --paper: #fff8ea;
  --paper-2: #f6e8cc;
  --wood: #b8834f;
  --wood-dark: #8a5a32;
  --green: #5cb84a;
  --green-dark: #3f8f33;
  --orange: #f29a2e;
  --red: #e2533b;
  --blue: #3f8fd6;
  --gold: #ffcf3d;
  --shadow: 0 4px 0 rgba(90, 55, 25, 0.35), 0 10px 24px rgba(40, 70, 110, 0.18);
  --radius: 18px;
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); }
body { font-family: var(--font-body); color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
[hidden] { display: none !important; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui > * { pointer-events: auto; }
#ui .labels, #ui .floaters, #ui .toasts { pointer-events: none; }
svg { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ico { width: 40px; height: 40px; object-fit: contain; flex: none; }
.ico.big { width: 84px; height: 84px; }

/* ---------- shared pieces ---------- */
.panel, .sheet-card, .modal-card, .tray, .bubble, .fishui, .buildbar, .placebar {
  background: var(--paper);
  border: 3px solid var(--wood-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 -4px 0 var(--paper-2);
}
.round-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: var(--paper); color: var(--wood-dark);
  border: 3px solid var(--wood-dark);
  box-shadow: 0 3px 0 rgba(90, 55, 25, 0.4);
  transition: transform 0.12s;
}
.round-btn:active { transform: translateY(2px) scale(0.96); box-shadow: 0 1px 0 rgba(90, 55, 25, 0.4); }
.round-btn.small { width: 36px; height: 36px; font-size: 18px; }
.round-btn.red { background: #ffe1d9; color: var(--red); border-color: #b5402c; }
.round-btn.green { background: #e2f7d8; color: var(--green-dark); border-color: var(--green-dark); }
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 6px 16px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  background: #fff; color: var(--ink); border: 3px solid var(--wood);
  box-shadow: 0 3px 0 rgba(90, 55, 25, 0.35);
}
.pill-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(90, 55, 25, 0.35); }
.pill-btn:disabled { opacity: 0.45; cursor: default; }
.pill-btn.green { background: var(--green); color: #fff; border-color: var(--green-dark); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.pill-btn.orange { background: var(--orange); color: #fff; border-color: #c06f12; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.pill-btn.red { background: var(--red); color: #fff; border-color: #a83a26; }
.pill-btn.wide { width: 100%; margin-top: 14px; }
.big-btn {
  display: block; width: 100%; min-height: 54px; margin-top: 14px; border-radius: 16px;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: 0.3px;
  background: var(--green); color: #fff; border: 3px solid var(--green-dark);
  box-shadow: 0 5px 0 var(--green-dark); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--green-dark); }
.row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- HUD ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.lvl { display: flex; align-items: center; position: relative; }
.lvl-star { position: relative; width: 58px; height: 58px; z-index: 1; filter: drop-shadow(0 3px 0 rgba(150, 90, 10, 0.45)); }
.lvl-star svg { width: 58px; height: 58px; }
.lvl-star b { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 4px; font: 800 20px/1 var(--font-display); color: #7a4a0c; }
.xpbar {
  position: relative; width: 132px; height: 26px; margin-left: -14px;
  background: #6a4a2c; border: 3px solid var(--wood-dark); border-radius: 0 999px 999px 0;
  overflow: hidden; box-shadow: var(--shadow);
}
.xpbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(#9de06b, #5cb84a); transition: width 0.5s cubic-bezier(.2, .9, .3, 1.2); }
.xpbar em { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 10px; font: 700 13px/1 var(--font-display); font-style: normal; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.coins {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 16px 0 6px; border-radius: 999px;
  background: #6a4a2c; border: 3px solid var(--wood-dark); box-shadow: var(--shadow);
  color: #fff; font: 800 19px/1 var(--font-display);
}
.coins svg { width: 30px; height: 30px; }
.coins.pop, .dock-btn.pop { animation: pop 0.35s; }
@keyframes pop { 40% { transform: scale(1.18); } }

.wx {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 8px; border-radius: 999px;
  background: rgba(255, 248, 234, 0.92); border: 3px solid var(--wood-dark); box-shadow: var(--shadow);
  font: 700 14px/1 var(--font-display); color: var(--ink); white-space: nowrap; max-width: 46vw; overflow: hidden;
}
.wx svg { width: 26px; height: 26px; }
.wx span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 10px;
}
.dock-btn {
  position: relative; width: 84px; height: 76px; border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(#c9935c, #a8713f); border: 3px solid var(--wood-dark);
  box-shadow: 0 5px 0 var(--wood-dark), 0 12px 22px rgba(40, 70, 110, 0.2);
  color: #fff; font: 700 14px/1.1 var(--font-display); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.dock-btn svg { width: 34px; height: 34px; color: var(--wood-dark); }
.dock-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--wood-dark); }
.badge {
  position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); border: 3px solid #fff; color: #fff; font: 800 13px/1 var(--font-display);
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---------- toasts / floaters ---------- */
.toasts { position: fixed; top: calc(78px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 30; width: max-content; max-width: 92vw; }
.toast {
  padding: 9px 16px; border-radius: 999px; background: rgba(60, 38, 20, 0.88); color: #fff;
  font: 700 15px/1.25 var(--font-body); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  animation: toastIn 0.25s; text-align: center;
}
.toast svg { margin: 0 2px; }
.toast.good { background: rgba(52, 120, 44, 0.92); }
.toast.bad { background: rgba(170, 55, 35, 0.92); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: 0.35s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
.floaters { position: fixed; inset: 0; z-index: 40; }
.flyer { position: fixed; left: 0; top: 0; margin: -22px 0 0 -22px; display: flex; align-items: center; transition: transform 0.85s cubic-bezier(.55, -0.2, .7, .5); }
.flyer .ico { width: 44px; height: 44px; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.25)); }
.flyer .ico svg { width: 36px; height: 36px; }
.flyer b { font: 800 18px/1 var(--font-display); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 6px rgba(0, 0, 0, 0.3); }
.float-text {
  position: fixed; transform: translate(-50%, -50%); z-index: 41;
  font: 800 18px/1 var(--font-display); color: #fff; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); animation: rise 1.3s forwards;
}
.float-text.xp { color: #fff3b0; }
.float-text.gold { color: var(--gold); font-size: 22px; }
.float-text.coin { color: #ffd0c8; font-size: 16px; }
@keyframes rise { to { transform: translate(-50%, -260%); opacity: 0; } }

/* ---------- anchored: tray, bubble, bite, selbar ---------- */
.anchored { position: fixed; left: 0; top: 0; z-index: 10; will-change: transform; }
.tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; max-width: min(92vw, 440px); }
.tray-item {
  width: 76px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 2px 5px; border-radius: 14px; background: #fff; border: 2px solid var(--paper-2);
  font: 700 13px/1.1 var(--font-display); touch-action: none;
}
.tray-item .ico { width: 46px; height: 46px; pointer-events: none; }
.tray-item small { display: flex; align-items: center; gap: 2px; font: 700 11px/1 var(--font-body); color: var(--ink-soft); white-space: nowrap; }
.tray-item.on { border-color: var(--green); background: #effbe8; box-shadow: 0 0 0 3px rgba(92, 184, 74, 0.35); }
.tray-item.poor { opacity: 0.6; }
.tray-item.locked { opacity: 0.45; filter: grayscale(0.7); }
.tray-item.rod { background: #e6f5ff; border-color: #9fd3f5; }
.tray-item.rod svg { width: 46px; height: 46px; }
.tray-hint { width: 100%; margin: 2px 4px 0; font: 600 12px/1.2 var(--font-body); color: var(--ink-soft); text-align: center; }
.bubble { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; font: 700 14px/1.2 var(--font-display); }
.bubble div { display: flex; flex-direction: column; gap: 2px; min-width: 110px; }
.bubble span { display: flex; align-items: center; gap: 4px; font: 700 13px/1 var(--font-body); color: var(--ink-soft); }
.prog { display: block; height: 7px; border-radius: 9px; background: var(--paper-2); overflow: hidden; margin-top: 3px; }
.prog i { display: block; height: 100%; background: var(--green); border-radius: 9px; }
.bite {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50% 50% 50% 6px;
  background: var(--gold); border: 3px solid #c48a12; color: #7a3a0c; font: 800 34px/1 var(--font-display);
  animation: bite 0.35s infinite alternate; pointer-events: none;
}
@keyframes bite { to { margin-top: -8px; } }
.selbar { display: flex; gap: 8px; }
.say {
  max-width: 220px; padding: 7px 12px; border-radius: 16px 16px 16px 4px; pointer-events: none;
  background: #fff; border: 2px solid var(--wood); color: var(--ink);
  font: 700 14px/1.25 var(--font-display); box-shadow: 0 4px 12px rgba(40, 60, 90, 0.18); animation: toastIn 0.25s;
}

/* ---------- fishing ---------- */
.fishui {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(94vw, 420px); padding: 12px 14px; text-align: center;
}
.fish-status { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; font: 700 16px/1.3 var(--font-display); }
.fish-status .xp { display: inline-flex; align-items: center; color: #b07a0c; }
.reel { position: relative; height: 26px; margin: 6px 4px 10px; border-radius: 999px; background: #e7d8b8; border: 3px solid var(--wood-dark); overflow: hidden; }
.reel-zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(#8fe07a, #4fae3f); }
.reel-needle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--red); border-radius: 3px; box-shadow: 0 0 0 2px #fff; }
.fish-btns { display: flex; gap: 10px; align-items: center; }
.fish-btns .big-btn { margin: 0; flex: 1; background: #b9b0a0; border-color: #8a8070; box-shadow: 0 5px 0 #8a8070; }
.fish-btns .big-btn.hot { background: var(--orange); border-color: #c06f12; box-shadow: 0 5px 0 #c06f12; animation: pulse 0.6s infinite; }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(40, 60, 90, 0.35); padding: 16px; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.sheet-card { width: min(620px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; overflow: hidden; animation: up 0.25s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes up { from { transform: translateY(24px) scale(0.97); } }
.sheet-card header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px 18px; background: linear-gradient(#c9935c, #a8713f); border-bottom: 3px solid var(--wood-dark); }
.sheet-card h2 { margin: 0; display: flex; align-items: center; gap: 8px; font: 800 24px/1 var(--font-display); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.sheet-card h2 svg { width: 30px; height: 30px; }
.sheet-body { padding: 14px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.card { background: #fff; border: 2px solid var(--paper-2); border-radius: 16px; padding: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card.item { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; font: 700 16px/1.1 var(--font-display); }
.card.item .ico { width: 56px; height: 56px; }
.card.item .qty { position: absolute; top: 8px; right: 10px; font: 800 18px/1 var(--font-display); color: var(--wood-dark); }
.card.item .pill-btn { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.foot { margin: 12px 4px 0; font: 600 13px/1.4 var(--font-body); color: var(--ink-soft); }
.empty { text-align: center; padding: 18px; font: 600 16px/1.5 var(--font-body); color: var(--ink-soft); }
.orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
.card.order { display: flex; flex-direction: column; gap: 8px; }
.card.order .row { flex-wrap: nowrap; margin-top: auto; }
.card.order .pill-btn { padding: 6px 12px; }
.card.order.ready { border-color: var(--green); box-shadow: 0 0 0 3px rgba(92, 184, 74, 0.25); }
.card.order.waiting { align-items: center; justify-content: center; text-align: center; color: var(--ink-soft); font: 700 15px/1.3 var(--font-display); min-height: 180px; }
.card.order.waiting svg { width: 34px; height: 34px; }
.who { display: flex; align-items: center; gap: 8px; font: 700 16px/1 var(--font-display); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--h) 70% 82%); color: hsl(var(--h) 45% 32%); font: 800 16px/1 var(--font-display); border: 2px solid #fff; box-shadow: 0 0 0 2px hsl(var(--h) 45% 60%); }
.order ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.order li { display: flex; align-items: center; gap: 6px; font: 700 14px/1.1 var(--font-body); }
.order li .ico { width: 34px; height: 34px; }
.order li em { margin-left: auto; font-style: normal; font: 800 14px/1 var(--font-display); color: var(--red); }
.order li.ok em { color: var(--green-dark); }
.reward { display: flex; align-items: center; gap: 4px; font: 800 17px/1 var(--font-display); }
.reward svg { width: 22px; height: 22px; }
.reward .xp { margin-left: 10px; display: inline-flex; align-items: center; gap: 4px; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px; font: 700 17px/1 var(--font-display); border-bottom: 2px dashed var(--paper-2); cursor: pointer; }
.switch span { display: flex; align-items: center; gap: 8px; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 52px; height: 30px; border-radius: 999px; background: #d8c8a8; position: relative; transition: 0.2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); transition: 0.2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { left: 25px; }
.switch input:focus-visible + i { outline: 3px solid var(--blue); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.stats div { background: #fff; border-radius: 14px; padding: 10px 4px; border: 2px solid var(--paper-2); }
.stats b { display: block; font: 800 24px/1 var(--font-display); }
.stats span { font: 600 12px/1.2 var(--font-body); color: var(--ink-soft); }
.help { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font: 600 15px/1.45 var(--font-body); }
.unlock-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.unlock-list > div { display: flex; flex-direction: column; align-items: center; width: 82px; font: 700 13px/1.1 var(--font-display); text-align: center; }
.unlock-list .ico { width: 52px; height: 52px; display: grid; place-items: center; }
.unlock-list .ico svg { width: 40px; height: 40px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(40, 60, 90, 0.4); padding: 16px; animation: fade 0.2s; }
.modal-card { width: min(400px, 100%); padding: 22px 20px 18px; text-align: center; animation: up 0.3s cubic-bezier(.2, .9, .3, 1.3); }
.modal-card h3 { margin: 6px 0 8px; font: 800 26px/1.1 var(--font-display); }
.modal-card p { margin: 6px 0; font: 600 15px/1.45 var(--font-body); }
.modal-card .row { margin-top: 14px; }
.modal-card .row .pill-btn { flex: 1; }
.reward-line { display: flex; align-items: center; justify-content: center; gap: 6px; font: 800 20px/1 var(--font-display) !important; }
.reward-line svg { width: 26px; height: 26px; }
.warn { color: var(--red); font-weight: 800 !important; }
.burst { position: relative; width: 92px; height: 92px; margin: -64px auto 0; animation: spin-in 0.6s cubic-bezier(.2, .9, .3, 1.4); }
.burst svg { width: 92px; height: 92px; filter: drop-shadow(0 4px 0 rgba(150, 90, 10, 0.4)); }
.burst b { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 6px; font: 800 30px/1 var(--font-display); color: #7a4a0c; }
@keyframes spin-in { from { transform: scale(0.3) rotate(-90deg); } }

/* ---------- build mode ---------- */
.buildbar {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(96vw, 760px); padding: 8px 10px 10px; z-index: 5;
}
.build-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 6px; }
.build-head b { font: 800 18px/1 var(--font-display); }
.build-head .hint { font: 600 12px/1.2 var(--font-body); color: var(--ink-soft); }
.build-head .pill-btn { margin-left: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 7px 14px; border-radius: 999px; font: 700 15px/1 var(--font-display); background: var(--paper-2); color: var(--ink-soft); white-space: nowrap; }
.tab.on { background: var(--wood); color: #fff; }
.shop { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; touch-action: pan-x; }
.shop-item {
  position: relative; flex: none; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px 7px; border-radius: 14px; background: #fff; border: 2px solid var(--paper-2);
  font: 700 13px/1.1 var(--font-display); text-align: center;
}
.shop-item .ico { width: 56px; height: 56px; }
.shop-item small { display: flex; align-items: center; gap: 3px; font: 700 12px/1 var(--font-body); color: var(--ink-soft); }
.shop-item.on { border-color: var(--green); background: #effbe8; }
.shop-item.locked { opacity: 0.5; filter: grayscale(0.6); }
.shop-item.poor small { color: var(--red); }
.shop-item .cap { position: absolute; top: 4px; right: 6px; font: 800 11px/1 var(--font-display); font-style: normal; color: var(--wood-dark); }
.shop-item.isle { width: 120px; }
.shop-item.isle.done { opacity: 0.6; }
.isle-art { display: grid; place-items: center; width: 64px; height: 44px; margin: 6px 0 4px; border-radius: 14px; background: linear-gradient(#8fd45f 55%, #a8744a 55%); color: #fff; font: 800 14px/1 var(--font-display); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.placebar {
  position: fixed; left: 50%; bottom: calc(205px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; z-index: 6;
}
.place-info { display: flex; align-items: center; gap: 8px; padding-right: 6px; }
.place-info .ico { width: 40px; height: 40px; }
.place-info span { display: flex; flex-direction: column; font: 700 15px/1.1 var(--font-display); }
.place-info small { font: 600 12px/1.2 var(--font-body); color: var(--ink-soft); }

/* ---------- camera buttons ---------- */
.cam-btns { position: fixed; right: calc(12px + env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 4; }
.cam-btns .round-btn { width: 46px; height: 46px; font-size: 24px; background: rgba(255, 248, 234, 0.92); }

/* ---------- settings extras ---------- */
.sheet-body h4 { display: flex; align-items: center; gap: 6px; margin: 16px 2px 8px; font: 800 17px/1 var(--font-display); }
.sheet-body h4 svg { width: 22px; height: 22px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 14px; background: #fff; border: 2px solid var(--paper-2); font: 700 13px/1.1 var(--font-display); text-align: center; }
.seg button svg { width: 28px; height: 28px; color: #3b4a7a; }
.seg button.on { border-color: var(--green); background: #effbe8; box-shadow: 0 0 0 3px rgba(92, 184, 74, 0.3); }
.slider { display: flex; align-items: center; gap: 10px; margin-top: 10px; font: 700 15px/1 var(--font-display); }
.slider input { flex: 1; accent-color: var(--orange); height: 28px; }
.slider b { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.seg.five { grid-template-columns: repeat(5, 1fr); }
.namebox { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; text-align: left; font: 700 15px/1 var(--font-display); }
.namebox input {
  height: 46px; padding: 0 14px; border-radius: 14px; border: 3px solid var(--wood); background: #fff;
  font: 700 18px/1 var(--font-display); color: var(--ink); user-select: text; -webkit-user-select: text; outline: none;
}
.namebox input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(92, 184, 74, 0.3); }
.away { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.away div { background: #fff; border: 2px solid var(--paper-2); border-radius: 14px; padding: 10px 4px; }
.away b { display: block; font: 800 26px/1 var(--font-display); color: var(--green-dark); }
.away span { font: 600 12px/1.2 var(--font-body); color: var(--ink-soft); }
.dev { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dev .pill-btn { font-size: 14px; padding: 6px 10px; }

/* ---------- islet labels ---------- */
.labels { position: fixed; inset: 0; z-index: 1; }
.islet-label {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.82); border: 2px solid rgba(255, 255, 255, 0.95); color: var(--ink);
  box-shadow: 0 6px 16px rgba(60, 90, 130, 0.18); backdrop-filter: blur(4px);
}
.islet-label svg { width: 24px; height: 24px; }
.islet-label span { display: flex; flex-direction: column; text-align: left; }
.islet-label b { font: 800 14px/1.1 var(--font-display); }
.islet-label small { display: flex; align-items: center; gap: 3px; font: 700 12px/1.1 var(--font-body); color: var(--ink-soft); }
.islet-label.can { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 61, 0.45), 0 6px 16px rgba(60, 90, 130, 0.18); }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .hud-top { gap: 6px; padding-left: 10px; padding-right: 10px; flex-wrap: wrap; }
  .wx { order: 9; height: 34px; font-size: 13px; margin-top: -2px; }
  #btnHelp { display: none; }
  .hud-top .round-btn { width: 40px; height: 40px; font-size: 20px; }
  .coins { padding-right: 12px; font-size: 17px; }
  .seg.five { grid-template-columns: repeat(3, 1fr); }
  .xpbar { width: 80px; }
  .dock-btn { width: 74px; height: 68px; font-size: 13px; }
  .build-head .hint { display: none; }
  .shop-item { width: 82px; }
  .placebar { bottom: calc(196px + env(safe-area-inset-bottom)); }
  .sheet { align-items: flex-end; padding: 0; }
  .sheet-card { border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 82vh; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .orders { grid-template-columns: 1fr 1fr; }
  .tray-item { width: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
