:root {
  color-scheme: dark;
  font-family: Roboto, "Noto Sans KR", sans-serif;
  color: #e7e8dd;
  background: #0b2027;
  font-synthesis: none;
  --surface: #142f36;
  --raised: #1e3a40;
  --line: #9bb6ab29;
  --muted: #abbcb6;
  --gold: #e7bf78;
  --green: #93dac4;
  --red: #ffafa1;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, input, progress { accent-color: var(--gold); }
button { cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; font-weight: 700; letter-spacing: -.6px; }
h2 { font-size: 23px; font-weight: 600; letter-spacing: -.6px; }
h3 { font-size: 18px; font-weight: 600; }
[hidden] { display: none !important; }
.muted, .footnote { color: var(--muted); }
.small { font-size: 13px; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.eyebrow, .map-eyebrow { color: var(--gold); font-size: 12px; letter-spacing: 1px; font-weight: 600; }
.button { position: relative; overflow: hidden; border: 0; min-height: 48px; border-radius: 24px; padding: 11px 18px; font-size: 14px; font-weight: 600; color: inherit; background: transparent; }
.button:hover { background-color: #ffffff09; }
.button:active { filter: brightness(1.15); }
.primary { background: var(--gold); color: #302818; }
.primary:hover { background: #f5cd87; }
.secondary { border: 1px solid #8ba99c66; color: #d9dfcd; background: #a9bda007; }
.text-button { color: var(--gold); }
.danger { color: #3c1b17; background: var(--red); }
.danger:hover { background: #ffc6bb; }
.full-width { width: 100%; }
.ripple { position: absolute; pointer-events: none; width: 12px; height: 12px; border-radius: 50%; background: currentColor; opacity: .2; transform: translate(-50%, -50%) scale(0); animation: ripple .55s ease-out; }
@keyframes ripple { to { transform: translate(-50%, -50%) scale(36); opacity: 0; } }
#app { width: 100%; max-width: 1600px; margin: auto; min-height: 100dvh; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.appbar { min-height: 80px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px 20px; background: #102a31; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 26px; height: 32px; position: relative; border-bottom: 2px solid var(--gold); transform: skew(-10deg); }
.brand-mark::before { content: ''; position: absolute; width: 21px; height: 24px; background: var(--gold); clip-path: polygon(40% 0, 100% 90%, 0 90%); }
.app-date { font-size: 12px; color: var(--muted); display: block; margin-top: 3px; }
.account { margin-left: auto; text-align: right; white-space: nowrap; }
.title-label { color: var(--muted); font-size: 12px; display: block; }
.gold { display: block; font-size: 17px; color: #f6d391; font-variant-numeric: tabular-nums; }
.icon-button { min-width: 48px; min-height: 48px; padding: 0; }
.menu-dots, .menu-dots::before, .menu-dots::after { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); position: absolute; left: 22px; top: 22px; }
.menu-dots::before, .menu-dots::after { content: ''; left: 0; }
.menu-dots::before { top: -7px; }.menu-dots::after { top: 7px; }
.status-strip { display: grid; grid-template-columns: repeat(6, 1fr); padding: 14px 20px; gap: 12px 8px; background: #142e34; border-bottom: 1px solid var(--line); }
.metric { min-width: 0; grid-column: span 2; }
.metric:nth-child(n+4) { grid-column: span 3; }
.metric-label { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.metric strong { display: block; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 4px; }
.map-section { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.map-section canvas { display: block; width: 100%; height: clamp(250px, 36vh, 380px); touch-action: none; cursor: grab; }
.map-section canvas:active { cursor: grabbing; }
.map-caption { position: absolute; left: 18px; top: 14px; pointer-events: none; display: grid; gap: 3px; }
.map-eyebrow { color: #cdd4bd; font-size: 11px; }
.map-hint { font-size: 10px; color: #a0b3ac; }
.map-controls { position: absolute; right: 10px; bottom: 10px; display: flex; border-radius: 25px; background: #0c222cef; border: 1px solid var(--line); }
.map-control { min-width: 48px; padding: 10px 12px; color: #dbe0d1; }
.dock-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; gap: 18px; border-bottom: 1px solid var(--line); background: #122b32; }
.location-title { min-width: 0; }
.location-title h2 { font-size: 25px; margin-top: 2px; }
.goal-summary { display: grid; gap: 5px; width: 46%; max-width: 260px; text-align: right; }
.goal-summary strong { font-size: 11px; font-weight: 500; white-space: nowrap; color: #dedcc5; }
progress { display: block; height: 5px; width: 100%; border: 0; border-radius: 5px; overflow: hidden; background: #ffffff14; }
progress::-webkit-progress-bar { background: #ffffff14; border-radius: 5px; }
progress::-webkit-progress-value { background: var(--gold); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 5px; }
.content { background: #0e252c; min-height: 250px; }
.panel { padding: 24px 20px; max-width: 760px; margin: auto; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { font-size: 20px; }
.section-heading p { font-size: 13px; margin-top: 6px; }
.market-legend, .market-row { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(66px, .8fr) minmax(74px, .85fr); gap: 8px; align-items: center; }
.market-legend { padding: 0 0 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.market-legend span:not(:first-child) { text-align: right; }
.market-row { border-radius: 0; padding: 17px 0; width: 100%; border-bottom: 1px solid var(--line); font-weight: 400; min-height: 84px; text-align: left; }
.good-info { display: grid; gap: 6px; }
.good-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.good-name strong { font-size: 15px; font-weight: 500; }
.good-info .small { font-size: 12px; }
.good-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 6px; min-height: 22px; border-radius: 5px; white-space: nowrap; }
.cheap { color: #aedec7; background: #527f602e; }
.wanted { color: #edc887; background: #b18b3e24; }
.quote-price { text-align: right; display: grid; gap: 5px; font-size: 16px; font-variant-numeric: tabular-nums; }
.quote-price .small { font-size: 12px; overflow-wrap: anywhere; }
.unavailable { color: #81958f; font-size: 11px; }
.footnote { font-size: 12px; line-height: 1.7; padding-top: 18px; }
.card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 16px; }
.card p { margin-top: 8px; font-size: 14px; }
.card .button.full-width { margin-top: 18px; }
.card .supply-value { font-size: 27px; color: #eddfbd; }
.inline-form { display: flex; align-items: end; gap: 12px; margin-top: 20px; }
.quantity { display: grid; gap: 8px; min-width: 0; width: 100%; font-size: 13px; }
input[type=number] { width: 100%; min-width: 0; min-height: 52px; border: 1px solid #9fb8a966; border-radius: 8px; background: #0b222a; padding: 12px 15px; color: #f1e5cb; font-variant-numeric: tabular-nums; }
.inline-form .button { min-width: 86px; min-height: 52px; }
.trade-actions { display: flex; gap: 12px; margin-top: 20px; }
.trade-actions > button { flex: 1; padding-left: 12px; padding-right: 12px; }
.rumor-card { border-left: 3px solid var(--gold); }
.rumor-card p { color: #e9dfc4; font-size: 16px; line-height: 1.8; }
.log-list { margin-top: 30px; }
.log-entry { padding: 15px 0; border-bottom: 1px solid var(--line); }
.log-entry p { margin-top: 5px; font-size: 14px; }
.log-entry.bad p { color: var(--red); }.log-entry.good p { color: var(--green); }
.card-title { display: flex; align-items: center; gap: 12px; }
.card-title .chip { margin-left: auto; }
.ship-card.owned { border-color: #92c5a873; }
.ship-mark { position: relative; width: 30px; height: 35px; border-bottom: 6px solid var(--gold); border-radius: 0 0 12px 12px; }
.ship-mark::before { content: ''; position: absolute; width: 26px; height: 24px; background: #d6dac1; clip-path: polygon(30% 0, 30% 100%, 100% 100%); }
.route-row { display: block; text-align: left; width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 17px 18px; margin-bottom: 10px; background: var(--surface); }
.route-row.selected { border-color: var(--gold); background: #d9b46a12; }
.route-top { display: flex; justify-content: space-between; gap: 12px; }
.route-top strong { font-size: 17px; font-weight: 500; }
.route-detail { display: block; color: #dbdcca; font-size: 14px; margin-top: 7px; font-weight: 400; }
.route-resources { display: flex; gap: 16px; margin-top: 5px; font-weight: 400; }
.departure-action { position: sticky; bottom: 0; display: grid; gap: 10px; padding: 16px; border: 1px solid #b7a16c66; border-radius: 18px; background: #1d353a; box-shadow: 0 -5px 25px #0005; margin-top: 20px; }
.bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; justify-content: center; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #183239; border-top: 1px solid var(--line); box-shadow: 0 -4px 20px #0002; }
.nav-item { width: 20%; max-width: 160px; min-height: 64px; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 5px; border-radius: 16px; font-size: 12px; color: #a7bab0; font-weight: 400; }
.nav-item.active { color: #f2d8a4; font-weight: 600; }
.nav-symbol { position: relative; display: block; width: 56px; height: 29px; border-radius: 16px; }
.active .nav-symbol { background: #c0a16624; }
.nav-symbol::before, .nav-symbol::after { content: ''; position: absolute; }
.symbol-market::before { left: 19px; top: 11px; width: 18px; height: 13px; border: 1.5px solid currentColor; border-top: 0; }
.symbol-market::after { left: 17px; top: 5px; width: 22px; height: 8px; border: 1.5px solid currentColor; border-radius: 4px 4px 3px 3px; }
.symbol-supply::before { left: 22px; top: 8px; width: 13px; height: 17px; border: 1.5px solid currentColor; border-radius: 4px; }
.symbol-supply::after { left: 25px; top: 4px; width: 7px; height: 4px; border: 1.5px solid currentColor; }
.symbol-tavern::before { left: 19px; top: 6px; width: 15px; height: 19px; border: 1.5px solid currentColor; border-radius: 2px 2px 5px 5px; }
.symbol-tavern::after { left: 34px; top: 10px; width: 5px; height: 9px; border: 1.5px solid currentColor; border-left: 0; border-radius: 0 4px 4px 0; }
.symbol-shipyard::before { left: 17px; top: 19px; width: 23px; height: 7px; border: 1.5px solid currentColor; border-radius: 0 0 9px 9px; }
.symbol-shipyard::after { left: 26px; top: 3px; width: 13px; height: 14px; border-left: 1.5px solid currentColor; background: currentColor; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.symbol-departure::before { left: 21px; top: 5px; width: 16px; height: 21px; border: 1.5px solid currentColor; border-radius: 50%; transform: rotate(35deg); }
.symbol-departure::after { left: 27px; top: 8px; width: 4px; height: 15px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%); transform: rotate(35deg); }
.voyage-card h2 { margin: 8px 0 25px; }
.voyage-details { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 14px; gap: 10px; }
.voyage-card progress { height: 8px; margin-bottom: 12px; }
.voyage-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 26px; }
.speed-group { display: flex; border: 1px solid #8ba99c66; border-radius: 26px; overflow: hidden; }
.speed-button { border-radius: 0; min-width: 48px; padding: 10px 13px; }
.speed-button.selected { background: #b59c6b40; color: #ffe0a2; }
.overlay { width: min(440px, calc(100% - 40px)); max-height: calc(100dvh - 48px); background: #203b40; color: #e7e8dd; border: 1px solid #8faaa644; padding: 24px; border-radius: 28px; box-shadow: 0 20px 80px #0008; overscroll-behavior: contain; }
.overlay::backdrop { background: #020f16b8; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.overlay-head h2 { font-size: 22px; }
.overlay-head .button { flex-shrink: 0; padding: 8px 12px; }
.dialog-body { display: grid; gap: 18px; }
.dialog-body p { line-height: 1.8; font-size: 15px; }
.dialog-body p.small { font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dialog-actions.stacked { flex-direction: column; }
.overlay.sheet { width: min(540px, 100%); margin: auto auto 0; border-radius: 28px 28px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.overlay.sheet::before { content: ''; width: 32px; height: 4px; background: #a0b3ac; border-radius: 4px; display: block; margin: -12px auto 15px; }
.trade-summary { margin-bottom: 22px; font-size: 14px; }
.trade-summary p + p { margin-top: 7px; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stepper .button { padding: 8px; }
.max-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.max-actions .button { font-size: 12px; padding: 10px 8px; }
.trade-estimate { margin: 12px 0; font-size: 14px; }
.snackbar-region { position: fixed; inset: auto 16px calc(94px + env(safe-area-inset-bottom)); margin: 0; padding: 0; border: 0; width: auto; overflow: visible; background: transparent; display: flex; justify-content: center; z-index: 20; pointer-events: none; }
.snackbar { max-width: 560px; width: 100%; padding: 14px 20px; background: #d5e0d4; color: #173035; font-size: 14px; border-radius: 8px; box-shadow: 0 4px 15px #0005; animation: snack-in .2s ease-out; }
.snackbar.bad { background: #f3c1b8; color: #57241d; }
@keyframes snack-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.goal-emblem { width: 56px; height: 56px; background: var(--gold); clip-path: polygon(50% 0, 61% 32%, 95% 30%, 73% 55%, 80% 90%, 50% 72%, 20% 90%, 27% 55%, 5% 30%, 39% 32%); margin: 5px auto; }
.celebration { text-align: center; }
@media (min-width: 900px) {
  #app { padding-bottom: 0; height: 100dvh; min-height: 700px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .appbar { padding-left: 32px; padding-right: 24px; }
  .status-strip { padding: 14px 32px; grid-template-columns: repeat(5, 1fr); }
  .metric, .metric:nth-child(n+4) { grid-column: auto; }
  .metric-label { font-size: 12px; }.metric strong { font-size: 16px; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(400px, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
  .map-section { grid-row: 1 / 3; border-right: 1px solid var(--line); border-bottom: 0; }
  .map-section canvas { height: 100%; min-height: 0; }
  .map-caption { top: 25px; left: 28px; }
  .map-eyebrow { font-size: 13px; }.map-hint { font-size: 11px; }
  .map-controls { right: 20px; bottom: 20px; }
  .content { overflow-y: auto; overscroll-behavior: contain; }
  .dock-header { padding: 23px 28px; }
  .panel { padding: 28px; }
  .bottom-nav { position: static; justify-content: flex-end; padding-right: 3%; box-shadow: none; }
  .nav-item { max-width: 140px; }
  .overlay.sheet { margin-bottom: 24px; border-radius: 28px; }
  .snackbar-region { left: 28px; right: auto; width: min(480px, 40%); bottom: 28px; }
}
@media (max-width: 899px) and (min-height: 560px) {
  /* 폰 세로: 상단·지도·하단 탭은 고정하고 내용만 스크롤하는 앱 화면. 탭을 바꾸면 내용이 맨 위에서 시작한다. */
  html, body { height: 100%; overscroll-behavior: none; }
  #app { height: 100dvh; min-height: 0; padding-bottom: 0; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .appbar { min-height: 60px; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .status-strip { display: flex; gap: 20px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
  .status-strip::-webkit-scrollbar { display: none; }
  .metric, .metric:nth-child(n+4) { flex: none; }
  .metric strong { margin-top: 1px; }
  .workspace { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }
  .map-section canvas { height: clamp(120px, 18dvh, 200px); }
  .workspace[data-map=compact] .map-controls, .workspace[data-map=compact] .map-hint { display: none; }
  .workspace[data-map=large] .map-section canvas { height: clamp(220px, 42dvh, 420px); }
  .map-caption { top: 10px; left: 14px; }
  .map-hint { font-size: 11px; }
  .dock-header { padding: 12px 16px; }
  .location-title h2 { font-size: 21px; }
  .content { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .panel { padding: 20px 16px 24px; }
  .bottom-nav { position: static; padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .nav-item { min-height: 56px; }
  .snackbar-region { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 359px) {
  .appbar { gap: 5px; padding-left: 12px; }.brand-mark { display: none; }
  h1 { font-size: 17px; }.gold { font-size: 15px; }
  .panel { padding: 20px 14px; }.status-strip { padding-left: 10px; padding-right: 10px; }
  .metric-label { font-size: 12px; }.metric strong { font-size: 14px; }
  .goal-summary { width: 49%; }.goal-summary strong { font-size: 10px; }
  .dock-header { padding: 16px 14px; }.location-title h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .ripple { display: none; }.snackbar { animation: none; }
}
