/* Tradewinds. Same rules as Geodaily: no framework, no build step, and a
   palette that survives being looked at for an hour. */

:root {
  --bg: #071018;
  --bg-2: #0b1a24;
  --panel: #0e202c;
  --panel-2: #122a38;
  --line: #1d3a4a;
  --text: #e6f1f7;
  --muted: #7f9daf;
  --sea: #0a1b26;
  --accent: #34d399;
  --accent-dim: #1c7a5a;
  --gold: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/*--- top bar -------------------------------------------------------------*/

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--accent); }
.logo { width: 24px; height: 24px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--text); }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
}

.icon-btn:hover { color: var(--text); border-color: var(--accent-dim); }

.stats { display: flex; gap: 20px; align-items: baseline; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 19px; font-variant-numeric: tabular-nums; }
#gold { color: var(--gold); }
#income { color: var(--accent); }
.rank b { font-size: 14px; font-weight: 600; }

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

.wrap {
  display: grid;
  /* The side column is fluid so the map keeps the space it needs instead of
     being squeezed into whatever is left over on a small laptop. */
  grid-template-columns: minmax(0, 1fr) clamp(320px, 27%, 380px);
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px;
  align-items: start;
}

.map-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sea);
  overflow: hidden;
  min-height: 320px;
}

/* The route lists are taller than the map, so on a wide screen the map is
   pinned: it stays in view while the player scrolls, and the column never
   reads as a mostly-empty half of the page. */
@media (min-width: 1180px) {
  .map-panel {
    position: sticky;
    top: 66px;
  }
}

#map { display: block; width: 100%; height: auto; }

.map-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

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

/*--- shipment button -----------------------------------------------------*/

.ship-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #34d399, #14a06f);
  color: #04231a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}

.ship-btn:hover { filter: brightness(1.06); }
.ship-btn:active { transform: scale(0.985); }
.ship-label { font-size: 15px; }
.ship-value { font-size: 15px; font-variant-numeric: tabular-nums; opacity: 0.85; }

/*--- goal chip -----------------------------------------------------------*/

.goal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 11px 13px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.goal.is-hit {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 6px 22px rgba(251, 191, 36, 0.16);
}

.goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.goal-kicker {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.goal.is-hit .goal-kicker { color: var(--gold); }

.goal-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-text { font-size: 14.5px; font-weight: 650; line-height: 1.3; }

.goal-bar {
  margin-top: 9px;
  height: 5px;
  border-radius: 3px;
  background: #0a1a24;
  overflow: hidden;
}

.goal-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #1c7a5a, var(--accent));
  transition: width 0.25s ease;
}

.goal.is-hit .goal-bar i { background: var(--gold); }

/*--- panels --------------------------------------------------------------*/

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.panel h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}

/*--- rows ----------------------------------------------------------------*/

.route-list, .upgrade-list { display: flex; flex-direction: column; gap: 7px; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}

.row.is-selected { border-color: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-dim) inset; }
.row.is-locked { opacity: 0.55; }

.row-name { font-size: 14.5px; font-weight: 650; line-height: 1.25; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.row-rate { font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums; }

.buy {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1a24;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 6px 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.buy:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--accent); }
.buy:disabled { opacity: 0.42; cursor: default; }
.buy .cost { color: var(--gold); }
.buy:disabled .cost { color: var(--muted); }
.buy.wide { width: 100%; padding: 10px 12px; }

.era-copy { margin: 0 0 9px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.badge.milestone { border-color: var(--gold); color: var(--gold); }

/*--- modal ---------------------------------------------------------------*/

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 8, 12, 0.76);
  z-index: 40;
}

.modal[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.modal-actions { display: flex; gap: 9px; align-items: center; }
.modal-actions .primary { flex: 1; }
.modal-actions .buy { flex: 0 0 auto; padding: 13px 16px; }

/*--- onboarding ----------------------------------------------------------*/

.ob-card { position: relative; padding-top: 26px; max-width: 420px; }

.ob-card .link-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  color: var(--muted);
}

.ob-kicker {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.ob-step h2 { font-size: 21px; line-height: 1.25; }
.ob-copy { margin: 0 0 14px !important; }

.ob-art {
  margin-top: 4px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #0a1a24;
}

.ob-globe {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(52, 211, 153, 0.5);
  background: radial-gradient(circle at 32% 28%, rgba(52, 211, 153, 0.2), transparent 62%);
  font-size: 34px;
}

.ob-fake-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #34d399, #14a06f);
  color: #04231a;
  font-weight: 700;
  font-size: 14px;
}

.ob-fake-btn.ghost {
  background: #0a1a24;
  border: 1px solid var(--line);
  color: var(--text);
}

.ob-fake-btn.ghost b { color: var(--gold); }

.ob-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 13.5px;
}

.ob-row b { display: block; font-weight: 650; }
.ob-row i { font-style: normal; font-size: 12px; color: var(--muted); }
.ob-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ob-row-right em { font-style: normal; font-size: 12.5px; color: var(--accent); }
.ob-row-right u {
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 650;
}

.ob-fake-modal {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel-2);
}

.ob-fake-modal b { font-size: 14px; }
.ob-fake-modal i { font-style: normal; font-size: 12.5px; color: var(--muted); }

.ob-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 14px;
}

.ob-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.ob-dots span.is-on { background: var(--accent); }

.primary {
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #04231a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.footnote {
  max-width: 1320px;
  margin: 4px auto 28px;
  padding: 0 18px;
  font-size: 12px;
  color: var(--muted);
}

/*--- narrow --------------------------------------------------------------*/

/* Below this width the two-column layout squeezed the map to roughly half the
   size it has in single column (measured: 873x438 at 899px, 479x241 at 901px).
   The map is the playfield, so single column now runs all the way up to 1179px. */
@media (max-width: 1179px) {
  .wrap { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .map-panel { position: relative; min-height: 200px; }
  .side { gap: 10px; }
  .stats { gap: 14px; width: 100%; justify-content: space-between; }
  #gold, #income { font-size: 17px; }
  .rank b { font-size: 13px; }
  /* The route lists are long on a phone, and tapping to earn is the very first
     thing a new player does, so the button becomes a fixed action bar. Sticky
     does not help here: the button sits at the top of a tall column, so it
     scrolls away before any bottom constraint can bite. */
  body { padding-bottom: 84px; }
  .ship-btn {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    z-index: 8;
    box-shadow: 0 10px 24px rgba(3, 8, 12, 0.6);
  }
  .footnote { padding: 0 14px; }
}

@media (max-width: 460px) {
  .stat-label { font-size: 9.5px; }
  .brand-name { font-size: 15px; }
  .ob-card { padding: 20px 16px 16px; }
  .ob-step h2 { font-size: 19px; }
}
