@font-face { font-family: Twilio; src: url('/assets/fonts/TwilioSans/TwilioSansDisplay-Regular.woff') format('woff'); font-display: swap; }
@font-face { font-family: Buffalo; src: url('/assets/fonts/BFBuffalo/BFBuffalo-Bold.woff') format('woff'); font-display: swap; }
:root { color-scheme: dark; font-family: Twilio, system-ui, sans-serif; color: #f4f4f5; background: #000d25; --mint: #a9f1cf; --muted: #97a7bb; --mono: SFMono-Regular, Consolas, 'Liberation Mono', monospace; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 50% 44%, #102c3d 0, #000d25 70%); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 5px; }
.sardine-page { width: min(850px, 100%); margin: 0 auto; padding: 28px 24px 24px; }
.sardine-nav { display: flex; justify-content: space-between; gap: 12px; align-items: center; font: 11px var(--mono); }
.sardine-nav a { color: #c4d0df; text-decoration: none; padding: 10px 0; }
.sardine-nav a:hover { color: var(--mint); }
.sardine-nav > span { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.sardine-heading { padding: 32px 0 26px; text-align: center; }
.eyebrow { color: var(--mint); font: 10px var(--mono); letter-spacing: .19em; }
.eyebrow span { letter-spacing: 0; margin-right: 8px; }
h1 { font: clamp(42px, 8vw, 72px)/1 Buffalo, 'Arial Black', sans-serif; text-transform: uppercase; letter-spacing: .015em; margin: 12px 0; }
h1 > span { color: #ff6374; }
.sardine-heading > p:last-child { color: #b1bfd1; font-size: 15px; margin: 0; }
.fishing-terminal { overflow: hidden; border: 1px solid #354551; border-radius: 12px; background: #081b26; box-shadow: 0 24px 90px #0007; }
.fishing-titlebar { height: 43px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #ffffff12; background: #15232e; color: #b7c5cf; font: 11px var(--mono); }
.terminal-lights { display: flex; gap: 6px; }
.terminal-lights i { width: 9px; height: 9px; border-radius: 50%; background: #ff6374; }
.terminal-lights i:nth-child(2) { background: #f9cc78; }
.terminal-lights i:nth-child(3) { background: #a9f1cf; }
#sardine-pause { border: 0; border-radius: 3px; padding: 7px 0 7px 7px; background: none; color: var(--mint); font: inherit; }
.fishing-hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 19px 24px 12px; font-family: var(--mono); }
.hud-label { display: block; color: var(--muted); font-size: 9px; letter-spacing: .16em; margin-bottom: 5px; }
.fishing-hud strong { font-size: 25px; font-weight: 400; }
.fishing-hud small { font-size: 13px; color: var(--muted); }
.hud-clock { text-align: right; }
.hud-clock.urgent strong, .hud-clock.urgent small { color: #ff9d9d; }
.tin-progress { color: var(--mint); font-size: clamp(12px, 2.5vw, 21px); letter-spacing: .14em; }
.ocean-container { position: relative; container-type: inline-size; }
#sardine-ocean { font: clamp(7px, 2.25cqw, 16px)/1.35 var(--mono); text-align: center; margin: 0; padding: 0 0 6px; white-space: pre; user-select: none; overflow: hidden; color: #577b85; }
.ascii-sky { color: #708c9a; } .ascii-moon { color: #f9cc78; } .ascii-boat { color: #ffe4b3; } .ascii-water { color: #528c9c; } .ascii-fish { color: #a9f1cf; } .ascii-jelly { color: #e7a0db; } .ascii-hook { color: #f9cc78; } .ascii-floor { color: #52767b; }
.ocean-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: #061721d9; backdrop-filter: blur(2px); text-align: center; }
[hidden] { display: none !important; }
.touch-hint { display: none; }
.ocean-message { width: min(400px, 100%); }
.ocean-message > pre { font: 12px/1.3 var(--mono); color: var(--mint); margin: 0 0 15px; }
.ocean-message h2 { font: 27px/1.1 Buffalo, 'Arial Black', sans-serif; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 10px; }
.ocean-message p { color: #edf2f7; font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: normal; margin: 0 0 20px; }
.sardine-context { display: block; margin-bottom: 16px; color: #cbd5e1; }
.sardine-goal { display: block; margin-bottom: 10px; }
.sardine-hazards { display: block; margin-top: 10px; color: #cbd5e1; font-size: 13px; }
.ocean-message .keyboard-hint { display: block; }
.primary-button { min-height: 46px; border: 1px solid var(--mint); border-radius: 5px; padding: 10px 25px; background: var(--mint); color: #09241d; font: bold 13px var(--mono); }
.primary-button:hover { background: #d2ffe8; }
.fishing-status { display: flex; align-items: baseline; gap: 8px; padding: 12px 20px; border-top: 1px solid #ffffff12; font: 11px/1.6 var(--mono); min-height: 43px; }
.fishing-status > span { color: var(--mint); }
.fishing-status p { margin: 0; color: #b5cbd0; }
.fishing-controls { display: grid; grid-template-columns: 1fr 2.2fr 1fr; gap: 8px; padding: 0 16px 16px; }
.fishing-controls button { min-height: 62px; padding: 8px 3px; border: 1px solid #39535d; border-radius: 5px; background: #122d37; color: #d9ede9; touch-action: none; user-select: none; -webkit-user-select: none; }
.fishing-controls button > span { font: 15px var(--mono); }
.fishing-controls button small { display: block; color: #a0babd; font: 8px var(--mono); margin-top: 6px; letter-spacing: .07em; }
.fishing-controls button.pressed, .fishing-controls button:active:not(:disabled) { border-color: var(--mint); background: #25483f; }
#sardine-cast { border-color: #6b907f; }
.fishing-notes { text-align: center; margin: 20px auto; max-width: 660px; font: 11px/1.9 var(--mono); color: var(--muted); }
.fishing-notes p { margin: 9px 0; }
.fish-key { color: var(--mint); margin-right: 5px; } .jelly-key { color: #e7a0db; margin: 0 5px 0 12px; }
kbd { display: inline-block; font: inherit; color: #d1dce4; }
.sardine-footer { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 28px; color: #8497aa; font: 9px/1.6 var(--mono); }
.no-script { text-align: center; color: #ff9d9d; }
@media (max-width: 480px) {
  .sardine-page { padding: 14px 12px 22px; }
  .sardine-nav > span { display: none; }
  .sardine-heading { padding: 22px 0; }
  .sardine-heading > p:last-child { font-size: 12px; }
  .fishing-hud { padding: 16px 14px 8px; }
  .fishing-titlebar { padding: 0 12px; font-size: 10px; }
  .ocean-message > pre { font-size: 10px; margin-bottom: 12px; }
  .ocean-message h2 { font-size: 23px; }
  .ocean-message p { font-size: 14px; margin-bottom: 16px; }
  .primary-button { min-height: 44px; padding: 9px 18px; }
  .fishing-status { padding: 10px 12px; font-size: 10px; }
  .fishing-controls { padding: 0 10px 10px; gap: 6px; }
  .fishing-controls button small { font-size: 7px; letter-spacing: 0; }
  .sardine-footer { margin-top: 22px; font-size: 8px; }
}

/* Keep the entire play area in the visible viewport, including browser chrome.
   Reserve space for the HUD and thumb controls before sizing the ASCII ocean. */
@media (max-width: 760px), (max-height: 600px) {
  body.sardines-enabled { overflow: hidden; overscroll-behavior: none; }
  #sardine-game {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px minmax(0, 1fr) auto;
    gap: 6px 8px;
  }
  #sardine-game .sardine-nav { grid-column: 1; grid-row: 1; font-size: 10px; min-width: 0; }
  #sardine-game .sardine-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0; }
  #sardine-game .sardine-nav > span, #sardine-game .sardine-heading > p { display: none; }
  #sardine-game .sardine-heading { grid-column: 2; grid-row: 1; padding: 0; display: flex; align-items: center; }
  #sardine-game h1 { font-size: clamp(18px, 5vw, 28px); margin: 0; }
  .fishing-terminal {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 44px 52px minmax(0, 1fr) 36px 78px;
  }
  .fishing-titlebar { height: auto; padding: 0 12px; font-size: 10px; }
  #sardine-pause { min-width: 50px; min-height: 44px; }
  .fishing-hud { padding: 4px 14px; }
  .fishing-hud strong { font-size: 22px; line-height: 1.1; }
  .hud-label { margin-bottom: 3px; }
  .ocean-container { min-width: 0; min-height: 0; container-type: size; }
  #sardine-ocean {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    padding: 0;
    /* 64 columns × 26 rows: fit whichever dimension is tighter. */
    font-size: min(2.35cqw, 2.75cqh, 16px);
  }
  .ocean-overlay { padding: 10px; }
  .ocean-message > pre { display: none; }
  .ocean-message h2 { font-size: 23px; margin-bottom: 8px; }
  .ocean-message p { font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
  .sardine-context { margin-bottom: 12px; }
  .ocean-message .keyboard-hint { display: none; }
  .ocean-message .touch-hint { display: block; }
  .primary-button { min-height: 44px; padding: 9px 18px; }
  .fishing-status { min-height: 0; padding: 4px 12px; font-size: 10px; line-height: 1.4; align-items: center; overflow: hidden; }
  .fishing-controls { padding: 0 10px 10px; gap: 8px; }
  .fishing-controls button { min-height: 60px; }
  .fishing-controls button small { font-size: 8px; letter-spacing: 0; }
  .fishing-notes { display: none; }
  .keyboard-hint { display: none; }
  .touch-hint { display: inline; }
  .sardine-footer { grid-column: 1 / -1; grid-row: 3; flex-wrap: nowrap; gap: 6px; margin: 0; font-size: 8px; }
}

/* A short, wide phone gets controls beside the sea, keeping both usable. */
@media (max-height: 500px) and (min-width: 540px) {
  #sardine-game { grid-template-rows: 36px minmax(0, 1fr); gap: 4px 8px; padding-top: max(4px, env(safe-area-inset-top)); }
  #sardine-game .sardine-nav a { min-height: 36px; }
  .fishing-terminal { grid-template-columns: minmax(0, 1fr) 170px; grid-template-rows: 44px 42px minmax(0, 1fr) 32px; }
  .fishing-titlebar { grid-column: 1 / -1; grid-row: 1; }
  .fishing-hud { grid-column: 1; grid-row: 2; }
  .ocean-container { grid-column: 1; grid-row: 3; }
  #sardine-ocean { font-size: min(2.35cqw, 3.35cqh, 16px); line-height: 1.1; }
  .fishing-status { grid-column: 1; grid-row: 4; font-size: 9px; }
  .fishing-controls { grid-column: 2; grid-row: 2 / -1; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; padding: 8px; }
  #sardine-left { grid-column: 1; grid-row: 1; }
  #sardine-right { grid-column: 2; grid-row: 1; }
  #sardine-cast { grid-column: 1 / -1; grid-row: 2; }
  .sardine-footer { display: none; }
  .ocean-message > pre { display: none; }
  .ocean-message p { font-size: 13px; line-height: 1.4; margin-bottom: 8px; }
  .sardine-goal { margin-bottom: 0; }
  .sardine-hazards { margin-top: 4px; font-size: 12px; }
  .ocean-message .sardine-context, .ocean-message .touch-hint { display: none; }
  .ocean-message h2 { font-size: 20px; }
}

@media (max-width: 539px) and (max-height: 660px) {
  .ocean-message > pre { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ocean-overlay { backdrop-filter: none; } }
