@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Noto+Serif+KR:wght@400;600;700&display=swap");

:root {
  color-scheme: dark;
  --ink: #efe6d4;
  --muted: #b7a78a;
  --gold: #d4b36a;
  --gold-deep: #9a7428;
  --sea: #071016;
  --panel: #14100c;
  --panel-2: #1c1712;
  --line: #3a3226;
  --danger: #c9785c;
  --ok: #8faf6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--sea);
  color: var(--ink);
  font: 15px/1.5 "Noto Serif KR", "Iowan Old Style", serif;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--gold-deep);
  background: linear-gradient(#e3c57a, #b8903a);
  color: #1a1208;
  padding: 8px 14px;
  letter-spacing: 0.02em;
}
button:hover { filter: brightness(1.08); }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
button.ghost {
  background: transparent;
  color: var(--gold);
  border-color: var(--line);
}
button.tiny { padding: 4px 10px; font-size: 13px; }
button.buy { background: linear-gradient(#d8c07a, #9a7a32); }
button.sell { background: linear-gradient(#7a9a6a, #4a6a3a); color: #f4f0e4; border-color: #3d5a30; }

input {
  font: inherit;
  color: var(--ink);
  background: #0d0b09;
  border: 1px solid var(--line);
  padding: 8px 10px;
  width: 100%;
}
input.qty { width: 64px; padding: 4px 6px; }

h1, h2, h3 { font-family: Cinzel, "Noto Serif KR", serif; font-weight: 700; margin: 0; }
p { margin: 0; }

.err { color: var(--danger); min-height: 1.2em; font-size: 13px; }

/* ---------- title ---------- */
#guest {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    linear-gradient(180deg, rgba(7, 16, 22, 0.35) 0%, rgba(7, 16, 22, 0.82) 100%),
    url("/art/title_harbor.png") center/cover no-repeat;
}
#guest.hidden { display: none; }
.title-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 28px;
  background: rgba(12, 10, 8, 0.78);
  border: 1px solid var(--line);
}
.title-copy .eyebrow {
  color: var(--gold);
  letter-spacing: 0.22em;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.title-copy h1 { font-size: 42px; line-height: 1.15; color: var(--gold); }
.title-copy .lede { color: var(--muted); margin: 12px 0 0; max-width: 36em; }
.auth-grid {
  display: grid;
  gap: 16px;
}
.auth-grid form {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.auth-grid strong { color: var(--gold); font-size: 13px; letter-spacing: 0.08em; }

/* ---------- hub ---------- */
#captain { display: none; }
#captain.show { display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(8, 10, 12, 0.92);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: Cinzel, serif;
  color: var(--gold);
  letter-spacing: 0.14em;
  font-size: 14px;
}
.top-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.top-stats b { color: var(--gold); font-weight: 700; }

.hero {
  position: relative;
  height: min(42vh, 420px);
  min-height: 240px;
  overflow: hidden;
}
.hero img.scene {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 12, 16, 0.78) 0%, rgba(7, 12, 16, 0.15) 55%, rgba(7, 12, 16, 0.55) 100%),
    linear-gradient(180deg, transparent 40%, rgba(7, 16, 22, 0.88) 100%);
}
.hero-copy {
  position: absolute;
  left: 28px;
  bottom: 24px;
  right: 220px;
}
.hero-copy .nation { color: var(--gold); letter-spacing: 0.16em; font-size: 12px; }
.hero-copy h2 { font-size: 36px; margin: 4px 0 6px; }
.hero-copy .sub { color: var(--muted); }
.voyage-meter {
  margin-top: 12px;
  max-width: 420px;
  height: 8px;
  background: #2a241c;
  display: none;
}
.voyage-meter.on { display: block; }
.voyage-meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}
.ship-portrait {
  position: absolute;
  right: 20px;
  bottom: 16px;
  width: 180px;
  height: 110px;
  object-fit: cover;
  border: 1px solid var(--gold-deep);
  background: #111;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.tabs {
  display: flex;
  gap: 0;
  margin: -1px 0 0;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
}
.tabs button.on {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.panel { display: none; padding: 18px 0 8px; }
.panel.on { display: block; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head p { color: var(--muted); font-size: 13px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 500; font-size: 12px; }

.good {
  display: flex;
  align-items: center;
  gap: 10px;
}
.good img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.dest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.dest-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  overflow: hidden;
}
.dest-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.dest-card .body { padding: 12px; display: grid; gap: 8px; }
.dest-card strong { font-size: 18px; }
.dest-card span { color: var(--muted); font-size: 13px; }

.ship-box {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: start;
}
.ship-box img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.meters { display: grid; gap: 10px; }
.meter-row span { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.meter {
  height: 8px;
  background: #2a241c;
  margin-top: 4px;
}
.meter i { display: block; height: 100%; background: var(--gold); }

.recruit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.log-wrap {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.log-wrap h3 {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
pre#log {
  margin: 0;
  min-height: 88px;
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  background: #0b0d10;
  border: 1px solid var(--line);
  color: #cfc3a8;
  font: 12px/1.45 ui-monospace, monospace;
  white-space: pre-wrap;
}

.dev {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}
.dev .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.stat {
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--panel);
}
.stat b { display: block; color: var(--gold); }
.stat span { font-size: 11px; }

.empty { color: var(--muted); padding: 20px 0; }

@media (max-width: 800px) {
  .title-card, .ship-box { grid-template-columns: 1fr; }
  .title-copy h1 { font-size: 32px; }
  .hero-copy { right: 16px; left: 16px; }
  .hero-copy h2 { font-size: 28px; }
  .ship-portrait { width: 120px; height: 74px; }
}
