/* Otterly Deep: driftwood frames, sun-faded paper, ink-brown text. */
:root {
  --paper: #f4e8cc; --paper2: #eadbb6; --ink: #3a2418; --ink2: #6a4a34; --wood: #8a5a34; --wood2: #5a3a20;
  --sea: #3a8a8a; --rust: #c8402c; --gold: #e0a830; --shadow: rgba(30, 16, 8, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a1530; font-family: 'Pixelify Sans', ui-monospace, monospace; color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#game { position: absolute; left: 50%; top: 0; transform: translateX(-50%); image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }

/* HUD */
#hud { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; max-width: 62vw; pointer-events: none; }
.chip { background: var(--paper); border: 3px solid var(--wood2); box-shadow: 0 3px 0 var(--shadow); padding: 3px 9px; font-size: 16px; display: flex; align-items: center; gap: 6px; line-height: 1.1; }
.chip small { color: var(--ink2); font-size: 13px; }
.chip.zone { background: var(--paper2); font-size: 13px; }
body.title #hud, body.title #tr, body.title .pad { display: none; }
#tr { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.tb { background: var(--paper); border: 3px solid var(--wood2); box-shadow: 0 3px 0 var(--shadow); padding: 4px 8px; display: flex; align-items: center; gap: 5px; font-size: 15px; min-height: 36px; }
.tb:active, #port button:active, .pad:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }

/* tiny pixel icons drawn with box-shadows */
.ic { width: 14px; height: 14px; display: inline-block; position: relative; flex: none; }
.ic.coin { background: radial-gradient(circle at 40% 40%, #ffe48a 0 35%, #e0a830 36% 65%, #8a5a12 66% 70%, transparent 71%); }
.ic.cool { background: linear-gradient(#c8402c 0 30%, #f4e8cc 30% 36%, #e8dcc0 36% 100%); border: 2px solid var(--ink); }
.ic.book { background: #4a8a7a; border: 2px solid var(--ink); box-shadow: inset -3px 0 0 #f4e8cc; }
.ic.worm { background: radial-gradient(circle at 30% 70%, #d87a7a 0 25%, transparent 26%), radial-gradient(circle at 60% 50%, #d87a7a 0 25%, transparent 26%), radial-gradient(circle at 80% 25%, #d87a7a 0 22%, transparent 23%); }
.ic.gear { border: 3px solid var(--ink2); border-radius: 50%; }
.ic.gear::after { content: ''; position: absolute; inset: 3px; background: var(--ink2); border-radius: 50%; }

/* port bar */
#port { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: none; gap: 6px; flex-wrap: wrap; justify-content: center; width: min(96vw, 640px); }
body.inport #port { display: flex; }
#port button { position: relative; background: var(--paper); border: 3px solid var(--wood2); box-shadow: 0 3px 0 var(--shadow); padding: 7px 12px; font-size: 16px; }
#port button:nth-child(1) { background: #f0d8b0; } #port button:nth-child(4) { background: #d8ecec; } #port button:nth-child(5) { background: #f0e4c0; }
.dot { position: absolute; top: -6px; right: -6px; width: 12px; height: 12px; background: var(--rust); border: 2px solid var(--ink); display: none; }

/* paddles */
.pad { position: absolute; bottom: 14px; width: 64px; height: 64px; background: var(--paper); border: 3px solid var(--wood2); box-shadow: 0 3px 0 var(--shadow); font-size: 24px; display: flex; align-items: center; justify-content: center; touch-action: none; }
#padL { left: 12px; } #padR { right: 12px; }
body.fishing .pad { opacity: .35; }
body.inport .pad { bottom: 66px; }

/* toast */
#msg { position: absolute; left: 50%; top: 58px; transform: translate(-50%, -10px); max-width: min(90vw, 520px); background: var(--paper); border: 3px solid var(--wood2); box-shadow: 0 3px 0 var(--shadow); padding: 7px 12px; font-size: 16px; text-align: center; opacity: 0; transition: .25s; pointer-events: none; }
#msg.on { opacity: 1; transform: translate(-50%, 0); }

/* catch card: slides in from the right, under the top buttons */
#card { position: absolute; top: 128px; right: 10px; width: min(calc(100vw - 20px), 330px); display: flex; gap: 10px; align-items: center; background: var(--paper); border: 4px solid var(--wood2); box-shadow: 0 5px 0 var(--shadow); padding: 10px 12px; opacity: 0; pointer-events: none; transform: translateX(calc(100% + 20px)); transition: transform .25s ease-out, opacity .25s; }
#card.on { opacity: 1; transform: none; pointer-events: auto; }
#card img { image-rendering: pixelated; width: 84px; height: 64px; object-fit: contain; flex: none; }
#card .txt { min-width: 0; }
#card b { font-size: 18px; display: block; line-height: 1.1; }
#card small { font-size: 13px; }
#card .stats { margin-top: 2px; font-size: 14px; }
#card p { font-size: 13px; color: var(--ink2); margin: 4px 0 0; line-height: 1.25; }
#card .ribbon { position: absolute; top: -12px; left: 10px; transform: rotate(-3deg); background: var(--rust); color: #fbf3dc; border: 3px solid var(--ink); padding: 0 8px; font-size: 13px; white-space: nowrap; }
#card.r4 { border-color: #6a3a8a; } #card.r5 { border-color: #a87418; background: linear-gradient(#fbf0d0, var(--paper)); }
.r1 { color: #6a5a4a; } .r2 { color: #3a7a4a; } .r3 { color: #2a5aa0; } .r4 { color: #7a3a9a; } .r5 { color: #b0740a; }
small.r1, small.r2, small.r3, small.r4, small.r5 { font-weight: 600; }
.low { color: var(--rust) !important; }

/* panels */
#veil { position: absolute; inset: 0; background: rgba(10, 8, 20, .45); display: none; }
body.modal #veil { display: block; }
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 620px); max-height: 90vh; display: none; flex-direction: column; background: var(--paper); border: 4px solid var(--wood2); outline: 4px solid var(--wood); box-shadow: 0 8px 0 var(--shadow); }
body.modal .panel { display: flex; }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--wood); color: #fbf3dc; }
.panel h2 { margin: 0; font-size: 22px; font-weight: 600; }
.panel h3 { margin: 14px 0 6px; font-size: 17px; border-bottom: 2px dashed var(--ink2); padding-bottom: 2px; }
.panel .x { background: var(--paper); color: var(--ink); border: 3px solid var(--wood2); width: 34px; height: 34px; font-size: 16px; }
.panel .body { padding: 10px 14px 16px; overflow-y: auto; touch-action: pan-y; }
.note { font-size: 15px; color: var(--ink2); margin: 4px 0 10px; }
.empty { text-align: center; padding: 18px; color: var(--ink2); }
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; background: var(--paper2); border: 2px solid rgba(90, 58, 32, .35); padding: 6px 8px; }
.row .grow { flex: 1; min-width: 0; }
.row b { display: block; font-size: 16px; }
.row small { display: block; font-size: 13px; color: var(--ink2); }
.row p { margin: 3px 0; font-size: 14px; }
.row button, .panel button.big, .panel button.danger { background: #f8f0dc; border: 3px solid var(--wood2); box-shadow: 0 2px 0 var(--shadow); padding: 5px 10px; font-size: 14px; white-space: nowrap; }
.row button:disabled { opacity: .45; cursor: default; }
.row button.alt { background: #dcebe4; }
.panel button.big { width: 100%; font-size: 17px; padding: 8px; margin-bottom: 10px; background: #f0d8a0; }
.panel button.danger { margin-top: 16px; background: #f4c8b8; }
b.c { color: #8a5a12; display: inline; font-size: inherit; }
b.c::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 3px; background: radial-gradient(circle at 40% 40%, #ffe48a 0 35%, #e0a830 36% 70%, transparent 71%); }
.th { image-rendering: pixelated; width: 56px; height: 42px; object-fit: contain; flex: none; }
em.hot { color: #3a7a4a; font-style: normal; } em.low { font-style: normal; }
.pips { display: flex; gap: 2px; margin-top: 3px; } .pips i { width: 10px; height: 6px; background: rgba(90, 58, 32, .25); } .pips i.on { background: var(--sea); }
.bait { width: 26px; height: 26px; border: 2px solid var(--ink); flex: none; }
.b-worm { background: #d87a7a; } .b-shrimp { background: #f0a080; } .b-squid { background: #f0e0e0; } .b-glow { background: #a0ffe0; box-shadow: 0 0 8px #a0ffe0; } .b-gold { background: #ffd040; }
.boatpic { image-rendering: pixelated; width: 96px; flex: none; }
.note-card { background: #fbf4e0; border: 2px solid var(--ink2); transform: rotate(-.3deg); }
.note-card:nth-child(2) { transform: rotate(.4deg); }

/* journal */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 4px; }
.cell { background: var(--paper2); border: 2px solid rgba(90, 58, 32, .35); padding: 2px; height: 46px; display: flex; align-items: center; justify-content: center; }
.cell img { image-rendering: pixelated; max-width: 100%; max-height: 40px; }
.cell.unk { background: #d8cba8; }
.cell.r3 { border-color: #2a5aa0; } .cell.r4 { border-color: #7a3a9a; } .cell.r5 { border-color: #b0740a; background: #f4e0a8; }
.cell.unk.r5 { background: #d8cba8; }
.detail { display: flex; gap: 12px; align-items: flex-start; background: #fbf4e0; border: 2px solid var(--ink2); padding: 10px; margin-bottom: 10px; min-height: 120px; }
.detail img { image-rendering: pixelated; width: 120px; height: 90px; object-fit: contain; flex: none; }
.detail b { font-size: 19px; display: block; } .detail p { margin: 5px 0; font-size: 14px; } .detail .hint { color: #2a5a6a; }
.detail small { font-size: 13px; color: var(--ink2); }

/* aquarium */
.aqview { width: 100%; image-rendering: pixelated; border: 3px solid var(--wood2); display: block; margin-bottom: 8px; aspect-ratio: 2 / 1; }

/* settings */
.slider { display: flex; align-items: center; gap: 12px; margin: 8px 0; font-size: 16px; }
.slider span { width: 120px; } .slider input { flex: 1; accent-color: var(--sea); }

#boot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #10283a; color: #f4e8cc; font-size: 20px; }

@media (max-width: 560px) {
  .chip { font-size: 13px; padding: 2px 6px; } .chip.zone { display: none; } .chip small { display: none; }
  #port button { font-size: 14px; padding: 6px 8px; }
  .pad { width: 54px; height: 54px; }
  body.inport .pad { bottom: 14px; }
  #hud { max-width: calc(100vw - 160px); gap: 4px; left: 8px; top: 8px; }
  #tr { right: 8px; top: 8px; gap: 4px; }
  .tb { padding: 3px 6px; min-height: 32px; font-size: 13px; }
  #port { bottom: 78px; width: 92vw; gap: 4px; }
  #card { top: auto; bottom: 150px; }
  .detail { flex-direction: column; align-items: center; text-align: center; }
}
