:root {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #202426;
  background: #f5f7f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(31, 89, 81, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 89, 81, 0.08) 1px, transparent 1px),
    #f5f7f4;
  background-size: 38px 38px;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 12px;
  background: #12201e;
  color: #f8fbf7;
}

.mark,
.rail-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.mark {
  margin-bottom: 14px;
  background: #e7c45b;
  color: #12201e;
  font-weight: 900;
}

.rail-button {
  background: transparent;
  color: #dfe9e4;
  font-weight: 800;
}

.rail-button.active,
.rail-button:hover {
  background: #f8fbf7;
  color: #12201e;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.section-header,
.card-top,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.kicker {
  margin: 0 0 6px;
  color: #4d625b;
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  max-width: 680px;
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 7vw, 5.8rem);
  line-height: 0.92;
}

h3 {
  margin: 0;
  font-size: 1.35rem;
}

h4 {
  margin-bottom: 0;
  font-size: 1rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(340px, 44vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  background: #fff;
  color: #587069;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #202426;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: stretch;
  padding: 46px 0 34px;
}

.hero-copy {
  display: flex;
  min-height: 390px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px 0;
}

.hero-copy p:last-child {
  max-width: 560px;
  margin-bottom: 0;
  color: #3f4d49;
  font-size: 1.08rem;
  line-height: 1.7;
}

.lab-panel {
  align-self: end;
  min-height: 360px;
  padding: 22px;
  border: 1px solid #203632;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 12px 12px 0 #dce6df;
}

.panel-header {
  color: #52615d;
  font-size: 0.9rem;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 26px 0;
}

.signal-grid div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid #d4ddd8;
  border-radius: 8px;
  background: #f8faf7;
}

.signal-grid strong,
.signal-grid span {
  display: block;
}

.signal-grid strong {
  font-size: 2rem;
  line-height: 1;
}

.signal-grid span {
  margin-top: 8px;
  color: #586661;
  font-size: 0.85rem;
}

.note-field span {
  display: block;
  margin-bottom: 8px;
  color: #52615d;
  font-size: 0.86rem;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 14px;
  outline: 0;
  color: #202426;
  background: #fff;
}

textarea:focus,
.search:focus-within {
  border-color: #1f5951;
  box-shadow: 0 0 0 3px rgba(31, 89, 81, 0.12);
}

.grid-section {
  padding: 18px 0;
}

.environment {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 28px;
  margin: 0 0 18px;
  padding: 28px;
  border: 1px solid #203632;
  border-radius: 8px;
  background: #fff;
  box-shadow: 8px 8px 0 #e7c45b;
}

.environment h3 {
  max-width: 360px;
  line-height: 1.18;
}

.environment-copy p {
  margin-bottom: 14px;
  color: #3f4d49;
  line-height: 1.75;
}

.environment-copy p:last-child {
  margin-bottom: 0;
}

.inline-link {
  display: inline-flex;
  margin-top: 8px;
  color: #1f5951;
  font-weight: 800;
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #1f5951;
  font-weight: 700;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.card {
  min-height: 190px;
  padding: 18px;
  border: 1px solid #d1dcd6;
  border-radius: 8px;
  background: #fff;
}

.card-top span {
  flex: 0 0 auto;
  border: 1px solid #c4d2cb;
  border-radius: 999px;
  padding: 4px 9px;
  color: #304d47;
  font-size: 0.76rem;
}

.card-date,
.updated {
  display: block;
  color: #6a7773;
  font-size: 0.82rem;
  font-weight: 700;
}

.card-date {
  margin-top: 12px;
}

.card p {
  margin: 20px 0;
  color: #47534f;
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span {
  border-radius: 6px;
  background: #e9efe9;
  padding: 5px 8px;
  color: #3d504b;
  font-size: 0.76rem;
}

.empty {
  grid-column: 1 / -1;
  min-height: 120px;
  padding: 20px;
  border: 1px dashed #9db0a8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: #52615d;
}

.tool-band {
  padding: 20px 0 40px;
}

.tool-heading {
  margin-bottom: 12px;
}

.tool-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tool {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  border: 1px solid #203632;
  border-radius: 8px;
  padding: 14px;
  background: #203632;
  color: #f7fbf8;
  text-align: left;
}

.tool strong,
.tool small {
  display: block;
}

.tool small {
  margin-top: 4px;
  color: #c7d5d0;
}

.card-link {
  display: inline-flex;
  margin-top: 4px;
  color: #1f5951;
  font-weight: 800;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

.guide-page .content {
  max-width: 1040px;
}

.guide-hero {
  padding: 54px 0 28px;
}

.guide-hero h1 {
  max-width: 860px;
}

.guide-hero p {
  max-width: 720px;
  margin: 18px 0 0;
  color: #3f4d49;
  font-size: 1.08rem;
  line-height: 1.75;
}

.guide-hero .updated {
  margin-top: 14px;
  color: #1f5951;
  font-size: 0.92rem;
}

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
}

.guide-nav a {
  border: 1px solid #c4d2cb;
  border-radius: 999px;
  padding: 8px 12px;
  color: #203632;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.guide-section {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
  gap: 28px;
  padding: 30px 0;
  border-top: 1px solid #cbd7d0;
}

.guide-section h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
}

.guide-body {
  display: grid;
  gap: 14px;
}

.guide-body p,
.guide-body li {
  color: #3f4d49;
  line-height: 1.72;
}

.guide-body p,
.guide-body ul,
.guide-body ol {
  margin: 0;
}

.guide-body ul,
.guide-body ol {
  padding-left: 1.2rem;
}

.guide-body strong {
  color: #202426;
}

.guide-callout {
  border: 1px solid #203632;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 6px 6px 0 #dce6df;
}

.stamp-legend,
.stamp-grid {
  display: grid;
  gap: 12px;
}

.stamp-legend {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stamp-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stamp-card {
  min-height: 210px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.stamp-card h3 {
  margin: 18px 0 10px;
  line-height: 1.2;
}

.stamp-card p {
  margin: 0;
}

.stamp-card small {
  display: block;
  margin-top: 18px;
  color: #566661;
  line-height: 1.55;
}

.stamp-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  border: 1px solid #cbd7d0;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f8faf7;
  color: #203632;
  font-size: 0.78rem;
  font-weight: 900;
}

.stamp-card.stamped,
.stamp-status.stamped {
  border-color: #1f5951;
  background: #e4f1ed;
  color: #17453f;
}

.stamp-card.partial,
.stamp-status.partial {
  border-color: #b9902d;
  background: #fff5d5;
  color: #6a4b10;
}

.stamp-card.queued,
.stamp-status.queued {
  border-color: #577a9b;
  background: #e8f1f8;
  color: #244a68;
}

.stamp-card.unknown,
.stamp-status.unknown {
  border-color: #9ba8a4;
  background: #eef1ef;
  color: #4c5653;
}

.stamp-card.external,
.stamp-status.external {
  border-color: #8f6578;
  background: #f8e8ef;
  color: #69364d;
}

.status-hero code,
.stamp-card code {
  border-radius: 6px;
  background: #e9efe9;
  padding: 2px 6px;
  color: #203632;
}

.status-board {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 28px;
}

.status-panel {
  min-height: 128px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.status-panel.primary {
  border-color: #203632;
  box-shadow: 6px 6px 0 #dce6df;
}

.status-panel span,
.status-panel strong,
.status-panel small {
  display: block;
}

.status-panel strong {
  margin-top: 16px;
  overflow-wrap: anywhere;
  font-size: 1.18rem;
  line-height: 1.25;
}

.status-panel small,
.status-panel > span {
  color: #566661;
  line-height: 1.45;
}

.status-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.status-detail-grid h3 {
  margin-bottom: 10px;
}

.status-error {
  border: 1px solid #8f6578;
  border-radius: 8px;
  padding: 14px;
  background: #f8e8ef;
  color: #69364d;
}

.weather-map-section {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin: 8px 0 28px;
}

.taiwan-map {
  position: relative;
  min-height: 620px;
  border: 1px solid #203632;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f8faf7);
  box-shadow: 8px 8px 0 #dce6df;
}

.location-chip,
.island-chip {
  border: 1px solid #c4d2cb;
  border-radius: 999px;
  background: #fff;
  color: #203632;
  font-size: 0.78rem;
  font-weight: 900;
}

.map-canvas {
  position: absolute;
  inset: 18px 16px 18px 16px;
}

.taiwan-county-map {
  width: 100%;
  height: 100%;
}

.county-shape {
  cursor: pointer;
  fill: #e4f1ed;
  stroke: #6f938b;
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
  transition:
    fill 150ms ease,
    stroke 150ms ease,
    stroke-width 150ms ease;
}

.county-shape:hover,
.county-shape:focus-visible,
.county-shape.active,
.island-shape:hover,
.island-shape.active {
  fill: #1f5951;
  stroke: #163b36;
  stroke-width: 2.4;
  outline: none;
}

.map-selected-label {
  position: absolute;
  right: 12px;
  top: 12px;
  border-radius: 999px;
  padding: 7px 12px;
  background: #1f5951;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(18, 32, 30, 0.14);
}

.map-note {
  position: absolute;
  left: 8px;
  bottom: 0;
  color: #586661;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.map-fallback {
  display: grid;
  min-height: 620px;
  place-items: center;
  padding: 24px;
  color: #586661;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
}

.location-chip:hover,
.location-chip.active,
.island-chip:hover,
.island-chip.active {
  border-color: #1f5951;
  background: #1f5951;
  color: #fff;
}

.island-inset {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 2;
  width: min(170px, calc(100% - 36px));
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(18, 32, 30, 0.08);
}

.island-title {
  display: block;
  margin-bottom: 6px;
  color: #566661;
  font-size: 0.78rem;
  font-weight: 900;
}

.island-map {
  display: block;
  width: 100%;
  height: 92px;
  margin-bottom: 8px;
}

.island-shape {
  cursor: pointer;
  fill: #e4f1ed;
  stroke: #6f938b;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}

.island-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.island-chip {
  min-height: 30px;
  padding: 5px 9px;
}

.weather-list {
  display: flex;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 9px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.location-chip {
  min-height: 34px;
  padding: 6px 10px;
}

.weather-board,
.forecast-strip {
  display: grid;
  gap: 12px;
}

.weather-board {
  grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr));
  margin: 8px 0 28px;
}

.weather-current,
.weather-metric,
.forecast-card {
  min-height: 128px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.weather-current {
  border-color: #203632;
  box-shadow: 6px 6px 0 #dce6df;
}

.weather-current span,
.weather-current strong,
.weather-current small,
.weather-metric span,
.weather-metric strong,
.forecast-card span,
.forecast-card strong,
.forecast-card small {
  display: block;
}

.weather-current strong,
.weather-metric strong,
.forecast-card strong {
  margin-top: 14px;
  overflow-wrap: anywhere;
  font-size: 1.16rem;
  line-height: 1.25;
}

.weather-metric strong {
  font-size: 1.42rem;
}

.weather-current small,
.weather-metric span,
.forecast-card span,
.forecast-card small {
  color: #566661;
  line-height: 1.45;
}

.forecast-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weather-source {
  color: #3f4d49;
  line-height: 1.7;
}

.guide-code {
  overflow-x: auto;
  margin: 0;
  border-radius: 8px;
  padding: 16px;
  background: #12201e;
  color: #f8fbf7;
  line-height: 1.6;
}

.guide-footer {
  padding: 12px 0 44px;
}

@media (max-width: 840px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    justify-content: center;
    padding: 10px;
  }

  .mark {
    margin: 0 8px 0 0;
  }

  .content {
    padding: 22px 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .hero,
  .environment,
  .guide-section,
  .cards,
  .tool-list,
  .stamp-grid,
  .status-board,
  .weather-map-section,
  .weather-board,
  .forecast-strip,
  .status-detail-grid {
    grid-template-columns: 1fr;
  }

  .stamp-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-copy {
    min-height: 280px;
    padding: 12px 0;
  }

  .lab-panel {
    min-height: 0;
    box-shadow: 8px 8px 0 #dce6df;
  }
}

@media (max-width: 500px) {
  h2 {
    font-size: 2.45rem;
  }

  .signal-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stamp-legend {
    grid-template-columns: 1fr;
  }
}
