/* Still Water: a misty lake at dawn seen from the end of an old wooden jetty. The lake, the
   heron, the reeds and the rod are painted on the canvas (script.js); this sheet styles the
   few things laid over it: the readouts, the strike/strain toasts, the cards and the catch log. */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,600&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #f4ead8;            /* warm paper, for text on the dark */
  --amber: #f2a65a;          /* the low sun on the water */
  --float: #ff6a2b;          /* the float's painted tip */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  /* shared toy chrome (assets/toy-chrome.css): dawn amber over the blue-gray of the lake */
  --tc-accent: #f2a65a;
  --tc-on: #2a1708;
  --tc-display: var(--serif);
  --tc-ground: #121823;
}

html, body {
  -webkit-tap-highlight-color: transparent;
  margin: 0; height: 100%; overflow: hidden;
  background: #141a24;
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none; overscroll-behavior: none;
}

#canvas {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  cursor: crosshair; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  touch-action: none;
}

/* ---------- HUD: two readouts in a fogged glass strip ---------- */
.hud {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left));
  z-index: 5; display: inline-flex; align-items: stretch; pointer-events: none;
}
html.tc .hud.hud {
  padding: 5px 6px; gap: 2px; border-radius: 14px;
  background: rgba(16, 20, 28, 0.42);
  border: 1px solid rgba(244, 234, 216, 0.16);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.8);
}
.hud__cell {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 2px 10px 3px; min-width: 64px;
}
.hud__cell + .hud__cell { border-left: 1px solid rgba(244, 234, 216, 0.14); }
html.tc .hud .hud__k { font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(244, 234, 216, 0.56); line-height: 1.3; }
.hud__cell > span:last-child {
  font: 600 15px/1.2 var(--serif); font-variant-numeric: tabular-nums; color: var(--ink);
  white-space: nowrap;
}

/* ---------- top buttons ---------- */
.topbtns {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  z-index: 6; display: inline-flex; align-items: center; gap: 8px;
}
.iconbtn {
  appearance: none; font-family: inherit; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(244, 234, 216, 0.22);
  background: rgba(16, 20, 28, 0.42); color: var(--ink);
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.9);
  transition: border-color 140ms ease, color 140ms ease, transform 120ms ease, background 140ms ease;
}
.iconbtn:hover { border-color: rgba(242, 166, 90, 0.8); color: #fff6e6; }
.iconbtn:active { transform: translateY(1px); }
.iconbtn:focus-visible { outline: none; box-shadow: 0 0 0 2px #141a24, 0 0 0 4px var(--amber); }
.iconbtn .snd-off { display: none; }
.iconbtn[aria-pressed="false"] { color: rgba(244, 234, 216, 0.42); }
.iconbtn[aria-pressed="false"] .snd-on { display: none; }
.iconbtn[aria-pressed="false"] .snd-off { display: block; }

/* ---------- toast: the moment words (Strike! / Snapped) ---------- */
.toast {
  position: fixed; left: 50%; top: 31%; z-index: 4; margin: 0;
  transform: translate(-50%, -50%) scale(0.96);
  font: italic 600 clamp(26px, 8vw, 40px)/1.05 var(--serif); letter-spacing: -0.01em;
  color: #fff4e2; text-align: center; white-space: nowrap;
  text-shadow: 0 2px 18px rgba(10, 12, 18, 0.7), 0 1px 2px rgba(10, 12, 18, 0.8);
  opacity: 0; pointer-events: none;
  transition: opacity 260ms ease, transform 360ms cubic-bezier(0.2, 0.9, 0.25, 1.2);
}
.toast small {
  display: block; margin-top: 6px; font: 500 12px/1.3 "Geist", system-ui, sans-serif; font-style: normal;
  letter-spacing: 0.08em; text-transform: uppercase; color: rgba(244, 234, 216, 0.82);
}
.toast.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.is-hot { color: #ffd2b8; }
.toast.is-good { color: #fff0c8; }

/* ---------- overlay: the cards over the blurred lake ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(14, 18, 26, 0.34), rgba(8, 10, 16, 0.78));
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: opacity 280ms ease;
}
.overlay[hidden] { display: none; }
.overlay.is-hidden { opacity: 0; pointer-events: none; }
.overlay--log { z-index: 9; }
.panel { animation: pop 340ms cubic-bezier(0.2, 0.9, 0.25, 1) both; }
@keyframes pop { from { transform: translateY(8px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

html.tc .overlay .panel.panel {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(242, 166, 90, 0.12), inset 0 1px 0 rgba(255, 236, 205, 0.08);
}
html.tc .overlay .panel__title {
  font-weight: 600; font-style: italic; letter-spacing: -0.015em; font-size: clamp(36px, 10.6vw, 48px); line-height: 1.02;
  font-variation-settings: "opsz" 144;
  background-image: linear-gradient(178deg, #fff8ea 0%, #f6dcae 46%, #e9a865 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: 3px;
}
html.tc .overlay .panel__title.is-catch { font-size: clamp(30px, 8.8vw, 40px); }
.panel__text .newbest { color: #ffd98f; font-weight: 600; }
.panel__text .rar { color: #f6d7a6; }

/* the drawing of the catch, on a watercolor wash */
.catch-art {
  display: block; width: 100%; height: auto; aspect-ratio: 600 / 230; margin: -2px 0 10px;
}
.catch-art[hidden] { display: none; }

/* a quiet second action under the main one */
.ghost-btn {
  appearance: none; display: block; margin: 10px auto 0; padding: 8px 14px; border: 0; border-radius: 999px;
  background: none; cursor: pointer;
  font: 600 13.5px/1.2 "Geist", system-ui, sans-serif; letter-spacing: 0.02em;
  color: rgba(246, 220, 174, 0.86);
  text-decoration: underline; text-decoration-color: rgba(246, 220, 174, 0.35); text-underline-offset: 4px;
}
.ghost-btn:hover { color: #fff1d6; text-decoration-color: rgba(246, 220, 174, 0.7); }
.ghost-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.ghost-btn--solid {
  width: 100%; min-height: 46px; margin-top: 14px; text-decoration: none;
  border: 1px solid rgba(242, 166, 90, 0.5); background: rgba(242, 166, 90, 0.1); color: #fde9c8;
}
.ghost-btn--solid:hover { background: rgba(242, 166, 90, 0.18); }

/* ---------- catch log ---------- */
html.tc .overlay .panel.log { width: min(100%, 400px); max-width: 400px; padding: 20px 16px 16px; }
html.tc .overlay .log .panel__title { font-size: clamp(30px, 8.4vw, 38px); margin-bottom: 4px; }
.log__sum { margin: 0 0 12px; font: 400 13px/1.4 "Geist", system-ui, sans-serif; color: rgba(236, 222, 200, 0.74); }
.log__sum b { color: #fff1d6; font-weight: 600; }
.log__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; }
.log__cell {
  display: grid; grid-template-columns: 54px 1fr; align-items: center; column-gap: 8px;
  padding: 5px 8px 5px 5px; border-radius: 10px; min-width: 0;
  background: rgba(255, 240, 215, 0.05); border: 1px solid rgba(255, 240, 215, 0.09);
}
.log__cell canvas { width: 54px; height: 30px; display: block; }
.log__name { font: 600 12px/1.15 var(--serif); letter-spacing: -0.005em; color: #fbecd2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log__meta { font: 500 10px/1.3 "Geist Mono", ui-monospace, monospace; letter-spacing: 0.04em; color: rgba(236, 222, 200, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log__cell.is-unseen .log__name { color: rgba(236, 222, 200, 0.42); font-style: italic; }
.log__cell.is-new { border-color: rgba(242, 166, 90, 0.6); background: rgba(242, 166, 90, 0.1); }
.log__cell .r3 { color: #f6c46a; }
.log__cell .r2 { color: #e9b98d; }

/* ---------- frame + hint ---------- */
.frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner {
  position: absolute; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(244, 234, 216, 0.55); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.frame__corner--tl { display: none; }
.frame__corner--tr { display: none; }
.frame__corner--bl { bottom: max(14px, calc(env(safe-area-inset-bottom) + 4px)); left: max(16px, env(safe-area-inset-left)); }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; }
.frame__corner a:hover { color: #fff1d6; }
.frame__corner a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 3px; }

.hint {
  position: fixed; bottom: max(44px, calc(env(safe-area-inset-bottom) + 34px)); left: 50%; transform: translateX(-50%); z-index: 4; margin: 0;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; color: rgba(250, 238, 218, 0.84);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.6);
  pointer-events: none; white-space: nowrap; transition: opacity 300ms ease; max-width: 92vw; text-align: center;
}
.hint.is-gone { opacity: 0; }

/* the shared tip-jar / fullscreen badges sit under the top buttons, over the sky, where they never
   cover the water, the rod or the reel (their default is right-center, over the lake) */
.opt-tipjar.opt-tipjar {
  top: calc(max(12px, env(safe-area-inset-top)) + 52px); bottom: auto; transform: none;
  right: max(12px, env(safe-area-inset-right));
}
.opt-fs.opt-fs {
  top: calc(max(12px, env(safe-area-inset-top)) + 53px); bottom: auto; transform: none;
  right: calc(max(12px, env(safe-area-inset-right)) + 50px);
}
.opt-tipjar.opt-tipjar.tj-nudge { animation: none; }
/* on a short screen a card reaches the top corner: the fullscreen badge steps aside while it is up */
@media (max-height: 760px) {
  body:has(#overlay:not(.is-hidden)) .opt-fs.opt-fs { display: none; }
}

@media (max-width: 620px) {
  .frame__corner--bl { display: none; }
  .hint { font-size: 0.7rem; letter-spacing: 0.03em; bottom: max(16px, calc(env(safe-area-inset-bottom) + 6px)); }
}

/* ---------- short landscape (a phone on its side, 874 x 402) ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .toast { top: 27%; font-size: 30px; }
  /* badges stack at the right edge, clear of the wide card */
  .opt-fs.opt-fs { right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 100px); }
  html.tc #overlay > .panel.panel {
    width: min(100%, 660px); max-width: 660px; padding: 14px 24px 12px; text-align: left;
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 26px; align-content: start;
  }
  html.tc #overlay > .panel > * { grid-column: 2; }
  html.tc #overlay > .panel > .panel__lede { grid-column: 1; grid-row: 1 / span 12; }
  html.tc #overlay > .panel > .play-btn { max-width: none; margin: 2px 0 0; }
  html.tc #overlay .panel__title { font-size: 36px; margin-bottom: 6px; }
  html.tc #overlay .panel__text { margin-bottom: 2px; font-size: 13.5px; }
  html.tc #overlay .panel__keys { margin-top: 6px; }
  .catch-art { margin: 0 0 6px; }
  html.tc #overlay .panel .mg { margin-top: 8px; }
  html.tc #overlay .panel .opt-share { margin-top: 6px; }
  html.tc #overlay .panel .mg-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ghost-btn { margin-top: 4px; }

  html.tc .overlay .panel.log { width: min(100%, 760px); max-width: 760px; padding: 12px 16px 12px; }
  html.tc .overlay .log .panel__title { font-size: 28px; }
  .log__grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .log__cell { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 6px 4px; row-gap: 2px; }
  .log__sum { margin-bottom: 8px; }
  .ghost-btn--solid { min-height: 40px; margin-top: 10px; max-width: 320px; margin-inline: auto; }
}

@media (max-height: 700px) and (orientation: portrait) {
  html.tc .overlay .panel.log { padding: 16px 14px 14px; }
  .log__sum { margin-bottom: 8px; }
  .log__grid { gap: 5px; }
  .log__cell { padding: 3px 7px 3px 4px; }
}

/* the keyboard line is for keyboards */
@media (pointer: coarse) { html.tc #ovKeys { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .overlay, .hint, .toast { transition: none; }
}
