[hidden] {
  display: none !important;
}

:root {
  --bg: #f4efe5;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-border: rgba(23, 63, 53, 0.1);
  --text: #1f2d2a;
  --muted: #5d6e68;
  --brand: #173f35;
  --highlight: #c96d32;
  --highlight-soft: #fde7d7;
  --express: #d49a00;
  --danger: #a74828;
  --danger-soft: #f8ddd2;
  --shadow: 0 16px 40px rgba(23, 63, 53, 0.1);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  color-scheme: light;
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 109, 50, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f4eb 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(760px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero,
.panel {
  padding: 22px;
}

.eyebrow,
.card-label,
.field-label {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  margin-top: 8px;
  font-size: clamp(2rem, 6vw, 2.8rem);
}

h2 {
  font-size: 1.15rem;
}

.hero-copy,
.clock-date,
.trip-meta,
.timeline-note,
.wait-text,
.secondary-trip,
.feedback-status,
.visit-counter {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.hero-copy {
  margin-top: 10px;
}

.clock-card {
  min-width: 150px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--brand);
  color: #fffaf3;
}

.clock-time {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  letter-spacing: 0;
}

.clock-date {
  margin-top: 4px;
  color: rgba(255, 250, 243, 0.8);
}

.query-bar {
  margin-top: 18px;
}

.query-mode,
.stop-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-button,
.stop-button,
.submit-button {
  padding: 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: rgba(23, 63, 53, 0.08);
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.mode-button.active,
.stop-button.active,
.submit-button {
  background: var(--brand);
  color: #fffaf3;
}

.manual-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.manual-field.is-hidden {
  display: none;
}

.time-input,
.feedback-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(23, 63, 53, 0.12);
  border-radius: var(--radius-md);
  background: #fffdf8;
  color: var(--text);
}

.feedback-input {
  min-height: 104px;
  resize: vertical;
}

.top-time-field,
.top-stop-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.top-stop-field {
  margin-top: 12px;
}

.top-time-field .field-label,
.top-stop-field .field-label {
  justify-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(23, 63, 53, 0.08);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.top-time-field .query-mode,
.top-stop-field .stop-toggle {
  justify-self: stretch;
  width: 100%;
  gap: 8px;
  margin-top: 0;
}

.top-time-field .mode-button,
.top-stop-field .stop-button {
  padding: 12px 10px;
}

.query-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.schedule-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--highlight-soft);
  color: var(--highlight);
  font-weight: 700;
}

.query-reference {
  color: var(--brand);
  font-weight: 700;
}

.panel {
  margin-top: 18px;
}

.stop-toggle {
  margin-top: 14px;
}

.next-card {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(23, 63, 53, 0.06);
}

.next-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.next-day {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(23, 63, 53, 0.1);
  color: var(--brand);
  font-weight: 700;
}

.next-time {
  margin-top: 10px;
  font-size: clamp(3rem, 10vw, 4.2rem);
  line-height: 1;
  font-weight: 700;
  color: var(--brand);
}

.next-line {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.wait-text,
.trip-meta,
.secondary-trip {
  margin-top: 8px;
}

.trip-meta {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  line-height: 1.45;
}

.express-label {
  color: var(--express);
  font-weight: 800;
  white-space: nowrap;
}

.next-time .express-label {
  margin-left: 4px;
  font-size: 0.34em;
}

.timeline-time .express-label,
.wait-text .express-label,
.secondary-trip .express-label {
  margin-left: 2px;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-item {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(23, 63, 53, 0.06);
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.timeline-time {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
}

.timeline-day {
  color: var(--muted);
  font-size: 0.92rem;
}

.timeline-line {
  margin: 6px 0 0;
  font-weight: 700;
}

.timeline-meta,
.timeline-wait {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.timeline-meta {
  color: var(--danger);
  font-weight: 700;
}

.timeline-note {
  margin-top: 10px;
  font-size: 0.94rem;
}

.query-submit-button {
  display: block;
  width: min(50%, 220px);
  margin-top: 18px;
  margin-right: auto;
  margin-left: auto;
  padding: 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--danger);
  color: #fffaf3;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(167, 72, 40, 0.22);
}

.visit-counter {
  margin-top: 14px;
  text-align: center;
  font-size: 0.88rem;
}

.feedback-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.feedback-status {
  min-height: 1.6em;
  margin-top: 10px;
  font-size: 0.94rem;
}

.stats-shell {
  width: min(980px, calc(100vw - 24px));
}

.stats-home-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: rgba(23, 63, 53, 0.08);
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.stats-controls {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(220px, 1fr) minmax(120px, 160px);
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.stats-field {
  display: grid;
  gap: 8px;
}

.stats-refresh {
  width: 100%;
  margin: 0;
}

.stats-status,
.stats-caption,
.stats-empty,
.stat-card span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.stats-status {
  margin-top: 12px;
}

.stats-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 2rem;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 8px;
  font-size: 0.88rem;
}

.stats-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.stats-caption {
  font-size: 0.9rem;
}

.stats-bars {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.stats-bar-row {
  display: grid;
  gap: 8px;
}

.stats-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.stats-bar-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stats-bar-meta strong {
  color: var(--brand);
  white-space: nowrap;
}

.stats-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 63, 53, 0.08);
}

.stats-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--highlight));
}

.stats-hour-bars {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-table-wrap {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.stats-table th,
.stats-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(23, 63, 53, 0.1);
  text-align: left;
  vertical-align: top;
}

.stats-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stats-table td {
  line-height: 1.5;
}

.stats-table .is-right {
  text-align: right;
}

.stats-empty {
  padding: 14px 0;
}

@media (max-width: 640px) {
  .hero,
  .panel {
    padding: 18px;
  }

  .hero-head,
  .next-top,
  .timeline-head {
    flex-direction: column;
  }

  .clock-card {
    width: 100%;
  }

  .stats-controls,
  .stats-metrics,
  .stats-hour-bars {
    grid-template-columns: 1fr;
  }

  .stats-panel-head {
    flex-direction: column;
  }
}
