:root {
  --ink: #17201d;
  --muted: #68706c;
  --paper: #f1eee7;
  --panel: #faf9f5;
  --line: #d9d5ca;
  --green: #174d3b;
  --green-light: #d8e8df;
  --coral: #ee6a4b;
  --yellow: #f4c95d;
  --shadow: 0 14px 35px rgba(34, 39, 35, .08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 32, 29, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 29, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

button { font: inherit; }

.app-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 24px;
}

.topbar,
.result-band,
.panel-heading,
.history-heading,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { padding: 0 2px 28px; }

.eyebrow,
.section-label,
.result-kicker {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 35px;
  font-weight: 700;
  line-height: 1;
}

.data-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9c6c;
  box-shadow: 0 0 0 5px rgba(46, 156, 108, .12);
}

.result-band {
  min-height: 180px;
  padding: 34px 38px;
  border: 1px solid var(--green);
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  box-shadow: var(--shadow);
}

.result-copy { max-width: 750px; }
.result-kicker { color: var(--yellow); }

.result-copy h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(29px, 4vw, 54px);
  line-height: 1.08;
}

.result-copy > p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .7);
  font-size: 14px;
}

.actions { display: flex; gap: 12px; margin-left: 30px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 132px;
  height: 50px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button-primary { color: var(--ink); background: var(--yellow); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.button-secondary { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.08); }
.button-secondary:hover { background: rgba(255,255,255,.15); }

.button-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, .85fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  position: relative;
  min-width: 0;
  min-height: 480px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading { position: relative; z-index: 2; }
.panel-heading h3, .history-heading h3 { margin: 0; font-size: 19px; }
.section-label { color: var(--muted); }
.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(238,106,75,.14); }

.map, .chart { width: 100%; height: 390px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { color: var(--coral); border-color: var(--coral); }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.stats-panel { min-height: 480px; }
.empty-state { position: absolute; inset: 118px 24px 30px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state span { font-family: Georgia, serif; font-size: 84px; line-height: 1; color: var(--green-light); }
.empty-state p { margin: 8px 0 0; font-size: 13px; }
.empty-state.hidden { display: none; }

.history-section {
  margin-top: 18px;
  padding: 25px 27px;
  border-top: 3px solid var(--coral);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.history-heading { margin-bottom: 18px; }
.history-heading > p { margin: 0; color: var(--muted); font-size: 13px; }
.history-heading strong { color: var(--ink); font-size: 20px; }

.history-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.history-placeholder { grid-column: 1 / -1; padding: 22px; border: 1px dashed var(--line); color: var(--muted); text-align: center; font-size: 13px; }
.history-item { min-width: 0; padding: 14px 15px; border-left: 3px solid var(--green); background: #eeece5; }
.history-item .flag { font-size: 21px; }
.history-item strong { display: block; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.history-item span:last-child { color: var(--muted); font-size: 11px; }

footer { gap: 20px; padding: 22px 2px 0; color: var(--muted); font-size: 11px; }
footer p { margin-bottom: 0; }

@media (max-width: 900px) {
  .app-shell { width: min(100% - 28px, 720px); padding-top: 22px; }
  .result-band { align-items: flex-start; flex-direction: column; gap: 25px; padding: 28px; }
  .actions { width: 100%; margin-left: 0; }
  .button { flex: 1; }
  .dashboard { grid-template-columns: 1fr; }
  .history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .topbar { align-items: flex-start; }
  .data-note { max-width: 135px; justify-content: flex-end; text-align: right; }
  h1 { font-size: 29px; }
  .result-band { min-height: 240px; padding: 24px 20px; }
  .result-copy h2 { font-size: 31px; }
  .actions { gap: 8px; }
  .button { min-width: 0; padding: 0 11px; }
  .panel { min-height: 415px; padding: 18px 14px; }
  .map, .chart { height: 330px; }
  .history-section { padding: 21px 16px; }
  footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
