:root {
  --safe-top: 0px; --safe-bottom: 0px;
  --khaki: #5f6b3c; --khaki-d: #3c4426; --gold: #f2c94c; --ink: #2b2a20; --paper: #efe4c4; --paper-d: #d9c99a;
  --red: #c0392b; --green: #2e7d32;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b2a3a; color: #fff;
  font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; background: #0b2a3a; font-size: 18px; z-index: 50; }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 6px) 8px 6px;
  display: flex; align-items: center; gap: 8px; background: linear-gradient(#0008, #0000); z-index: 5; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hbtn { background: #000a; border: 1px solid #fff4; border-radius: 10px; padding: 7px 10px; font-weight: 600; font-size: 14px; }
.hmid { flex: 1; text-align: center; text-shadow: 0 1px 2px #000; min-width: 0; }
#hudLoc { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hudTime { font-size: 13px; opacity: .9; }
.hright { text-align: right; text-shadow: 0 1px 2px #000; font-size: 13px; }
#hudMoney { font-weight: 700; color: var(--gold); }
#hint { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 64px); z-index: 4;
  background: #000a; padding: 6px 12px; border-radius: 12px; font-size: 13px; pointer-events: none; white-space: nowrap; }

/* Screens */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; z-index: 10;
  background: url(assets/images/panel.png) repeat center / 360px auto, var(--khaki); }
.screen.on { display: flex; }
.screen.paper { background: var(--paper); color: var(--ink); }
.top { display: flex; gap: 12px; align-items: center; padding: calc(var(--safe-top) + 14px) 16px 10px; }
.top img { width: 56px; height: 56px; image-rendering: pixelated; }
.top h1 { margin: 0; font-size: 24px; color: var(--gold); text-shadow: 0 2px 0 #0006; }
#baseStats { font-size: 13px; opacity: .95; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; padding: 10px 16px; flex: 1; align-content: start; overflow-y: auto; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; padding: 0; }
.tile img { width: 78px; height: 78px; border-radius: 10px; box-shadow: 0 3px 8px #0006; }
.tile:active img { transform: scale(.94); }
.tile span { font-size: 12.5px; text-align: center; text-shadow: 0 1px 2px #000; }
#baseFoot { padding: 8px 16px calc(var(--safe-bottom) + 12px); font-size: 12px; opacity: .8; text-align: center; }

/* Map */
.mapwrap { flex: 1; display: grid; place-items: center; overflow: hidden; background: #e8dcb6; }
#mapBox { position: relative; width: min(100vw, calc(100dvh * 0.5625)); aspect-ratio: 360 / 640; }
.pt.l { transform: translate(-17px, -50%); align-items: flex-start; }
.pt.r { transform: translate(calc(-100% + 17px), -50%); align-items: flex-end; }
#mapBox > img { width: 100%; height: 100%; display: block; }
#mapPts { position: absolute; inset: 0; }
.pt { position: absolute; transform: translate(-50%, -50%); background: none; padding: 0; display: flex; flex-direction: column; align-items: center; }
.pt img { width: 34px; height: 34px; }
.pt span { margin-top: 2px; font-size: 11px; font-weight: 700; color: #3a2a10; background: #fff8e4dd; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.pt.locked { filter: grayscale(1) opacity(.65); }
.pt.cur span { background: var(--gold); }
.floating { position: absolute; left: 10px; top: calc(var(--safe-top) + 10px); }
.back { background: #000a; color: #fff; border-radius: 10px; padding: 7px 12px; font-weight: 700; }

/* Lists */
.bar { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 10px) 12px 10px; background: var(--khaki-d); color: #fff; }
.bar h2 { margin: 0; flex: 1; font-size: 18px; }
.money { color: var(--gold); font-weight: 700; }
.tabs { display: flex; overflow-x: auto; gap: 6px; padding: 8px 10px; background: var(--paper-d); flex: none; scrollbar-width: none; touch-action: pan-x; }
.tabs button { background: #fff7; color: var(--ink); padding: 6px 11px; border-radius: 16px; white-space: nowrap; font-size: 13px; font-weight: 600; }
.tabs button.on { background: var(--khaki-d); color: #fff; }
.list { flex: 1; overflow-y: auto; padding: 8px 10px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-bottom: 1px solid #0001; }
.row .ic { width: 40px; height: 40px; flex: none; border-radius: 6px; background-repeat: no-repeat; }
.row .ic.fish { width: 75px; height: 40px; background-size: contain; background-position: center; }
.row .tx { flex: 1; min-width: 0; }
.row .nm { font-weight: 700; }
.row .sb { font-size: 12.5px; opacity: .75; }
.row .rk { width: 26px; text-align: center; font-weight: 800; opacity: .7; }
.row.me { background: #f2c94c55; border-radius: 8px; }
.btn { background: var(--khaki-d); color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.btn.alt { background: #fff; color: var(--ink); border: 1px solid #0002; }
.btn.red { background: var(--red); }
.btn.green { background: var(--green); }
.btn:disabled { opacity: .45; }
.tag { font-size: 11px; background: var(--gold); color: var(--ink); border-radius: 6px; padding: 1px 5px; font-weight: 700; }
.empty { text-align: center; padding: 30px 10px; opacity: .6; }
#listFoot { padding: 8px 12px calc(var(--safe-bottom) + 10px); background: var(--paper-d); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#listFoot:empty { display: none; }
.slot { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid #0001; }
.slot label { width: 86px; font-weight: 700; font-size: 13px; }
.slot select { flex: 1; font: inherit; padding: 7px; border-radius: 8px; border: 1px solid #0003; background: #fff; color: var(--ink); }
h4 { margin: 14px 4px 6px; }

/* Modal / toast */
#modal { position: absolute; inset: 0; background: #0009; display: grid; place-items: center; z-index: 30; padding: 20px; }
.mbox { background: var(--paper); color: var(--ink); border-radius: 16px; padding: 16px; width: min(340px, 100%); box-shadow: 0 10px 30px #0008; text-align: center; }
.mbox h3 { margin: 0 0 10px; }
#mBody img.fishimg { width: 220px; max-width: 100%; }
#mBtns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
#mBtns .btn { min-width: 90px; padding: 10px 14px; font-size: 15px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0; }
.stepper .btn { min-width: 46px; }
.stepper b { min-width: 90px; font-size: 22px; }
input[type=range] { width: 100%; }
#toast { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 40; background: #000c; color: #fff;
  padding: 12px 18px; border-radius: 14px; font-weight: 700; text-align: center; max-width: 80%; pointer-events: none; }
