:root {
  /* Night Tide: dark walnut wood, blue-teal panels, sea-foam highlights, cream cards. */
  --wood: #52463b;
  --wood-2: #342c25;
  --wood-dark: #241f1b;
  --wood-grain:
    radial-gradient(ellipse 80% 30% at 50% 0%, rgba(160, 210, 220, 0.14), transparent 70%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0 2px, transparent 2px 58px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, var(--wood), var(--wood-2));
  --card: #f2ece0;
  --paper: #faf6ee;
  --paper-2: #e4ddcd;
  --line: #d6cab3;
  --card-ink: #2c2a26;
  --card-muted: #6e675b;
  --card-head: #12323a;
  --light: #eef3ee;
  --light-muted: #c4baa8;
  --deep: #1f4f5a;
  --deep-2: #10282e;
  --edge: #12323a;
  --shallow: #2c6b78;
  --foam: #9fd8cc;
  --accent: #1f5560;
  --moss: #4d7c66;
  --gold: #d9a441;
  --teal: #4fa596;
  --amber: #e9bf62;
  --tab: #9c917f;
  --tab-active: var(--foam);
  --common: #8a8f87;
  --uncommon: #4e8b4a;
  --rare: #2f6fb0;
  --epic: #7a4bb0;
  --legendary: #d39a2c;
  --mythic: #b8479a;
  --trash: #8a7a66;
  --radius: 12px;
  --lift: 0 4px 0 rgba(0, 0, 0, 0.3), 0 10px 18px rgba(0, 0, 0, 0.32);
  --disp: "Zilla Slab", Rockwell, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  /* Text on the wood is light; surfaces below switch these back to dark ink. */
  --ink: var(--light);
  --muted: var(--light-muted);
  --head: var(--light);
  color-scheme: dark;
}

/* Cream surfaces: dark ink inside. */
.card,
.item,
.gear-card,
.dex-card,
.job,
.pick-option,
.messages,
.save-code {
  --ink: var(--card-ink);
  --muted: var(--card-muted);
  --head: var(--card-head);
  color: var(--ink);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--wood-2);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Work Sans", -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--wood-grain);
  background-color: var(--wood-2);
  -webkit-tap-highlight-color: transparent;
  /* It's a game: nothing on screen selects or pops up a callout on a long press. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Except where you type or copy a save code. */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

button,
select {
  font: inherit;
  color: inherit;
  min-height: 44px;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--disp);
  font-weight: 700;
  color: var(--head);
  line-height: 1.15;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

p {
  margin: 0;
}

.mono {
  font-family: var(--mono);
}

.overline {
  font: 700 13px var(--disp);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-head .overline {
  color: var(--foam);
}

.muted {
  color: var(--muted);
}

.ic {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- layout */

.app {
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.main {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 22px) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
}

/* Keeps scrolled content out of the strip under the status bar, where iOS softens
   whatever passes beneath it: plain wood, exactly as tall as the status bar, with no
   fade below. Only the home-screen app draws under the status bar, so a browser tab
   gets no strip. */
.app::before {
  content: none;
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: var(--wood);
  pointer-events: none;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tabs {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--wood-dark);
  border-top: 2px solid var(--deep);
}

.tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--tab);
  font-size: 11px;
  font-weight: 500;
}

.tabs button[aria-current="page"] {
  color: var(--tab-active);
  font-weight: 600;
}

.tabs button:disabled {
  opacity: 0.4;
}

.brand {
  display: none;
}

@media (display-mode: standalone) {
  .app::before {
    content: "";
  }
}

@media (min-width: 900px) {
  .app::before {
    left: 220px;
  }

  .app {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    padding-bottom: 0;
  }

  .tabs {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: calc(env(safe-area-inset-top) + 28px) 14px 28px;
    border-top: none;
    border-right: 2px solid var(--deep);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 22px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--foam);
    color: var(--edge);
    font: 700 24px var(--disp);
    box-shadow: 0 0 14px rgba(159, 216, 204, 0.4);
  }

  .brand-name {
    font: 700 28px var(--disp);
    color: var(--light);
  }

  .tabs button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    min-height: 48px;
    padding: 0 14px;
    font-size: 15px;
  }

  .tabs button[aria-current="page"] {
    background: rgba(159, 216, 204, 0.1);
  }

  .main {
    padding-top: calc(env(safe-area-inset-top) + 28px);
  }
}

@media (min-width: 1300px) {
  .main {
    max-width: 980px;
  }
}

/* ---------------------------------------------------------------- hud */

.hud {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--deep);
  box-shadow: 0 4px 0 var(--edge), 0 8px 12px rgba(0, 0, 0, 0.4);
  --muted: #a9c4c4;
}

.level-badge {
  grid-row: span 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--foam);
  color: var(--edge);
  font: 700 21px var(--disp);
  box-shadow: 0 0 14px rgba(159, 216, 204, 0.45);
}

.xp {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}

.xp-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.xp-top strong {
  font: 700 15px var(--disp);
}

.xp-top .mono {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--light);
  color: var(--edge);
  font: 500 15px var(--mono);
}

.coins .ic {
  width: 18px;
  height: 18px;
  color: #a8742a;
}

.hud-where {
  grid-column: 2 / 4;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.hud-where > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-where > .mono {
  flex-shrink: 0;
  font-size: 12px;
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--paper-2);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--shallow);
  border-radius: 4px;
}

.hud .bar {
  background: rgba(0, 0, 0, 0.25);
}

.hud .bar > span {
  background: var(--foam);
}

/* ---------------------------------------------------------------- messages */

.messages:empty {
  display: none;
}

.messages {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--lift);
  font-size: 14px;
}

.messages p + p {
  margin-top: 2px;
}

/* ---------------------------------------------------------------- building blocks */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  padding: 16px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--edge);
  box-shadow: 0 3px 0 var(--line);
  font: 700 15px var(--disp);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--line);
}

.btn:disabled {
  opacity: 0.45;
}

.btn-primary,
.btn-dark {
  border: none;
  background: linear-gradient(180deg, var(--shallow), var(--deep));
  color: var(--light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 5px 0 var(--edge), 0 9px 14px rgba(0, 0, 0, 0.3);
}

.btn-primary:active:not(:disabled),
.btn-dark:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 0 var(--edge), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-big {
  width: 100%;
  min-height: 64px;
  margin-bottom: 5px;
  border-radius: 14px;
  font: 700 25px var(--disp);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--moss);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip[data-rarity] {
  background: var(--paper);
  color: var(--card-ink);
  border: 1.5px solid var(--r);
}

.chip[data-rarity]::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--r);
}

[data-rarity="common"] { --r: var(--common); }
[data-rarity="uncommon"] { --r: var(--uncommon); }
[data-rarity="rare"] { --r: var(--rare); }
[data-rarity="epic"] { --r: var(--epic); }
[data-rarity="legendary"] { --r: var(--legendary); }
[data-rarity="mythic"] { --r: var(--mythic); }
[data-rarity="trash"] { --r: var(--trash); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--lift);
}

.item-main {
  flex: 1 1 150px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-title {
  font-weight: 600;
  color: var(--ink);
}

.item-meta {
  font-size: 13px;
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.item-actions .btn {
  min-height: 40px;
  padding: 0 12px;
}

.thumb {
  width: 76px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  padding: 4px;
}

.thumb > svg,
.thumb > svg.fish {
  width: 100%;
  height: 100%;
}

.section-title {
  margin-top: 10px;
}

.thumb.silhouette svg {
  filter: brightness(0);
  opacity: 0.16;
}

.gear-art {
  width: 68px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  padding: 2px 4px;
}

.gear-art > svg {
  width: 100%;
  height: 100%;
}

.gear-art.empty .ic {
  color: var(--muted);
}

/* ---------------------------------------------------------------- fish art */

svg.fish {
  display: block;
  width: 100%;
  height: auto;
}

svg.fish .ray {
  fill: none;
  stroke-width: 0.9;
  opacity: 0.4;
}

svg.fish .line {
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.7;
}

svg.fish .outline {
  fill: none;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

svg.fish .ruler-label {
  font: 500 12px var(--mono);
  fill: #7a725f;
}

.plate svg.fish {
  max-height: min(34vh, 320px);
  margin: 0 auto;
}

.plate {
  border-radius: 8px;
  background: var(--paper);
  border: 2px solid var(--r, var(--line));
  padding: 6px 10px;
}

/* ---------------------------------------------------------------- fishing */

.scene-card {
  position: relative;
  height: clamp(200px, 30vh, 420px);
  border-radius: 12px;
  border: 6px solid var(--card);
  overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.scene-card svg.scene {
  display: block;
  width: 100%;
  height: 100%;
}

.gear {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gear-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 62px;
  border: none;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--lift);
}

.gear-card .label {
  font-size: 12px;
  color: var(--muted);
}

.gear-pick {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.gear-pick:active {
  background: var(--paper);
}

.gear-pick > .ic {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.gear-card .value {
  font-weight: 600;
}

.fight {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--deep);
  color: var(--light);
  box-shadow: 0 4px 0 var(--edge), 0 10px 18px rgba(0, 0, 0, 0.35);
}

.fight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.pips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.pips span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #4f7f88;
}

.pips span.on {
  background: var(--foam);
  border-color: var(--foam);
}

.track {
  position: relative;
  height: 60px;
  border-radius: 30px;
  background: var(--deep-2);
  overflow: hidden;
}

.track .zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(159, 216, 204, 0.25);
  border-left: 2px solid var(--foam);
  border-right: 2px solid var(--foam);
}

.track .marker {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 12px;
  margin-left: -6px;
  border-radius: 6px;
  background: var(--light);
}

/* ---------------------------------------------------------------- tension gauge */

.gauge-wrap,
.run-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gauge-wrap[hidden],
.run-panel[hidden] {
  display: none;
}

.fight-hint {
  font-size: 13px;
  color: #b3cccb;
}

.gauge {
  position: relative;
  height: 56px;
  border-radius: 28px;
  background: linear-gradient(90deg, #6d6040, var(--deep-2) 22%, var(--deep-2) 78%, #3d3028);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.gauge .band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(159, 216, 204, 0.2);
  border-left: 2px solid var(--foam);
  border-right: 2px solid var(--foam);
}

.gauge .needle {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 8px;
  margin-left: -4px;
  border-radius: 4px;
  background: var(--light);
  box-shadow: 0 0 0 2px rgba(16, 40, 46, 0.6);
}

.gauge.high .needle {
  background: var(--amber);
}

.gauge.low .needle {
  background: #b9ad8c;
}

.gauge-end {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font: 500 11px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(238, 243, 238, 0.45);
  pointer-events: none;
}

.gauge-end.left {
  left: 14px;
}

.gauge-end.right {
  right: 14px;
}

.meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #b3cccb;
}

.meter .bar {
  height: 6px;
  background: var(--deep-2);
}

.meter .bar > span {
  background: #8fa6a6;
}

.meter.warn {
  color: var(--amber);
}

.meter.warn .bar > span {
  background: var(--amber);
}

#landing .bar,
#run-time .bar {
  height: 10px;
  background: var(--deep-2);
}

#landing .bar > span {
  background: var(--foam);
}

#run-time .bar > span {
  background: var(--amber);
}

.style-chip {
  background: var(--foam);
  color: var(--edge);
}

.btn-reel {
  min-height: 104px;
  font-size: 30px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.btn-reel.tap {
  background: linear-gradient(180deg, #f3d48a, var(--amber));
  color: var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 5px 0 #8a6a2a, 0 9px 14px rgba(0, 0, 0, 0.3);
}

.splash {
  animation: pulse 0.9s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes pulse {
  to {
    transform: scale(1.12);
    opacity: 0.8;
  }
}

.dip {
  animation: dip 0.5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes dip {
  to {
    transform: translateY(7px);
  }
}

.btn-strike {
  animation: strike 0.35s ease-in-out infinite alternate;
}

@keyframes strike {
  to {
    filter: brightness(1.15);
    transform: scale(1.02);
  }
}

.bob {
  animation: bob 2.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes bob {
  50% {
    transform: translateY(5px) rotate(-1deg);
  }
}

.swell {
  animation: swell 3s linear infinite;
}

@keyframes swell {
  to {
    transform: translateX(-200px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash,
  .dip,
  .btn-strike,
  .bob,
  .swell {
    animation: none;
  }
}

/* ---------------------------------------------------------------- catch card */

.catch {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.catch-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.stat span:first-child {
  font-size: 12px;
  color: var(--muted);
}

.stat span:last-child {
  font: 500 16px var(--mono);
}

.traits {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.trait {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
}

.trait .overline {
  padding-top: 2px;
  font-size: 11px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.choices .btn {
  min-height: 52px;
  white-space: normal;
}

/* ---------------------------------------------------------------- dex */

.dex-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dex-tabs .btn {
  min-height: 38px;
  font-size: 14px;
}

.dex-tabs .btn[aria-pressed="true"] {
  background: var(--deep);
  color: var(--foam);
  border-color: var(--deep);
  box-shadow: 0 3px 0 var(--edge);
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.dex-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--lift);
  text-align: left;
  font: inherit;
}

.dex-card .thumb {
  width: 100%;
  height: 70px;
}

.dex-card .name {
  font-weight: 600;
  font-size: 13px;
}

/* ---------------------------------------------------------------- shop */

.boat-thumb {
  width: 92px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #dde8e6;
  overflow: hidden;
}

.boat-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.swatch {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
}

.swatch svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------- licenses */

.license-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.license-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.license-art {
  width: 100%;
}

.license-art > svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.license .lic-over {
  font: 500 10px var(--mono);
  letter-spacing: 0.14em;
}

.license .lic-title {
  font: 700 24px var(--disp);
}

.license .lic-meta {
  font: 500 12px var(--mono);
}

.license .lic-stamp {
  font: 700 14px var(--mono);
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------- backup */

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.save-code {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 500 13px/1.4 var(--mono);
  word-break: break-all;
  resize: vertical;
}

.version {
  font-size: 12px;
  margin-top: 4px;
}

/* ---------------------------------------------------------------- waiting for a bite */

.waiting .dots span {
  animation: blink 1.4s infinite both;
}

.waiting .dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.waiting .dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.15;
  }
  40% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .waiting .dots span {
    animation: none;
  }
}

/* ---------------------------------------------------------------- catch, jobs, trophy wall */

.small {
  font-size: 13px;
}

.item-open {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 180px;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.item.notice {
  border: none;
  background: #dcefe9;
  box-shadow: inset 4px 0 0 var(--teal), var(--lift);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.jobs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--lift);
}

.job.ready {
  background: #dcefe9;
  box-shadow: inset 4px 0 0 var(--teal), var(--lift);
}

.job.empty {
  --ink: var(--light);
  --muted: var(--light-muted);
  color: var(--muted);
  background: transparent;
  border: 2px dashed rgba(238, 243, 238, 0.25);
  box-shadow: none;
  font-size: 14px;
}

.trophy-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 64px),
    linear-gradient(180deg, #2a2420, var(--wood-dark));
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.06);
}

.plaque {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 10px 10px;
  border: none;
  border-radius: 50% 50% 14px 14px / 24% 24% 14px 14px;
  background:
    repeating-linear-gradient(8deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, #a8764a, #8a5c36);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.plaque.empty {
  min-height: 150px;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed rgba(255, 255, 255, 0.25);
  box-shadow: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  cursor: default;
}

.plaque-fish {
  height: 70px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
}

.plaque-fish > svg {
  width: 100%;
  height: 100%;
}

.nameplate {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, #e8c77a, #c79c45);
  color: #3b2a12;
  text-align: center;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
}

.nameplate strong {
  font-family: var(--disp);
  font-size: 14px;
  line-height: 1.2;
}

/* ---------------------------------------------------------------- shop */

.shop-tabs {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 8px);
  z-index: 4;
  padding: 7px;
  border-radius: var(--radius);
  background: var(--wood-dark);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

.exam {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.exam li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam .ic {
  width: 16px;
  height: 16px;
}

.exam li.done {
  color: var(--ink);
}

.exam li.done .ic {
  color: var(--teal);
  stroke-width: 2.6;
}

.price {
  font: 700 17px var(--disp);
  color: var(--ink);
}

.bait-item .item-actions .btn {
  font-size: 14px;
}

/* ---------------------------------------------------------------- dex detail */

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

.description {
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.6;
}

.description p {
  margin: 0;
}

.description p:first-child::first-letter {
  float: left;
  margin: 4px 6px 0 0;
  font: 700 40px/0.8 var(--disp);
  color: var(--accent);
}

.howto h2 {
  margin: 0 0 6px;
}

.howto p {
  line-height: 1.55;
}

/* ---------------------------------------------------------------- modal and tutorial */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
  background: rgba(18, 14, 11, 0.6);
}

.modal {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal h2 {
  margin: 0;
}

.modal p {
  margin: 0;
  line-height: 1.55;
}

.modal-actions,
.coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.coach {
  position: relative;
  z-index: 21;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--deep);
  color: var(--light);
  box-shadow: 0 4px 0 var(--edge), 0 10px 18px rgba(0, 0, 0, 0.35);
}

.coach .overline {
  color: var(--foam);
}

.coach p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.coach .btn:not(.btn-primary) {
  background: transparent;
  color: var(--light);
  border-color: rgba(238, 243, 238, 0.4);
  box-shadow: none;
}

.coach .btn-primary {
  background: linear-gradient(180deg, #b5e4da, var(--foam));
  color: var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 0 #5f9a8f;
}

/* The tutorial spotlight: a hole the size of the control to press in a dimmed screen,
   ringed and pulsing. It never takes taps. */
.coach-spot {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 0 4px var(--foam), 0 0 18px 6px rgba(159, 216, 204, 0.7), 0 0 0 200vmax rgba(8, 18, 22, 0.58);
}

.coach-spot.no-dim {
  box-shadow: 0 0 0 4px var(--foam), 0 0 18px 6px rgba(159, 216, 204, 0.7);
}

.coach-spot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 4px solid var(--foam);
  border-radius: inherit;
  animation: coach-pulse 1.1s ease-out infinite;
}

@keyframes coach-pulse {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.25, 1.6);
  }
}

.dangle {
  animation: dangle 2.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: top center;
}

@keyframes dangle {
  50% {
    transform: rotate(4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-spot::after,
  .dangle {
    animation: none;
  }
}

/* During a fight the tabs are disabled anyway, so the phone layout hides them to keep
   the Reel button on screen. */
.fight-scene {
  height: clamp(100px, 18vh, 260px);
}

@media (max-width: 899px) {
  body.in-fight .tabs {
    display: none;
  }

  body.in-fight .app {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ---------------------------------------------------------------- collapsible sections */

.fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::after {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.fold[open] > summary::after {
  transform: rotate(-135deg);
}

.fold[open] > summary {
  margin-bottom: 10px;
}

.stat-rows {
  gap: 8px;
}

.stat-rows .chip {
  font-size: 12px;
}

.fold + .fold {
  margin-top: -4px;
}

/* ---------------------------------------------------------------- pickers and confirmations */

.btn-danger {
  border: none;
  background: linear-gradient(180deg, #4a3c31, #2f2620);
  color: var(--light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 5px 0 #1a1512, 0 9px 14px rgba(0, 0, 0, 0.3);
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(55vh, 460px);
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.pick-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.pick-option.selected {
  border-color: var(--teal);
  background: #dcefe9;
}

.pick-option > .ic {
  color: var(--teal);
  stroke-width: 2.6;
}

.empty-thumb .ic {
  color: var(--muted);
}

/* ---------------------------------------------------------------- completion and challenges */

.completion,
.challenge {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.completion-pct {
  font: 700 28px var(--disp);
  color: var(--accent);
}

.challenge-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.challenge-head .thumb {
  width: 92px;
  height: 56px;
}

.challenge.locked {
  opacity: 0.75;
}

.challenge.locked .thumb {
  color: var(--muted);
}

.exam li.current {
  color: var(--ink);
  font-weight: 600;
}

.best-bait {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.conditions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -4px;
}

.chip.season {
  background: var(--gold);
  color: var(--edge);
}

.chip.alt {
  background: var(--foam);
  color: var(--edge);
}

.quest-note {
  padding: 8px 12px;
  border-radius: 8px;
  background: #dcefe9;
  box-shadow: inset 4px 0 0 var(--teal);
  font-size: 14px;
}

.share-btn {
  align-self: flex-start;
  min-height: 38px;
  font-size: 14px;
}

.share-btn .ic {
  width: 18px;
  height: 18px;
}

/* ---------------------------------------------------------------- stats */

.completion-parts {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.completion-part {
  display: grid;
  grid-template-columns: 7.5em 1fr 4.2em;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.completion-part .mono {
  text-align: right;
  color: var(--ink);
  font-size: 12px;
}

.bar-thin {
  height: 5px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--deep);
  box-shadow: var(--lift);
  min-width: 0;
}

.tile-value {
  font: 700 19px var(--disp);
  color: var(--light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--foam);
}

.menu {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 0;
  background: none;
  font: 600 15px var(--disp);
  color: var(--head);
  text-align: left;
  cursor: pointer;
}

.menu-row + .menu-row {
  border-top: 1px solid var(--line);
}

.menu-row .ic {
  color: var(--accent);
}

.menu-row .ic:last-child {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.menu-label {
  flex: 1;
  font-size: 16px;
}

.menu-aside {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.fold.card > summary .section-title {
  margin: 0;
  font-size: 19px;
}

.fold.card + .fold.card {
  margin-top: 0;
}

.record {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.record .muted {
  font-size: 12px;
  font-weight: 400;
}

/* ---------------------------------------------------------------- license requirements */

.license-foot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.needs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.need {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--light-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.need .ic {
  width: 14px;
  height: 14px;
}

.need.done {
  background: var(--moss);
  color: var(--light);
}

.need.done .ic {
  stroke-width: 2.6;
}

.license-foot .btn .ic {
  width: 16px;
  height: 16px;
}

/* On cream cards the open requirement chips are paper, not shadow. */
.item .need:not(.done),
.card .need:not(.done) {
  background: var(--paper-2);
  color: var(--card-muted);
}

.weather-clock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.weather-clock .ic {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------------- legends */

.chip.legend-chip {
  background: var(--gold);
  color: var(--edge);
}

.chip.legend-chip.dim {
  background: rgba(217, 164, 65, 0.25);
  color: var(--gold);
}

.card .chip.legend-chip.dim {
  background: var(--paper-2);
  color: var(--card-muted);
}

.legends {
  gap: 12px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend .plate {
  border-radius: 10px;
}

.legend-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend.locked {
  opacity: 0.8;
}

/* ---------------------------------------------------------------- achievements */

.title-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title-chip {
  border: 0;
  cursor: pointer;
  background: var(--paper-2);
  color: var(--card-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.title-chip.on {
  background: var(--deep);
  color: var(--light);
}

.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  opacity: 0.6;
}

.achievement + .achievement {
  border-top: 1px solid var(--line);
}

.achievement.got {
  opacity: 1;
}

.achievement > .ic {
  color: var(--muted);
}

.achievement.got > .ic {
  color: var(--gold);
}

.achievement .item-main {
  flex: 1;
}

.catch-head-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.btn.btn-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
  box-shadow: none;
  align-self: flex-start;
}

/* ---------------------------------------------------------------- daily quests */

.daily {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-quest {
  display: flex;
  align-items: center;
  gap: 10px;
}

.daily-quest .item-main {
  flex: 1;
  gap: 5px;
}

.daily-quest > .ic {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.daily-quest.done > .ic {
  color: var(--teal);
  stroke-width: 2.6;
}

.daily-quest.done .item-title {
  color: var(--muted);
  text-decoration: line-through;
}

/* A harbor job in a finished daily quest's place: a flat row inside the quest card. */
.daily .job {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper-2);
  box-shadow: none;
}

.daily .job.ready {
  background: #dcefe9;
  box-shadow: inset 4px 0 0 var(--teal);
}

.daily-week {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Fog banks drift slowly across the water. The banks are drawn twice, a scene's width
   apart, so the drift loops without a jump. */
.fog-drift {
  animation: fog-drift 90s linear infinite;
}

@keyframes fog-drift {
  to {
    transform: translateX(-800px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fog-drift {
    animation: none;
  }
}

/* ---------------------------------------------------------------- sea chart */

.chart-card {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 12px;
  border: 6px solid var(--card);
  overflow: hidden;
  background: #a3cdd2;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.chart-card svg.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-pin {
  cursor: pointer;
  outline: none;
}

.chart-pin.locked {
  opacity: 0.85;
}

.chart-pin:focus-visible circle:nth-of-type(2) {
  stroke: var(--teal);
  stroke-width: 3;
}

.chart-label {
  font: 600 9.5px "Work Sans", system-ui, sans-serif;
  fill: #2e3a42;
  stroke: #f4f1ea;
  stroke-width: 3px;
  stroke-linejoin: round;
  paint-order: stroke;
}

.chart-label.sel {
  font-size: 11px;
}

.chart-n {
  font: 700 8px "Work Sans", system-ui, sans-serif;
  fill: #f4f1ea;
}

.chart-halo {
  animation: chart-halo 1.4s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes chart-halo {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.7);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chart-halo {
    animation: none;
  }
}
