@font-face { font-family: 'Fredoka'; src: url(fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
:root {
  --sea: #2b9ad3; --sand: #f1d9a4; --sand2: #e2c084; --ink: #3a2a18; --ink2: #6b5232; --mut: #9a8466;
  --card: #fffaf0; --sun: #ffcc3d; --sun2: #f4a922; --green: #2e9e5b; --red: #d9483b;
  --font: 'Fredoka', ui-rounded, -apple-system, system-ui, 'Segoe UI', sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sand); font-family: var(--font); color: var(--ink); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; border: 0; cursor: pointer; touch-action: manipulation; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#beach { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- top ---------- */
.top { position: fixed; left: 0; right: 0; top: 0; padding: calc(8px + var(--st)) 12px 0; pointer-events: none; z-index: 5; }
.money-row { display: flex; justify-content: space-between; align-items: center; }
.money b { display: block; font-size: 34px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18), 0 2px 10px rgba(0,0,0,.2); line-height: 1.05; font-variant-numeric: tabular-nums; }
.money small { color: rgba(255,255,255,.92); font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.top-btns { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.pill { color: #fff; font-weight: 600; font-size: 15px; background: rgba(0,0,0,.2); border-radius: 12px; padding: 6px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.ready { background: #ffcc3d; color: #5a3608; box-shadow: 0 3px 0 #c47f12; animation: hot .7s ease-in-out infinite alternate; }
.pill.on { background: #ff6b3d; }
.pill.wait { opacity: .7; }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; background: rgba(0,0,0,.18); color: #fff; display: flex; align-items: center; justify-content: center; }
.lcd { margin: 8px auto 0; max-width: 420px; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #2f3b2a; border: 3px solid #1e261b; border-radius: 14px; padding: 8px 12px; box-shadow: inset 0 2px 8px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.18); color: #b7f07a; font-variant-numeric: tabular-nums; }
.bars { display: flex; gap: 3px; height: 20px; align-items: flex-end; }
.bars i { width: 9px; border-radius: 2px; background: rgba(183,240,122,.14); }
.bars i.on { background: #b7f07a; box-shadow: 0 0 6px rgba(183,240,122,.7); }
.bars i.hot { background: #ffd34d; box-shadow: 0 0 8px rgba(255,211,77,.8); }
.lcd-name { font-size: 11px; opacity: .7; margin-top: 3px; letter-spacing: .04em; }
.lcd-r { text-align: right; min-width: 92px; }
.lcd-id { font-size: 20px; font-weight: 700; letter-spacing: .08em; line-height: 1; }
.lcd-depth { font-size: 13px; opacity: .85; margin-top: 3px; min-height: 16px; }
.faint { margin: 6px auto 0; max-width: 420px; text-align: center; font-size: 13px; font-weight: 600; color: #fff; background: rgba(60,30,90,.55); border-radius: 10px; padding: 5px 8px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.hint { position: fixed; left: 50%; bottom: calc(220px + var(--sb)); transform: translateX(-50%); z-index: 6; width: max-content; max-width: 88%; text-align: center; font-size: 16px; font-weight: 600; color: #fff; background: rgba(58,42,24,.78); border-radius: 14px; padding: 9px 14px; pointer-events: none; }

/* ---------- bottom ---------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 0 16px calc(14px + var(--sb)); pointer-events: none; }
.bottom button { pointer-events: auto; }
.side-btn { width: 74px; height: 64px; border-radius: 20px; background: rgba(255,250,240,.92); box-shadow: 0 4px 0 rgba(120,86,40,.35); font-size: 13px; font-weight: 600; color: var(--ink2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.side-btn span { font-size: 24px; line-height: 1; }
.side-btn.ping { animation: ping 1.2s ease-in-out infinite; }
@keyframes ping { 50% { transform: translateY(-4px); box-shadow: 0 8px 0 rgba(120,86,40,.25); } }
.dig { width: 112px; height: 112px; border-radius: 56px; background: radial-gradient(circle at 35% 30%, #ffe27a, var(--sun) 45%, var(--sun2)); box-shadow: 0 6px 0 #c47f12, 0 10px 24px rgba(0,0,0,.25); font-size: 30px; font-weight: 700; letter-spacing: .04em; color: #5a3608; }
.dig:active { transform: translateY(3px); box-shadow: 0 3px 0 #c47f12; }
.dig.hot { animation: hot .5s ease-in-out infinite alternate; }
@keyframes hot { to { box-shadow: 0 6px 0 #c47f12, 0 0 0 10px rgba(255,204,61,.35), 0 10px 24px rgba(0,0,0,.25); } }

/* ---------- dig pit ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(40,26,10,.45); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.pit-wrap { flex-direction: column; align-items: stretch; justify-content: flex-start; background: #87c8ea; padding: calc(10px + var(--st)) 0 calc(18px + var(--sb)); touch-action: none; }
.pit-top { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 18px 8px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pit-top { gap: 10px; }
.pit-top b { font-size: 28px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pit-top span { font-size: 15px; font-weight: 600; text-align: right; line-height: 1.2; }
#pit { flex: 1; width: 100%; display: block; }
.pit-bar { height: 10px; margin: 10px 18px 0; border-radius: 5px; background: rgba(0,0,0,.25); overflow: hidden; }
.pit-bar i { display: block; height: 100%; width: 0; background: var(--sun); transition: width .08s; }
.find { z-index: 30; align-items: center; background: rgba(30,18,6,.55); padding: 20px; }
.find-card { position: relative; width: min(360px, 100%); background: var(--card); border-radius: 26px; padding: 22px 20px 18px; text-align: center; animation: pop .4s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .08em; border-radius: 12px; padding: 4px 12px; }
.f-emoji { font-size: 96px; line-height: 1.1; filter: drop-shadow(0 6px 8px rgba(0,0,0,.2)); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.f-name { font-size: 28px; font-weight: 700; margin-top: 4px; }
.f-rar { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.r1 { color: #8a7a64; } .r2 { color: #2e9e5b; } .r3 { color: #2f7fd1; } .r4 { color: #9a46d6; } .r5 { color: #e08a00; }
.f-val { font-size: 34px; font-weight: 700; color: var(--green); margin: 6px 0 2px; }
.f-note { color: var(--ink2); font-size: 16px; min-height: 22px; }
.f-extra { margin-top: 8px; display: grid; gap: 6px; }
.f-extra div { background: #fff1c9; color: #8a5a00; border-radius: 12px; padding: 7px 10px; font-weight: 600; font-size: 15px; }
.f-extra div.blue { background: #e3f1fb; color: #1f5f8b; } .f-extra div.green { background: #e2f5e9; color: #1f7442; }

/* ---------- sheets ---------- */
.panel { width: min(520px, 100%); background: var(--card); border-radius: 26px 26px 0 0; padding: 18px 16px calc(18px + var(--sb)); max-height: 88vh; overflow-y: auto; animation: rise .28s cubic-bezier(.2,.85,.25,1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 640px) { .overlay:not(.pit-wrap) { align-items: center; } .panel { border-radius: 26px; } }
.sheet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sheet-h h2 { margin: 0; font-size: 26px; }
.x { width: 38px; height: 38px; border-radius: 19px; background: #f3e7cf; color: var(--ink2); display: flex; align-items: center; justify-content: center; }
.tabs { display: flex; gap: 6px; background: #f3e7cf; border-radius: 14px; padding: 4px; margin: 6px 0 10px; }
.tabs button { flex: 1; height: 38px; border-radius: 11px; font-weight: 600; color: var(--ink2); background: none; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; }
.row + .row { border-top: 1px solid #f0e4cc; }
.row .ic { font-size: 30px; width: 40px; text-align: center; }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { display: block; font-size: 17px; }
.row .tx small { display: block; color: var(--mut); font-size: 13px; line-height: 1.3; }
.buy { min-width: 92px; height: 44px; border-radius: 13px; background: var(--green); color: #fff; font-weight: 700; font-size: 15px; padding: 0 10px; box-shadow: 0 3px 0 #1f7442; }
.buy:disabled { background: #d9ccb4; box-shadow: none; color: #fff; }
.buy.max { background: #efe4cf; color: var(--mut); box-shadow: none; }
.mini-sw { margin-left: 6px; font-size: 12px; font-weight: 700; border-radius: 9px; padding: 3px 8px; background: #efe4cf; color: var(--mut); }
.mini-sw.on { background: #2f3b2a; color: #b7f07a; }
.tier-h { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 2px 6px; }
.tier-h b { font-size: 17px; } .tier-h span { font-size: 13px; color: var(--mut); }
.tier-h span.done { color: var(--green); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cell { background: #f6ecd8; border-radius: 14px; padding: 8px 4px 6px; text-align: center; }
.cell .e { font-size: 32px; line-height: 1.15; }
.cell.unk .e { filter: brightness(0); opacity: .18; }
.cell small { display: block; font-size: 11px; color: var(--ink2); line-height: 1.2; min-height: 26px; }
.cell i { display: block; font-style: normal; font-size: 11px; color: var(--mut); }
.muted { color: var(--mut); font-size: 15px; margin: 4px 0 8px; }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border-radius: 15px; font-size: 17px; font-weight: 600; background: #f3e7cf; color: var(--ink); margin-top: 10px; }
.btn.big { height: 54px; font-size: 19px; background: var(--sun); color: #5a3608; box-shadow: 0 4px 0 #c47f12; }
.btn.danger { background: none; color: var(--red); }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; font-size: 17px; }
.toggle + .toggle { border-top: 1px solid #f0e4cc; }
.sw { width: 51px; height: 31px; border-radius: 16px; background: #d9ccb4; position: relative; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.sw.on { background: var(--green); } .sw.on::after { transform: translateX(20px); }
.fine { font-size: 12px; color: var(--mut); text-align: center; margin-top: 12px; line-height: 1.4; }
.fine a { color: var(--ink2); }
.toast { position: fixed; left: 50%; bottom: calc(150px + var(--sb)); transform: translate(-50%, 10px); z-index: 40; background: rgba(58,42,24,.92); color: #fff; border-radius: 14px; padding: 10px 16px; font-size: 15px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- extras ---------- */
.chips { display: flex; gap: 6px; margin: 6px auto 0; max-width: 420px; flex-wrap: wrap; pointer-events: auto; }
.chips button { font-size: 14px; font-weight: 600; color: #fff; background: rgba(0,0,0,.22); border-radius: 11px; padding: 4px 9px; }
.chips button.glow { background: #ffcc3d; color: #5a3608; }
.banner { margin: 8px auto 0; max-width: 420px; text-align: center; font-weight: 700; font-size: 17px; color: #fff; border-radius: 12px; padding: 7px 10px; background: linear-gradient(90deg, #d9483b, #f4a922); box-shadow: 0 4px 14px rgba(0,0,0,.2); animation: pulse 1.2s ease-in-out infinite; }
.banner.storm { background: linear-gradient(90deg, #3b4a66, #6b5b95); animation: none; }
.crit { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 34px; font-weight: 700; color: #ffd34d; text-shadow: 0 3px 0 #a5560e, 0 0 20px rgba(255,200,60,.8); pointer-events: none; animation: critpop .7s ease-out forwards; }
@keyframes critpop { from { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } to { transform: translate(-50%, -90%) scale(1); opacity: 0; } }
.card-gold { background: linear-gradient(135deg, #fff3c4, #ffd76a); border-radius: 18px; padding: 14px; margin: 4px 0 10px; display: flex; gap: 12px; align-items: center; box-shadow: inset 0 0 0 2px #e8b730; }
.card-gold .ic { font-size: 40px; }
.card-gold b { display: block; font-size: 18px; } .card-gold small { color: #7a5600; font-size: 13px; line-height: 1.3; display: block; }
.coil-prev { width: 44px; height: 30px; border-radius: 50%; border: 6px solid; display: inline-block; flex: none; }
.beaches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 8px 0; }
.beaches button { background: #f6ecd8; border-radius: 14px; padding: 10px 4px; font-weight: 600; font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.beaches button span { font-size: 28px; }
.beaches button.on { background: #2f3b2a; color: #b7f07a; }
.beaches button:disabled { opacity: .45; }
.progress { height: 12px; border-radius: 6px; background: #efe4cf; overflow: hidden; margin: 6px 0 4px; }
.progress i { display: block; height: 100%; background: var(--green); }
.big-num { font-size: 30px; font-weight: 700; }
.mtabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0 4px; padding-bottom: 2px; }
.mtabs button { flex: none; height: 36px; border-radius: 11px; padding: 0 12px; background: #f3e7cf; color: var(--ink2); font-weight: 600; font-size: 14px; }
.mtabs button.on { background: #2f3b2a; color: #b7f07a; }
.tabs.five button { font-size: 13px; padding: 0 2px; }
