:root {
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-soft: #eaf1f1;
  --text-primary: #14232b;
  --text-secondary: #60717a;
  --text-tertiary: #94a1a8;
  --border: rgba(20, 35, 43, .09);
  --border-strong: rgba(20, 35, 43, .18);
  --cold: #4e8fd8;
  --cool: #45a7a1;
  --neutral: #f2b84b;
  --warm: #ff8a3d;
  --hot: #ff5b4d;
  --up: #f04438;
  --down: #3182f6;
  --focus: #087aa5;
  --selected: #e6f3f7;
  --ocean: #dce8f2;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --nav-height: 68px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--bg);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; font-variant-numeric: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .38);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: white;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(243, 246, 246, .94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.04em;
  text-decoration: none;
}
.brand-name { flex: 0 0 auto; white-space: nowrap; }
.brand-tag {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }

.icon-button,
.map-controls button {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.demo-badge,
.level-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.view { width: 100%; }
.home-view { max-width: 760px; margin: 0 auto; padding: 18px 20px 56px; }

.home-layer { width: 100%; }
.today-layer { margin-top: 14px; }

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0 0;
}

.eyebrow,
.card-kicker,
.section-label {
  margin: 0 0 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.hero-copy h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.045em;
  word-break: keep-all;
}

.hero-description {
  max-width: 600px;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.season-status {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid #f2cf8f;
  border-radius: var(--radius-md);
  background: #fff8e8;
  color: #724b00;
  box-shadow: none;
  font-size: 13px;
}
.season-status span { line-height: 1.45; }
.season-status strong {
  flex: 0 0 auto;
  padding-left: 14px;
  border-left: 1px solid rgba(114, 75, 0, .2);
  font-size: 15px;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}
.primary-button {
  padding: 0 18px;
  border: 1px solid var(--text-primary);
  background: var(--text-primary);
  color: white;
}
.secondary-button {
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.text-button {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--focus);
}
.text-button:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.link-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.meta-text,
.section-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.condition-card,
.state-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.condition-card {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(20, 35, 43, .045);
}
.condition-card-head { display: flex; min-height: 32px; align-items: flex-start; justify-content: space-between; gap: 16px; }
.condition-card h2 {
  margin: 4px 0 0;
  font-size: clamp(28px, 6vw, 34px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.04em;
}
.condition-tide { min-height: 22px; margin: 8px 0 2px; font-size: 14px; font-weight: 600; line-height: 1.55; }
.condition-detail-button { width: fit-content; margin-top: 8px; padding: 0; }

.content-section { margin-top: 20px; padding: 24px 0; border-top: 1px solid var(--border); }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-heading h2,
.section-heading h3 { margin: 0; font-size: clamp(21px, 5vw, 26px); font-weight: 600; letter-spacing: -.035em; }
.section-heading.compact { align-items: center; margin-bottom: 16px; }
.section-heading.compact h3 { font-size: 20px; }
.section-heading.compact span { color: var(--text-secondary); font-size: 12px; }

.week-strip {
  display: grid;
  grid-auto-columns: minmax(104px, 1fr);
  grid-auto-flow: column;
  gap: 0;
  overflow-x: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.week-strip::-webkit-scrollbar { display: none; }
.week-day {
  min-height: 112px;
  padding: 14px 12px;
  scroll-snap-align: start;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
}
.week-day:first-child { border-left: 0; background: var(--selected); }
.week-day strong { display: block; margin-bottom: 10px; font-size: 13px; }
.week-day .mul { display: block; margin-top: 10px; color: var(--text-secondary); font-size: 12px; }
.week-day .no-forecast { color: var(--text-secondary); font-size: 12px; }
.closed-day {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #f2cf8f;
  border-radius: 999px;
  background: #fff8e8;
  color: #724b00;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.forecast-fact {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.forecast-caption { margin: 10px 0 0; color: var(--text-secondary); font-size: 12px; }

.index-chip,
.index-sample {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.index-1 { color: var(--down); background: #eff6ff; }
.index-2 { color: #526f9f; background: #f1f5fb; }
.index-3 { color: #8a5b00; background: #fff7dc; }
.index-4 { color: #b54708; background: #fff3eb; }
.index-5 { color: #b42318; background: #fff0ef; }
.index-0 { color: var(--text-secondary); background: var(--surface-soft); }

.inline-empty {
  display: flex;
  min-height: 100px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.inline-empty span { color: var(--text-secondary); font-size: 14px; }

.reason-chips,
.index-list { display: flex; flex-wrap: wrap; gap: 8px; }
.reason-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 13px;
}
.disclaimer { color: var(--text-secondary); font-size: 12px; line-height: 1.65; }

.home-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}
.home-footer p { margin: 0; }
.home-footer a { display: inline-flex; min-height: 44px; align-items: center; }

.loading-state { display: grid; gap: 16px; padding: 28px 0; }
.skeleton { border-radius: var(--radius-md); background: #e9edf1; animation: skeleton-pulse 1.5s ease-in-out infinite; }
.skeleton-kicker { width: 120px; height: 16px; }
.skeleton-title { width: min(620px, 90%); height: 110px; }
.skeleton-card { height: 190px; }
.skeleton-card.short { height: 140px; }
@keyframes skeleton-pulse { 50% { opacity: .48; } }
.state-card { max-width: 620px; margin: 48px auto; padding: 28px; text-align: left; }
.state-card h1 { margin: 0 0 12px; font-size: 32px; }
.state-card .primary-button { margin-top: 18px; }
.muted { color: var(--text-secondary); }

.ports-view {
  max-width: 760px;
  min-height: calc(100dvh - 60px - var(--nav-height) - env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 22px 20px 40px;
}
.ports-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ports-header h1 {
  margin: 0 0 7px;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 650;
  letter-spacing: -.045em;
}
.compact-button { min-width: 78px; padding: 0 12px; }
.explore-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
}
.explore-mode-switch button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}
.explore-mode-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--focus);
  box-shadow: 0 2px 8px rgba(20, 35, 43, .08);
}
.port-list-panel { margin-top: 18px; }
.port-list-panel > .section-note { margin-bottom: 8px; }
.port-list { margin: 0; padding: 0; list-style: none; }
.port-list li { border-top: 1px solid var(--border); }
.port-list li:first-child { border-top: 0; }
.port-list-row {
  display: grid;
  width: 100%;
  min-height: 92px;
  gap: 9px;
  padding: 14px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.port-list-row.is-reference { background: var(--selected); }
.port-row-head,
.port-row-summary { display: flex; min-width: 0; align-items: center; gap: 8px; }
.port-row-head strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.port-row-area { color: var(--text-secondary); font-size: 12px; }
.reference-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-left: auto;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--focus);
  font-size: 11px;
  font-weight: 650;
}
.port-row-summary { justify-content: space-between; align-items: flex-end; }
.port-row-summary strong { font-size: 14px; font-weight: 650; }
.port-row-summary small { color: var(--text-secondary); font-size: 12px; text-align: right; }
.port-row-summary.is-closed strong { color: #8a5b00; }
.port-row-summary.is-index strong { color: #b54708; }
.port-row-summary.is-forecast strong,
.port-row-summary.is-tide strong { color: var(--focus); }
.map-panel {
  display: grid;
  grid-template-rows: minmax(390px, 1fr) auto;
  height: calc(100dvh - 60px - var(--nav-height) - 190px - env(safe-area-inset-bottom));
  min-height: 460px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.map-frame {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--ocean);
}
#map { position: absolute; inset: 0; }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-bottom-right { bottom: 44px; }
.map-loading {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--ocean);
  color: var(--text-secondary);
  font-size: 13px;
}

.map-controls {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 8px;
}
.map-controls button { border: 0; border-radius: 14px; box-shadow: 0 8px 22px rgba(20, 35, 43, .12); font-weight: 600; }
.map-controls button:last-child { padding: 0 9px; font-size: 12px; }

.map-legend {
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 11px;
}
.map-legend > div { display: flex; align-items: center; gap: 6px; }
.index-sample { min-height: 22px; padding: 0 7px; color: #b54708; background: #fff3eb; font-size: 10px; }

.map-meta {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.map-meta-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.map-attribution {
  margin: 0;
  color: #344054;
  font-size: 10px;
  text-align: right;
  pointer-events: none;
}
.map-empty {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(280px, calc(100% - 40px));
  margin: 0;
  padding: 14px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .94);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.port-marker {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(20, 35, 43, .2);
}
.marker-index {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(20, 35, 43, .1);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.marker-index strong { font-size: 13px; }
.marker-cluster {
  min-height: 48px;
  padding: 0 15px;
  border-color: transparent;
  background: #0b7895;
  color: white;
  box-shadow: 0 10px 24px rgba(11, 120, 149, .28);
}
.marker-cluster strong { color: white; font-size: 14px; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px max(12px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, .97);
}
.nav-tab {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.nav-tab.is-active { background: var(--selected); color: var(--focus); }
.nav-tab:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.nav-symbol { font-size: 18px; }

.sheet-backdrop,
.about-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(17, 24, 39, .34);
}
.about-backdrop { display: grid; place-items: center; padding: 20px; }

.port-sheet {
  position: fixed;
  z-index: 41;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(84dvh, 820px);
  overflow-y: auto;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  background: var(--surface);
}
.sheet-grab { width: 44px; height: 4px; margin: 2px auto 14px; border-radius: 999px; background: #d0d5dd; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sheet-header h2 { margin: 0 0 5px; font-size: 24px; font-weight: 600; letter-spacing: -.04em; }
.sheet-reference-button { width: 100%; margin-top: 16px; }
.sheet-section { padding: 22px 0; border-top: 1px solid var(--border); }
.sheet-section:first-of-type { margin-top: 16px; }
.temperature-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.temperature-hero strong { color: var(--temperature-color, var(--text-primary)); font-size: clamp(48px, 14vw, 64px); font-weight: 600; letter-spacing: -.06em; }
.change-label { font-size: 18px; font-weight: 600; }
.change-label.up { color: var(--up); }
.change-label.down { color: var(--down); }
.temperature-label { color: var(--text-secondary); font-size: 14px; }
.reason-chips { margin-top: 12px; }
.history-chart { min-height: 108px; margin-top: 20px; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg); }
.history-chart svg { display: block; width: 100%; height: 108px; }
.history-empty { display: grid; min-height: 108px; place-items: center; color: var(--text-secondary); font-size: 12px; }

.condition-list { display: grid; gap: 0; margin: 0; }
.condition-list > div {
  display: grid;
  min-height: 48px;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  border-top: 1px solid var(--border);
}
.condition-list > div:first-child { border-top: 0; }
.condition-list dt { color: var(--text-secondary); font-size: 13px; }
.condition-list dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right; }
.index-list { margin-top: 14px; }
.forecast-warning {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #fff7dc;
  color: #7a4b00;
  font-size: 12px;
  line-height: 1.5;
}
.closed-detail h3 { margin: 0 0 12px; font-size: 20px; }
.closed-row { padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.55; }
.closed-row:first-child { border-top: 0; }
.closed-row strong { display: block; margin-bottom: 3px; }
.sheet-footer { padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; line-height: 1.6; }

.about-panel {
  width: min(560px, 100%);
  max-height: min(84dvh, 760px);
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.about-panel > p,
.about-panel li { color: var(--text-secondary); font-size: 14px; line-height: 1.75; }
.about-panel ul { padding-left: 20px; }
.about-panel .link-button { margin-top: 10px; }

@media (min-width: 768px) {
  .app-shell { padding-bottom: 0; }
  .topbar { padding-right: 32px; padding-left: 32px; }
  .home-view { padding: 42px 32px 72px; }
  .condition-card { padding: 24px; }
  .content-section { padding: 30px 0; }
  .week-strip { grid-auto-columns: minmax(112px, 1fr); }
  .ports-view { min-height: calc(100dvh - 60px); padding: 38px 32px 64px; }
  .map-panel { height: calc(100dvh - 60px - 210px); min-height: 520px; }
  .map-controls { top: 20px; right: 20px; }
  .port-sheet {
    top: 76px;
    right: 18px;
    bottom: 18px;
    left: auto;
    width: min(460px, calc(100vw - 36px));
    max-height: none;
    border-radius: var(--radius-lg);
    padding: 16px 24px 28px;
  }
  .sheet-grab { display: none; }
  .bottom-nav {
    top: 6px;
    right: auto;
    bottom: auto;
    left: 50%;
    width: 220px;
    height: 48px;
    padding: 2px;
    transform: translateX(-50%);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
  }
  .nav-tab { min-height: 44px; border-radius: 999px; }
  .nav-symbol { display: none; }
}

@media (min-width: 1200px) {
  .ports-view { max-width: 980px; }
}

@media (max-width: 430px) {
  .topbar { padding: 0 16px; }
  .home-view { padding-right: 16px; padding-left: 16px; }
  .ports-view { padding-right: 16px; padding-left: 16px; }
  .condition-card { padding: 18px; }
  .content-section { padding: 24px 0; }
  .section-heading { align-items: flex-start; }
  .section-note { max-width: 116px; text-align: right; }
  .topbar-meta { gap: 6px; }
  .map-panel { min-height: 430px; }
}

@media (max-width: 370px) {
  .brand-tag { display: none; }
  .condition-card { padding: 16px; }
  .content-section { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
