:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #63717a;
  --line: #d9e1e5;
  --green: #0a8f62;
  --red: #c93636;
  --blue: #1d5f8f;
  --gold: #a36a00;
  --shadow: 0 18px 42px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(29, 95, 143, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(10, 143, 98, 0.12), transparent 32%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow,
.subtle {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.status-panel,
.controls,
.quote-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 225, 229, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-panel {
  display: grid;
  gap: 8px;
  min-width: 210px;
  padding: 16px 18px;
  border-radius: 8px;
  color: var(--muted);
}

.status-dot {
  color: var(--blue);
  font-weight: 800;
}

.status-dot.open {
  color: var(--green);
}

.status-dot.closed {
  color: var(--gold);
}

.controls {
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.symbol-input {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.symbol-input span,
.toggle {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.symbol-input input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.symbol-input input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 95, 143, 0.16);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.error {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(201, 54, 54, 0.28);
  border-radius: 8px;
  color: var(--red);
  background: rgba(201, 54, 54, 0.08);
  font-weight: 700;
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.quote-card {
  display: grid;
  gap: 18px;
  min-height: 360px;
  padding: 20px;
  border-radius: 8px;
}

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

.symbol {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
}

.badge {
  flex: none;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--blue);
  background: rgba(29, 95, 143, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.price {
  font-size: clamp(2.35rem, 5vw, 3.65rem);
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.change {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.up {
  color: var(--red);
}

.down {
  color: var(--green);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.stats div,
.book div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(244, 247, 248, 0.72);
}

dt,
.book span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

dd {
  margin: 5px 0 0;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

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

.book strong {
  display: block;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) {
  .quote-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding: 24px 0;
  }

  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

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

  .quote-card {
    min-height: auto;
  }

  .toggle {
    padding-bottom: 0;
  }
}
