/* Real Seas — period-flavored, parchment-and-ink styling */

:root {
  --parchment: #efe4cc;
  --parchment-light: #f7eed8;
  --parchment-dark: #d6c69a;
  --ink: #3a2a18;
  --ink-soft: #5a4630;
  --ink-faint: #8a7250;
  --rust: #8b3a1c;
  --rust-dim: #6a2a13;
  --gold: #b8860b;
  --gold-light: #d9a72a;
  --shadow: rgba(58, 42, 24, 0.25);
  --shadow-dark: rgba(58, 42, 24, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.45;
  background-image:
    radial-gradient(ellipse at top, rgba(255, 245, 220, 0.6), transparent 70%),
    radial-gradient(ellipse at bottom, rgba(120, 90, 50, 0.12), transparent 60%);
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  min-height: 100%;
  animation: screen-in 360ms ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1, h2, h3 {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 { font-size: 2.2rem; margin: 0 0 0.4rem; }
h1.title {
  font-size: 3.2rem;
  text-align: center;
  margin-bottom: 0.2rem;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 var(--parchment-light), 0 2px 4px var(--shadow);
}
h2 {
  font-size: 1.5rem;
  margin: 1.5rem 0 0.5rem;
  border-bottom: 1px solid var(--ink-faint);
  padding-bottom: 0.3rem;
  letter-spacing: 0.04em;
}
h2 .lede { font-weight: 400; font-style: italic; color: var(--ink-faint); font-size: 0.85em; margin-left: 8px; }
h3 { font-size: 1.2rem; margin: 0 0 0.2rem; }

p, label { color: var(--ink-soft); }

.subtitle { text-align: center; font-style: italic; color: var(--ink-faint); margin-bottom: 2rem; }

button {
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 18px;
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
  box-shadow: 0 1px 0 var(--shadow);
}
button:hover { background: var(--ink-soft); transform: translateY(-1px); box-shadow: 0 2px 4px var(--shadow); }
button:active { transform: translateY(1px); box-shadow: 0 0 0 var(--shadow); }
button:disabled {
  background: var(--ink-faint);
  border-color: var(--ink-faint);
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}
button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink-soft);
  box-shadow: none;
}
button.secondary:hover { background: rgba(58, 42, 24, 0.08); }
button.danger { background: var(--rust); border-color: var(--rust); }
button.danger:hover { background: var(--rust-dim); }
button.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 700;
  padding: 10px 24px;
  font-size: 1.05rem;
}
button.primary:hover { background: var(--gold-light); }

input[type="text"], input[type="number"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 12px;
  background: var(--parchment-light);
  color: var(--ink);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.18);
}
input[type="number"] { width: 64px; text-align: center; }

/* ── Lobby ───────────────────────────────────────────────────────────────── */
.lobby {
  max-width: 480px;
  margin: 60px auto;
  padding: 40px 36px 32px;
  background:
    repeating-linear-gradient(180deg, transparent 0 28px, rgba(138, 114, 80, 0.05) 28px 29px),
    var(--parchment-light);
  border: 1px solid var(--ink-faint);
  box-shadow:
    0 6px 24px var(--shadow),
    inset 0 0 60px rgba(138, 114, 80, 0.1);
  position: relative;
}
.lobby::before, .lobby::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--ink-faint);
  pointer-events: none;
  opacity: 0.5;
}
.lobby form { display: flex; flex-direction: column; gap: 16px; }
.lobby label { font-weight: 600; color: var(--ink); letter-spacing: 0.04em; }

/* ── Origin Selection ────────────────────────────────────────────────────── */
.origin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
@media (max-width: 760px) {
  .origin-grid { grid-template-columns: 1fr; }
}

.origin-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255, 250, 235, 0.5), rgba(214, 198, 154, 0.18)),
    var(--parchment-light);
  border: 2px solid var(--ink-soft);
  padding: 28px 20px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 2px 6px var(--shadow);
}
.origin-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--ink-faint);
  pointer-events: none;
  opacity: 0.5;
}
.origin-card:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: 0 10px 28px var(--shadow-dark);
  border-color: var(--ink);
}
.origin-card:hover .seal { animation: seal-wobble 480ms ease-in-out; }
.origin-card:active { transform: translateY(-2px) scale(0.995); }

.origin-card .seal {
  position: absolute;
  top: -16px;
  right: -12px;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle at 35% 30%, #b3502c 0%, var(--rust) 55%, var(--rust-dim) 100%);
  border-radius: 50%;
  border: 2px solid var(--ink);
  box-shadow: 2px 3px 8px var(--shadow-dark), inset 0 2px 4px rgba(255, 220, 200, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f8e7c8;
  font-size: 30px;
  font-weight: 700;
  transform: rotate(-14deg);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.45);
  user-select: none;
}

@keyframes seal-wobble {
  0%   { transform: rotate(-14deg) scale(1); }
  30%  { transform: rotate(-22deg) scale(1.06); }
  60%  { transform: rotate(-8deg)  scale(1.02); }
  100% { transform: rotate(-14deg) scale(1); }
}

.origin-card h3 {
  margin-top: 4px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}
.origin-card .epithet {
  font-style: italic;
  color: var(--ink-faint);
  margin: 0 0 14px;
  font-size: 0.95rem;
}
.origin-card .divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--ink-faint), transparent);
  margin: 0 0 14px;
}
.origin-card .blurb {
  font-style: italic;
  color: var(--ink-soft);
  flex: 1;
  margin: 0 0 18px;
}
.origin-card .blurb::first-letter {
  font-size: 2.6em;
  float: left;
  line-height: 0.95;
  margin: 4px 6px -2px 0;
  color: var(--rust);
  font-family: 'Georgia', serif;
  font-weight: 700;
  text-shadow: 1px 1px 0 var(--parchment-light);
}
.origin-card .stats { padding-top: 12px; border-top: 1px dashed var(--ink-faint); font-size: 0.95rem; }
.origin-card .reales { color: var(--gold); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.origin-card .bonus  { color: var(--ink-soft); margin-top: 4px; }

/* ── Outfitting ──────────────────────────────────────────────────────────── */
.outfit-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.outfit-header h1 { margin: 0; }

.outfit-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 0 -16px 20px;
  background:
    linear-gradient(to bottom, var(--parchment-light) 0%, var(--parchment) 100%);
  border-top: 1px solid var(--ink-faint);
  border-bottom: 1px solid var(--ink-faint);
  box-shadow: 0 4px 10px var(--shadow);
}
.outfit-toolbar .toolbar-label {
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.outfit-toolbar .purse {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
  transition: color 0.2s ease, transform 0.2s ease;
}
.outfit-toolbar .purse.bumped { animation: purse-bump 480ms ease-out; }

@keyframes purse-bump {
  0%   { transform: translateY(0) scale(1); color: var(--gold); }
  30%  { transform: translateY(-3px) scale(1.06); color: var(--rust); }
  100% { transform: translateY(0) scale(1); color: var(--gold); }
}

.outfit-warning {
  font-style: italic;
  color: var(--rust);
  margin-bottom: 12px;
}

.category-section {
  margin-bottom: 32px;
  animation: category-in 420ms ease-out backwards;
}
.category-section:nth-child(2) { animation-delay: 40ms; }
.category-section:nth-child(3) { animation-delay: 80ms; }
.category-section:nth-child(4) { animation-delay: 120ms; }
.category-section:nth-child(5) { animation-delay: 160ms; }
.category-section:nth-child(6) { animation-delay: 200ms; }

@keyframes category-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.item-list { display: grid; grid-template-columns: 1fr; gap: 8px; }

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 12px 14px;
  background: var(--parchment-light);
  border: 1px solid var(--parchment-dark);
  align-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.item-row:hover {
  transform: translateX(2px);
  border-color: var(--ink-faint);
  box-shadow: 0 2px 6px var(--shadow);
}
.item-row .name { font-weight: 700; }
.item-row .price { color: var(--gold); margin-left: 8px; font-size: 0.95rem; }
.item-row .unit { color: var(--ink-faint); font-size: 0.85rem; margin-left: 6px; }
.item-row .desc { color: var(--ink-soft); font-size: 0.9rem; margin-top: 2px; }
.item-row .controls { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.item-row .controls .owned {
  font-weight: 600;
  color: var(--ink);
  margin-right: 8px;
  min-width: 32px;
  text-align: right;
  transition: color 0.2s ease;
}
.item-row.unique-owned { opacity: 0.55; }
.item-row.unique-owned .name::after {
  content: ' — owned';
  color: var(--ink-faint);
  font-weight: 400;
  font-style: italic;
}
.item-row.essential { border-left: 3px solid var(--gold); }
.item-row .essential-mark {
  color: var(--gold);
  font-weight: 700;
  margin-left: 6px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}
.item-row.flash-buy  { animation: flash-buy 600ms ease-out; }
.item-row.flash-sell { animation: flash-sell 600ms ease-out; }

@keyframes flash-buy {
  0%   { background: var(--parchment-light); }
  20%  { background: #f6e0a0; border-color: var(--gold); }
  100% { background: var(--parchment-light); }
}
@keyframes flash-sell {
  0%   { background: var(--parchment-light); }
  20%  { background: #e8c8b8; border-color: var(--rust); }
  100% { background: var(--parchment-light); }
}

.set-sail-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--parchment) 60%, rgba(239, 228, 204, 0));
  border-top: 2px solid var(--ink);
  padding: 16px 0;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#set-sail-btn {
  animation: gentle-pulse 2.2s ease-in-out infinite;
}
@keyframes gentle-pulse {
  0%, 100% { box-shadow: 0 1px 0 var(--shadow), 0 0 0 0 rgba(184, 134, 11, 0.4); }
  50%      { box-shadow: 0 1px 0 var(--shadow), 0 0 0 10px rgba(184, 134, 11, 0); }
}

/* ── At Sea ──────────────────────────────────────────────────────────────── */
.at-sea { text-align: center; }

.card {
  background: var(--parchment-light);
  border: 1px solid var(--ink-faint);
  padding: 16px 18px;
  box-shadow: 0 2px 8px var(--shadow);
  text-align: left;
  margin-bottom: 18px;
}
.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
}
.card-empty {
  font-style: italic;
  color: var(--ink-faint);
  text-align: center;
  margin: 12px 0;
}

.at-sea canvas.sea-canvas {
  display: block;
  margin: 0 auto 16px;
  background: #4a6a82;
  border: 1px solid var(--ink-soft);
  box-shadow: 0 4px 14px var(--shadow);
  max-width: 100%;
}
.coast-banner {
  text-align: center;
  font-style: italic;
  color: var(--rust);
  margin: -8px auto 18px;
  padding: 6px 14px;
  background: rgba(139, 58, 28, 0.08);
  border: 1px solid rgba(139, 58, 28, 0.3);
  border-radius: 2px;
  max-width: 640px;
}
.coast-banner strong { color: var(--ink); font-weight: 700; }

/* ── Flag bar */
.flag-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 18px;
  background: var(--parchment-light);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
}
.flag-current {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.flag-current.flag-peace { color: var(--ink-soft); }
.flag-current.flag-war   { color: var(--rust);   }
.flag-badge {
  display: inline-block;
  font-size: 0.78rem;
  padding: 1px 8px;
  margin-left: 8px;
  border-radius: 2px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.flag-badge.flag-peace { background: var(--parchment-dark); color: var(--ink); }
.flag-badge.flag-war   { background: var(--rust); color: var(--parchment-light); }

/* ── Trade banner */
.trade-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 2px;
  animation: trade-pulse 600ms ease-out;
}
.trade-banner.incoming {
  background: rgba(184, 134, 11, 0.15);
  border: 1px solid var(--gold);
}
.trade-banner.outgoing {
  background: var(--parchment-light);
  border: 1px solid var(--ink-faint);
  color: var(--ink-soft);
  font-style: italic;
}
.trade-banner .actions { display: flex; gap: 8px; }
@keyframes trade-pulse {
  0% { transform: scale(0.98); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Trade modal */
.trade-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trade-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 24, 0.55);
}
.trade-modal-panel {
  position: relative;
  background: var(--parchment-light);
  border: 2px solid var(--ink);
  padding: 24px 28px;
  width: min(440px, 90vw);
  box-shadow: 0 12px 40px var(--shadow-dark);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-modal-panel h3 { margin: 0 0 6px; }
.trade-modal-panel label {
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
  font-size: 0.9rem;
}
.trade-modal-panel select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  background: var(--parchment);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
}
.trade-modal-panel input[type="number"] { width: 100%; }
.trade-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* ── Island shop */
.island-shop {
  text-align: left;
}
.island-shop .item-row .stock { color: var(--ink-faint); font-size: 0.85rem; }

/* ── Tortuga arrival */
.tortuga-screen { text-align: center; padding-top: 20px; }
.victory-card {
  max-width: 640px;
  margin: 20px auto;
  background:
    linear-gradient(135deg, rgba(255, 250, 235, 0.5), rgba(214, 198, 154, 0.18)),
    var(--parchment-light);
  border: 2px solid var(--ink);
  padding: 36px 32px;
  position: relative;
  box-shadow: 0 12px 40px var(--shadow-dark);
}
.victory-card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--ink-faint);
  pointer-events: none;
  opacity: 0.5;
}
.victory-card .seal {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  width: 70px; height: 70px;
  background: radial-gradient(circle at 35% 30%, #d9a72a 0%, var(--gold) 60%, #7a5800 100%);
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--ink);
  box-shadow: 2px 3px 10px var(--shadow-dark);
}
.victory-card h2 { margin: 26px 0 0; }
.victory-card .epithet { color: var(--ink-faint); font-style: italic; margin: 2px 0 8px; }
.victory-card .divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--ink-faint), transparent);
  margin: 12px 0 18px;
}
.victory-flavor { color: var(--ink-soft); margin: 0 0 22px; }
.victory-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  text-align: left;
}
.victory-stats .stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed rgba(138,114,80,0.18); }
.victory-stats .key { color: var(--ink-faint); }
.victory-stats .val { color: var(--ink); font-weight: 700; }

.atsea-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 18px;
  align-items: stretch;
  text-align: left;
  margin: 16px 0 18px;
}
.atsea-grid > .card { margin-bottom: 0; }
@media (max-width: 720px) {
  .atsea-grid { grid-template-columns: 1fr; }
}

.atsea-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}
.atsea-grid-2 > .card { margin-bottom: 0; }
@media (max-width: 820px) { .atsea-grid-2 { grid-template-columns: 1fr; } }

.compass-panel { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; }
.compass-panel canvas.compass {
  display: block;
  background: transparent;
  border: none;
  box-shadow: 0 6px 18px var(--shadow);
  border-radius: 50%;
  cursor: crosshair;
  transition: transform 0.15s ease;
}
.compass-panel canvas.compass:hover { transform: scale(1.02); }
.compass-panel canvas.compass[data-locked="true"] { cursor: default; opacity: 0.7; }
.compass-panel canvas.compass[data-locked="true"]:hover { transform: none; }
.compass-hint {
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin: 4px 0 0;
  text-align: center;
}

.state-log {
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}
.state-log > div { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; }
.state-log .key { color: var(--ink-faint); }
.state-log .val { color: var(--ink); font-weight: 700; text-align: right; }

/* ── Sightings ───────────────────────────────────────────────────────────── */
.sightings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sighting {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  border-radius: 2px;
}
.sighting:hover { background: #faf3df; }
.sighting .bearing { display: flex; justify-content: center; align-items: center; }
.sighting .label { font-weight: 600; }
.sighting .meta { font-size: 0.85rem; color: var(--ink-faint); font-style: italic; }
.sighting .hp { color: var(--rust); font-weight: 700; margin-left: 6px; font-size: 0.9rem; }
.sighting .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sighting .actions button { padding: 4px 10px; font-size: 0.85rem; }
.sighting .in-range {
  display: inline-block;
  background: var(--rust);
  color: var(--parchment-light);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 2px;
  margin-left: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Gunnery (shot selector + battery state) */
.gunnery {
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 2px;
}
.gunnery-empty {
  text-align: center;
  color: var(--ink-faint);
  font-style: italic;
  margin: 8px 0;
}
.gunnery-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.gunnery-info .gun-ready { color: var(--gold); font-weight: 700; }
.gunnery-info .gun-cooling { color: var(--rust); font-style: italic; }
.shot-selector { display: flex; gap: 8px; }
.shot-selector label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--parchment-light);
  border: 1px solid var(--parchment-dark);
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 2px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.shot-selector label:hover { background: #faf3df; }
.shot-selector label.active {
  background: var(--ink-soft);
  color: var(--parchment-light);
  border-color: var(--ink);
}
.shot-selector label.short { opacity: 0.55; }
.shot-selector label input { display: none; }
.shot-selector label .count { color: var(--ink-faint); font-size: 0.85rem; }
.shot-selector label.active .count { color: var(--parchment); }

/* ── Port grid */
.port-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.port-card { min-height: 320px; }
.port-card .port-flag {
  position: absolute;
  top: -12px;
  left: -10px;
  width: 50px; height: 50px;
  background: var(--ink);
  color: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 2px 3px 8px var(--shadow-dark);
  user-select: none;
}

/* ── Chat ────────────────────────────────────────────────────────────────── */
.chat-card { display: flex; flex-direction: column; }
.chat-history {
  flex: 1;
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  padding: 10px 12px;
  font-family: 'Georgia', serif;
  font-size: 0.92rem;
  line-height: 1.5;
  max-height: 240px;
  min-height: 120px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.chat-line {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(138, 114, 80, 0.18);
}
.chat-line:last-child { border-bottom: none; }
.chat-line .chat-time { color: var(--ink-faint); font-variant: small-caps; font-size: 0.78rem; padding-top: 2px; }
.chat-line.kind-chat_out .chat-text { color: var(--ink-soft); font-style: italic; }
.chat-line.kind-chat_in .chat-text { color: var(--ink); }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }

/* ── Fishing ─────────────────────────────────────────────────────────────── */
.fishing-actions { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.fishing-status { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; margin-bottom: 10px; }
.fishing-status .muted { color: var(--ink-faint); }
.deployed-net {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  margin-bottom: 6px;
}
.deployed-net.broken { background: #f0e0d6; border-color: var(--rust); }
.deployed-net.broken .net-label { color: var(--rust); }
.deployed-net .net-label { font-weight: 600; }
.deployed-net .net-meta { font-size: 0.85rem; color: var(--ink-faint); }
.fishing-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--ink-faint);
  margin-top: 10px;
  padding-top: 10px;
}
.fishing-summary strong { color: var(--ink); }

.voyage-log .log-list {
  background:
    repeating-linear-gradient(180deg, transparent 0 26px, rgba(138, 114, 80, 0.08) 26px 27px),
    var(--parchment-light);
  border: 1px solid var(--ink-faint);
  padding: 12px 22px;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  max-height: 360px;
  overflow-y: auto;
}
.voyage-log .log-empty {
  font-style: italic;
  color: var(--ink-faint);
  text-align: center;
  margin: 12px 0;
}
.voyage-log .log-entry {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 4px 0;
  line-height: 26px;
  border-bottom: 1px dashed rgba(138, 114, 80, 0.18);
  animation: log-fade-in 320ms ease-out;
}
.voyage-log .log-entry:last-child { border-bottom: none; }
.voyage-log .log-time {
  color: var(--ink-faint);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.voyage-log .log-text { color: var(--ink); }

/* Color hints by event kind */
.voyage-log .kind-storm .log-text,
.voyage-log .kind-gale .log-text,
.voyage-log .kind-hull_low .log-text { color: var(--rust); }
.voyage-log .kind-scurvy_death .log-text,
.voyage-log .kind-starvation_death .log-text,
.voyage-log .kind-thirst_death .log-text,
.voyage-log .kind-crew_lost_all .log-text { color: var(--rust-dim); font-weight: 600; }
.voyage-log .kind-doldrums_entered .log-text { color: var(--ink-faint); font-style: italic; }
.voyage-log .kind-arrived .log-text,
.voyage-log .kind-whale_killed .log-text { color: var(--gold); font-weight: 700; }
.voyage-log .kind-embark .log-text { color: var(--ink-soft); font-style: italic; }
.voyage-log .kind-sighting_ship .log-text,
.voyage-log .kind-sighting_whale .log-text,
.voyage-log .kind-sighting_fish .log-text { color: #3a5a82; font-style: italic; }
.voyage-log .kind-harpoon_hit .log-text { color: var(--rust); font-weight: 600; }
.voyage-log .kind-rod_caught .log-text,
.voyage-log .kind-net_hauled .log-text { color: var(--ink); font-weight: 600; }
.voyage-log .kind-net_broke .log-text { color: var(--rust); font-style: italic; }
.voyage-log .kind-volley_fired .log-text { color: #5a4a2c; font-weight: 600; }
.voyage-log .kind-volley_received .log-text { color: var(--rust); font-weight: 700; }
.voyage-log .kind-ship_sunk_enemy .log-text { color: var(--gold); font-weight: 700; }
.voyage-log .kind-ship_sunk_self .log-text,
.voyage-log .kind-ran_aground .log-text { color: var(--rust-dim); font-weight: 700; }
.voyage-log .kind-coast_sighted .log-text { color: var(--ink-soft); font-style: italic; }

@keyframes log-fade-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Error Banner ────────────────────────────────────────────────────────── */
#error-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rust);
  color: var(--parchment-light);
  padding: 10px 20px;
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--shadow-dark);
  z-index: 100;
  font-size: 0.95rem;
  max-width: 90vw;
  animation: error-slide 240ms ease-out;
}
@keyframes error-slide {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
