:root {
  --slate: #2d3f56;
  --slate-2: #3a5170;
  --cream: #fff8ec;
  --paper: #fffaf2;
  --coral: #e8897f;
  --coral-deep: #d06c63;
  --pink: #f6c3bb;
  --mint: #8fd3bd;
  --mint-deep: #4fa98e;
  --gold: #f3c34f;
  --gold-hi: #ffe28a;
  --gold-deep: #c18a24;
  --sky: #7cc3ef;
  --ink: #3b3547;
  --ink-soft: #7a7088;
  --ok: #5cbf86;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: 'Nunito', 'Trebuchet MS', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #9fd6f5;
  font-family: var(--font); color: var(--ink);
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#app { position: fixed; inset: 0; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 62%, rgba(40, 52, 90, 0.18) 100%);
}
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
input { font-family: inherit; }

/* ---------- title ---------- */
#title, #fatal {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 50;
  background: linear-gradient(180deg, #4c9be6 0%, #8ccdf3 48%, #e8f6fb 78%, #fff6ec 100%);
  transition: opacity 0.7s ease, visibility 0.7s;
}
#title.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.title-sky {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(circle at 18% 72%, #fff 0 9%, transparent 9.4%),
    radial-gradient(circle at 26% 70%, #fff 0 12%, transparent 12.4%),
    radial-gradient(circle at 36% 76%, #fff 0 8%, transparent 8.4%),
    radial-gradient(circle at 70% 74%, #fff 0 11%, transparent 11.4%),
    radial-gradient(circle at 80% 70%, #fff 0 13%, transparent 13.4%),
    radial-gradient(circle at 90% 78%, #fff 0 9%, transparent 9.4%),
    radial-gradient(ellipse 80% 22% at 50% 100%, #fff 0 60%, transparent 61%);
  animation: titleDrift 18s ease-in-out infinite alternate;
  opacity: 0.95;
}
@keyframes titleDrift { from { transform: translateX(-2%) translateY(0); } to { transform: translateX(2%) translateY(-1.5%); } }
.title-card {
  position: relative; width: min(420px, calc(100vw - 32px));
  padding: 30px 26px 22px; border-radius: 28px; text-align: center;
  background: rgba(255, 250, 242, 0.88);
  box-shadow: 0 18px 50px rgba(47, 74, 120, 0.25), inset 0 0 0 3px rgba(243, 195, 79, 0.55);
  backdrop-filter: blur(6px);
  animation: cardIn 0.8s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes cardIn { from { transform: translateY(30px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.title-card h1 {
  margin: 4px 0 0; font-size: clamp(34px, 9vw, 48px); font-weight: 900; letter-spacing: 0.5px;
  color: #fff; -webkit-text-stroke: 2px var(--gold-deep); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--gold-deep), 0 8px 18px rgba(193, 138, 36, 0.35);
}
.title-sub { margin: 6px 0 16px; font-weight: 800; color: var(--coral-deep); font-size: 17px; }
.title-apple {
  width: 74px; height: 74px; margin: -66px auto 6px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff3b8 0 12%, #ffd75e 30%, #e9a72c 70%, #b67a17 100%);
  box-shadow: 0 8px 18px rgba(182, 122, 23, 0.45), inset 0 -6px 10px rgba(150, 90, 10, 0.35);
  position: relative; animation: bob 2.6s ease-in-out infinite;
}
.title-apple::before {
  content: ''; position: absolute; left: 50%; top: -12px; width: 6px; height: 16px; border-radius: 3px;
  background: #8a5a2b; transform: translateX(-50%) rotate(8deg);
}
.title-apple::after {
  content: ''; position: absolute; left: 52%; top: -14px; width: 22px; height: 12px; border-radius: 0 100% 0 100%;
  background: linear-gradient(135deg, #8fdc6a, #4f9e3c); transform: rotate(-12deg);
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.title-progress { height: 10px; border-radius: 6px; background: rgba(45, 63, 86, 0.12); overflow: hidden; margin: 6px 12px 8px; }
.title-progress i { display: block; height: 100%; width: 4%; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--coral)); transition: width 0.3s ease; }
.title-status { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--ink-soft); min-height: 19px; }
.title-name { display: block; font-weight: 800; font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; }
.title-name input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 18px; font-weight: 800; text-align: center;
  border-radius: 14px; border: 2px solid rgba(232, 137, 127, 0.45); background: #fff; color: var(--ink); outline: none;
  user-select: text; -webkit-user-select: text;
}
.title-name input:focus { border-color: var(--coral); }
.title-hint { margin: 14px 0 0; font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 190px; padding: 15px 28px; border-radius: 999px; font-size: 20px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #f6a093, var(--coral-deep));
  box-shadow: 0 6px 0 #b8564e, 0 12px 24px rgba(208, 108, 99, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8564e, 0 6px 12px rgba(208, 108, 99, 0.3); }
.btn-primary.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-time {
  position: absolute; left: calc(14px + var(--safe-l)); top: calc(10px + var(--safe-t));
  color: #fff; text-shadow: 0 2px 0 rgba(45, 63, 86, 0.35), 0 3px 10px rgba(45, 63, 86, 0.35);
}
.hud-time .clock { font-size: clamp(30px, 6.4vw, 46px); font-weight: 900; line-height: 1; letter-spacing: 0.5px; }
.hud-time .date { margin-top: 4px; font-size: clamp(13px, 2.8vw, 17px); font-weight: 800; opacity: 0.96; }
.hud-center { position: absolute; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 7px; border-radius: 999px;
  background: rgba(45, 63, 86, 0.86); color: #fff; font-weight: 900; font-size: 22px;
  box-shadow: 0 4px 14px rgba(30, 44, 66, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}
.pill .num { min-width: 1.6em; font-variant-numeric: tabular-nums; }
.pill.bump { animation: bump 0.45s cubic-bezier(.2,1.8,.4,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }
.ico-apple {
  width: 32px; height: 32px; border-radius: 50%; position: relative; flex: none;
  background: radial-gradient(circle at 34% 30%, #fff6c4 0 12%, #ffd75e 32%, #e7a42a 72%, #b9801b 100%);
  box-shadow: inset 0 -3px 5px rgba(140, 85, 10, 0.35);
}
.ico-apple::after {
  content: ''; position: absolute; left: 54%; top: -5px; width: 11px; height: 7px; border-radius: 0 100% 0 100%;
  background: linear-gradient(135deg, #9ae071, #4f9e3c); transform: rotate(-14deg);
}
.ico-star { width: 30px; height: 30px; flex: none; display: grid; place-items: center; font-size: 22px; color: var(--gold-hi); text-shadow: 0 0 8px rgba(255, 226, 138, 0.8); }
.pill.stars { padding-left: 10px; font-size: 19px; height: 40px; margin-top: 2px; }
.hud-right { position: absolute; right: calc(12px + var(--safe-r)); top: calc(12px + var(--safe-t)); display: flex; gap: 8px; pointer-events: auto; }
.sq-btn {
  position: relative; width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center;
  background: rgba(45, 63, 86, 0.88); color: #fff; font-size: 23px; font-weight: 900;
  box-shadow: 0 4px 14px rgba(30, 44, 66, 0.28), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.1s ease;
}
.sq-btn:active { transform: scale(0.92); }
.sq-btn .badge {
  position: absolute; right: -5px; top: -5px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px;
  background: var(--coral); color: #fff; font-size: 12px; font-weight: 900; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.burger { width: 20px; height: 15px; display: flex; flex-direction: column; justify-content: space-between; }
.burger i { height: 3px; border-radius: 2px; background: #fff; }
.prompt {
  position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translate(-50%, 10px); opacity: 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 999px;
  background: rgba(255, 250, 242, 0.95); font-weight: 900; font-size: 17px; color: var(--ink);
  box-shadow: 0 6px 20px rgba(45, 63, 86, 0.25); transition: opacity 0.18s ease, transform 0.18s ease; white-space: nowrap;
}
.prompt.on { opacity: 1; transform: translate(-50%, 0); }
.prompt kbd {
  display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 10px;
  background: var(--slate); color: #fff; font-family: inherit; font-size: 15px; font-weight: 900;
}
body.touch .prompt { display: none; }
.hint-line {
  position: absolute; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%);
  padding: 7px 14px; border-radius: 12px; background: rgba(45, 63, 86, 0.6); color: #fff; font-size: 13px; font-weight: 800;
  transition: opacity 0.6s ease; white-space: nowrap;
}
body.touch .hint-line { bottom: calc(190px + var(--safe-b)); white-space: normal; text-align: center; max-width: 80vw; }
.boost { position: absolute; left: calc(14px + var(--safe-l)); top: calc(100px + var(--safe-t)); padding: 5px 12px; border-radius: 999px; background: rgba(143, 211, 189, 0.92); color: #234; font-weight: 900; font-size: 13px; }

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; z-index: 11; pointer-events: none; }
.joy-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 62%; pointer-events: auto; touch-action: none; }
.joy-base {
  position: absolute; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), rgba(255,255,255,0.32));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.65), 0 6px 18px rgba(45, 63, 86, 0.18);
  transition: opacity 0.2s ease; opacity: 0.55;
}
.joy-base.active { opacity: 1; }
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #f3eadb);
  box-shadow: 0 4px 12px rgba(45, 63, 86, 0.35);
}
.joy-base.run .joy-knob { background: radial-gradient(circle at 35% 30%, #fff8d6, var(--gold)); }
.act-cluster { position: absolute; right: calc(18px + var(--safe-r)); bottom: calc(22px + var(--safe-b)); width: 200px; height: 200px; pointer-events: none; }
.btn-act {
  position: absolute; right: 8px; bottom: 8px; width: 96px; height: 96px; border-radius: 50%; pointer-events: auto;
  background: radial-gradient(circle at 38% 30%, #ffb3a7, var(--coral) 55%, var(--coral-deep));
  box-shadow: 0 6px 0 #b8564e, 0 12px 24px rgba(160, 70, 60, 0.35), inset 0 2px 0 rgba(255,255,255,0.4);
  color: #fff; font-size: 34px; display: grid; place-items: center; transition: transform 0.08s ease, filter 0.2s;
}
.btn-act.idle { filter: saturate(0.25) brightness(1.05); opacity: 0.75; }
.btn-act:active, .btn-act.pressed { transform: translateY(4px) scale(0.96); }
.btn-jump, .btn-bag {
  position: absolute; width: 60px; height: 60px; border-radius: 50%; pointer-events: auto; display: grid; place-items: center;
  background: rgba(45, 63, 86, 0.82); color: #fff; font-size: 24px; font-weight: 900;
  box-shadow: 0 4px 12px rgba(30, 44, 66, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-jump { right: 118px; bottom: 6px; }
.btn-bag { right: 104px; bottom: 82px; }
.btn-jump:active, .btn-bag:active { transform: scale(0.92); }
.act-label {
  position: absolute; right: 0; bottom: 116px; max-width: 200px; padding: 7px 13px; border-radius: 14px;
  background: rgba(255, 250, 242, 0.96); color: var(--ink); font-weight: 900; font-size: 15px; text-align: center;
  box-shadow: 0 4px 14px rgba(45, 63, 86, 0.25); opacity: 0; transform: translateY(8px); transition: 0.18s ease;
}
.act-label.on { opacity: 1; transform: none; }
.btn-act .ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid rgba(255, 226, 138, 0.9); animation: ring 1.1s ease-out infinite; opacity: 0; }
.btn-act.hot .ring { opacity: 1; }
@keyframes ring { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }

/* ---------- layer: toasts, cards, dialog, sheets ---------- */
#layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.toasts { position: absolute; left: 50%; top: calc(66px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(92vw, 420px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px; border-radius: 16px;
  background: rgba(255, 250, 242, 0.96); box-shadow: 0 6px 18px rgba(45, 63, 86, 0.22); font-weight: 800; font-size: 15px;
  animation: toastIn 0.35s cubic-bezier(.2,1.5,.4,1) both;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast .ti { font-size: 24px; width: 32px; text-align: center; }
.toast b { color: var(--coral-deep); }
@keyframes toastIn { from { transform: translateY(-16px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
.catch-card {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: min(88vw, 400px); text-align: center; pointer-events: auto;
  padding: 18px 20px 16px; border-radius: 26px; background: rgba(255, 250, 242, 0.97);
  box-shadow: 0 16px 44px rgba(45, 63, 86, 0.3), inset 0 0 0 3px rgba(243, 195, 79, 0.6);
  animation: catchIn 0.55s cubic-bezier(.2,1.6,.35,1) both;
}
.catch-card.out { animation: toastOut 0.3s ease forwards; }
.catch-card .ci { font-size: 64px; line-height: 1.1; animation: bob 2s ease-in-out infinite; display: inline-block; }
.catch-card h3 { margin: 4px 0 2px; font-size: 22px; font-weight: 900; }
.catch-card p { margin: 0; color: var(--ink-soft); font-weight: 700; font-size: 15px; }
.catch-card .tag { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: 999px; background: var(--mint); color: #1f4a3d; font-size: 13px; font-weight: 900; }
.catch-card .tag.new { background: var(--gold); color: #5a3a00; }
@keyframes catchIn { from { transform: translateX(-50%) scale(0.6) rotate(-4deg); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.sparkle-burst { position: absolute; pointer-events: none; font-size: 22px; animation: burst 0.9s ease-out forwards; }
@keyframes burst { from { transform: translate(0,0) scale(0.5); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 0; } }
.fly-icon { position: absolute; font-size: 30px; pointer-events: none; z-index: 30; transition: transform 0.7s cubic-bezier(.5,-0.3,.6,1), opacity 0.7s ease; }

.dialog {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); width: min(94vw, 640px); pointer-events: auto;
  padding: 26px 22px 18px; border-radius: 26px; background: var(--paper);
  box-shadow: 0 12px 40px rgba(45, 63, 86, 0.3), inset 0 0 0 3px rgba(246, 195, 187, 0.9);
  animation: dlgIn 0.3s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes dlgIn { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.dialog .who {
  position: absolute; left: 22px; top: -17px; padding: 6px 18px; border-radius: 999px; font-weight: 900; font-size: 17px; color: #fff;
  background: var(--coral); box-shadow: 0 4px 10px rgba(208, 108, 99, 0.35); transform: rotate(-2deg);
}
.dialog .txt { min-height: 54px; font-size: 18px; font-weight: 700; line-height: 1.38; }
.dialog .more { position: absolute; right: 22px; bottom: 10px; color: var(--coral); font-size: 18px; animation: bob 1s ease-in-out infinite; }
.dialog .choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.chip {
  padding: 10px 16px; border-radius: 999px; font-weight: 900; font-size: 15px; background: #fff; color: var(--ink);
  box-shadow: 0 3px 0 rgba(45, 63, 86, 0.15), inset 0 0 0 2px rgba(45, 63, 86, 0.12); pointer-events: auto;
}
.chip:active { transform: translateY(2px); }
.chip.main { background: var(--coral); color: #fff; box-shadow: 0 3px 0 #b8564e; }
.chip.gold { background: var(--gold); color: #5a3a00; box-shadow: 0 3px 0 var(--gold-deep); }
.chip.mint { background: var(--mint); color: #1f4a3d; box-shadow: 0 3px 0 var(--mint-deep); }
.chip:disabled { opacity: 0.45; }

.backdrop { position: absolute; inset: 0; background: rgba(35, 48, 70, 0.32); pointer-events: auto; animation: fade 0.25s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 680px); max-height: min(86vh, 720px);
  display: flex; flex-direction: column; border-radius: 28px; background: var(--paper); pointer-events: auto; overflow: hidden;
  box-shadow: 0 20px 60px rgba(30, 44, 66, 0.35), inset 0 0 0 3px rgba(243, 195, 79, 0.5);
  animation: sheetIn 0.35s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes sheetIn { from { transform: translate(-50%, -44%) scale(0.94); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
.sheet header { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px 22px; }
.sheet header h2 { flex: 1; margin: 0; font-size: 23px; font-weight: 900; }
.sheet header .x { width: 40px; height: 40px; border-radius: 12px; background: rgba(45, 63, 86, 0.08); font-size: 20px; font-weight: 900; }
.sheet .sub { padding: 0 22px 8px; color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.tabs { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; padding: 8px 15px; border-radius: 999px; font-weight: 900; font-size: 14px; background: rgba(45, 63, 86, 0.07); color: var(--ink-soft); }
.tab.on { background: var(--slate); color: #fff; }
.sheet .body { flex: 1; overflow-y: auto; padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sheet footer { display: flex; gap: 8px; padding: 10px 16px 16px; justify-content: flex-end; flex-wrap: wrap; border-top: 2px dashed rgba(45, 63, 86, 0.08); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot {
  position: relative; aspect-ratio: 1; border-radius: 18px; background: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px rgba(45, 63, 86, 0.08), 0 2px 0 rgba(45, 63, 86, 0.06); font-size: 34px; pointer-events: auto;
}
.slot.empty { background: rgba(45, 63, 86, 0.04); box-shadow: inset 0 0 0 2px rgba(45, 63, 86, 0.05); }
.slot.sel { box-shadow: inset 0 0 0 3px var(--coral), 0 4px 12px rgba(232, 137, 127, 0.35); }
.slot .n { position: absolute; right: 6px; bottom: 4px; font-size: 13px; font-weight: 900; color: var(--ink); background: rgba(255,255,255,0.9); border-radius: 8px; padding: 0 5px; }
.slot .flag { position: absolute; left: 5px; top: 4px; font-size: 12px; }
.slot .nm { position: absolute; left: 4px; right: 4px; bottom: 3px; font-size: 10px; font-weight: 800; color: var(--ink-soft); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.locked { filter: grayscale(1) brightness(0.3); opacity: 0.35; }
.item-info { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 10px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 2px rgba(45, 63, 86, 0.06); }
.item-info .big { font-size: 42px; }
.item-info h4 { margin: 0; font-size: 18px; font-weight: 900; }
.item-info p { margin: 2px 0 0; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.item-info .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 2px rgba(45, 63, 86, 0.06); }
.row .ri { font-size: 30px; width: 40px; text-align: center; flex: none; }
.row .rt { flex: 1; min-width: 0; }
.row .rt b { display: block; font-size: 16px; font-weight: 900; }
.row .rt small { display: block; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.row.done { background: rgba(143, 211, 189, 0.22); }
.bar { height: 8px; border-radius: 5px; background: rgba(45, 63, 86, 0.08); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--mint-deep)); border-radius: 5px; transition: width 0.4s ease; }
.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }
.price .ico-apple { width: 18px; height: 18px; }
.price .ico-apple::after { width: 7px; height: 5px; top: -3px; }
.empty-note { padding: 26px 10px; text-align: center; color: var(--ink-soft); font-weight: 800; }
.settings .row { justify-content: space-between; }
.toggle { width: 58px; height: 32px; border-radius: 999px; background: rgba(45, 63, 86, 0.18); position: relative; flex: none; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.2s; }
.toggle.on { background: var(--mint-deep); }
.toggle.on::after { transform: translateX(26px); }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(45, 63, 86, 0.08); }
.seg button { padding: 6px 11px; border-radius: 999px; font-weight: 900; font-size: 13px; color: var(--ink-soft); }
.seg button.on { background: var(--slate); color: #fff; }
.hearts { color: var(--coral); letter-spacing: 1px; font-size: 14px; }
.place-bar {
  position: absolute; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 10px; pointer-events: auto;
  padding: 10px; border-radius: 999px; background: rgba(255, 250, 242, 0.95); box-shadow: 0 8px 26px rgba(45, 63, 86, 0.3);
}
.place-bar .chip { font-size: 16px; padding: 12px 18px; }
.fish-meter {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, 0); font-size: 46px; font-weight: 900; color: #fff;
  text-shadow: 0 3px 0 var(--coral-deep), 0 0 18px rgba(255,255,255,0.8); animation: pop 0.25s cubic-bezier(.2,2,.4,1);
}
@keyframes pop { from { transform: translate(-50%, 0) scale(0.3); } to { transform: translate(-50%, 0) scale(1); } }
.wish-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(255, 240, 190, 0.5), transparent 60%); animation: fade 0.3s ease reverse forwards; pointer-events: none; }

@media (max-width: 640px), (max-height: 520px) {
  .pill { height: 38px; font-size: 19px; padding-right: 13px; }
  .ico-apple { width: 27px; height: 27px; }
  .pill.stars { height: 34px; font-size: 16px; }
  .ico-star { width: 22px; font-size: 18px; }
  .sq-btn { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; }
  .hud-center { top: calc(10px + var(--safe-t)); }
}
@media (max-width: 520px) {
  .hud-center { left: auto; right: calc(12px + var(--safe-r)); top: calc(62px + var(--safe-t)); transform: none; flex-direction: column; align-items: flex-end; gap: 6px; }
  .toasts { top: calc(150px + var(--safe-t)); }
  .catch-card { top: 26%; }
  .sheet { width: 100vw; max-height: calc(100% - 40px - var(--safe-t)); top: auto; bottom: 0; transform: translateX(-50%); border-radius: 28px 28px 0 0; padding-bottom: var(--safe-b); animation: sheetUp 0.35s cubic-bezier(.2,1.2,.4,1) both; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .dialog .txt { font-size: 17px; }
}
@keyframes sheetUp { from { transform: translate(-50%, 40%); } to { transform: translate(-50%, 0); } }
@media (max-height: 520px) and (orientation: landscape) {
  .act-cluster { transform: scale(0.82); transform-origin: right bottom; }
  .dialog { width: min(70vw, 600px); padding: 20px 18px 12px; }
  .dialog .txt { font-size: 16px; min-height: 40px; }
  .sheet { max-height: 92vh; }
}
/* ---------- additions: input / ui.js ---------- */
.joy-base { left: calc(100px + var(--safe-l)); top: calc(100% - 118px - var(--safe-b)); }
.btn-act .act-ico { position: relative; pointer-events: none; }
.btn-act.hot { animation: pulse 0.7s ease-in-out infinite; }
.btn-act, .btn-jump, .btn-bag { touch-action: none; -webkit-user-select: none; user-select: none; }
.btn-jump.pressed, .btn-bag.pressed { transform: scale(0.92); }
.toasts { z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; max-width: 100%; }
.toast .tt { min-width: 0; }
.hint-line { pointer-events: none; }
.sq-btn.bump { animation: bump 0.45s cubic-bezier(.2,1.8,.4,1); }
.sheet-wrap { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.18s ease; }
.sheet-wrap.out { opacity: 0; pointer-events: none !important; }
.sheet-wrap.out * { pointer-events: none !important; }
.sheet header .x { flex: none; width: 44px; height: 44px; color: var(--ink); }
.sheet footer.hidden { display: none; }
.sheet.small { width: min(90vw, 400px); }
.confirm-text { padding: 26px 24px 18px; font-size: 18px; font-weight: 800; text-align: center; line-height: 1.38; }
.sheet.small footer { justify-content: center; border-top: 0; padding-bottom: 20px; }
.sheet.small footer .chip { min-width: 110px; font-size: 16px; padding: 12px 20px; }
.slot { color: var(--ink); overflow: hidden; }
.slot .ic { display: block; line-height: 1; pointer-events: none; transition: transform 0.12s ease; }
.slot.has-nm .ic { transform: translateY(-7px); }
.slot.has-nm .n { top: 4px; bottom: auto; }
.slot:active:not(.empty) .ic { transform: scale(0.88); }
.slot.has-nm:active:not(.empty) .ic { transform: translateY(-7px) scale(0.88); }
.dlg-catch { position: absolute; inset: 0; pointer-events: auto; }
.dialog { cursor: pointer; }
.dialog.out { animation: toastOut 0.2s ease forwards; }
.dialog .txt { white-space: pre-line; padding-right: 14px; }
.dialog .more { visibility: hidden; }
.dialog .choices .chip { min-height: 44px; }
.chip.focus { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(45, 63, 86, 0.15); }
.chip.main.focus { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 #b8564e; }
body.touch .dialog .choices .chip { padding: 12px 20px; font-size: 16px; }
body.ui-modal .prompt { opacity: 0; }
.catch-card { cursor: pointer; }
.catch-card .ci { will-change: transform; }
.fly-icon { left: 0; top: 0; will-change: transform; text-shadow: 0 3px 8px rgba(45, 63, 86, 0.3); }
.fish-meter { z-index: 35; pointer-events: none; }
body.touch .place-bar { bottom: calc(214px + var(--safe-b)); }
.place-bar .chip { min-height: 46px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
