:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #eef6f3;
  --text: #18211f;
  --muted: #60706b;
  --border: #dce4df;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --amber: #b45309;
  --danger: #a33a32;
  --shadow: 0 10px 30px rgba(25, 43, 38, 0.08);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.icon-button,
.primary-button,
.secondary-button,
.text-button,
.segment,
.result-card,
.station-button,
.favorite-button {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
  font-size: 22px;
}

.primary-button {
  min-width: 82px;
  height: 48px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  font-weight: 700;
}

.secondary-button:disabled {
  color: #95a29e;
  background: #f1f4f2;
  cursor: not-allowed;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.search-panel,
.panel,
.route-view {
  margin-top: 10px;
}

.search-panel {
  display: grid;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #e7eeea;
  border-radius: 8px;
}

.segment {
  height: 38px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(17, 36, 31, 0.12);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-row input {
  width: 100%;
  height: 48px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.panel {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.section-title,
.route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.favorite-list,
.results-list,
.station-list {
  display: grid;
  gap: 8px;
}

.favorite-list {
  margin-top: 10px;
}

.favorite-button,
.result-card,
.station-button {
  width: 100%;
  min-width: 0;
  text-align: left;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.favorite-button {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.results-list {
  margin-top: 12px;
}

.result-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(19, 38, 34, 0.04);
}

.result-card strong,
.favorite-button strong {
  font-size: 17px;
}

.result-card span,
.favorite-button span,
.route-head p,
.arrival-main p,
.bus-strip {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.direction-pill {
  justify-self: start;
  padding: 4px 8px;
  color: var(--accent);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.route-view {
  display: grid;
  gap: 12px;
}

.route-head {
  align-items: flex-start;
  padding: 4px 0;
}

.arrival-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid #cfe2dc;
  border-radius: 8px;
}

.arrival-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.arrival-main strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.bus-strip {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: var(--amber);
}

.station-list {
  padding-bottom: 28px;
}

.station-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 12px;
}

.station-button.active {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.station-no {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #e9ece8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.station-button.active .station-no {
  background: var(--accent);
  color: white;
}

.message-error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 420px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .arrival-panel {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }
}

