:root {
  --bg: #07111f;
  --panel: rgba(15, 28, 45, .92);
  --line: rgba(148, 163, 184, .16);
  --text: #e7edf5;
  --muted: #8fa0b5;
  --cyan: #42d3e8;
  --red: #ff6b77;
  --green: #35d49a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 10%, rgba(35, 180, 210, .13), transparent 30%),
    radial-gradient(circle at 10% 40%, rgba(65, 105, 225, .1), transparent 32%),
    var(--bg);
  font-family: "Noto Sans TC", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

button, input { font: inherit; }
button { cursor: pointer; }
.shell { position: relative; width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 32px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font: 600 .74rem/1 "Roboto Mono", monospace; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(2.8rem, 7vw, 5.4rem); line-height: .95; letter-spacing: -.06em; }
.lead { margin: 14px 0 0; color: var(--muted); font-size: 1.02rem; }
.cost-chip { display: grid; min-width: 140px; padding: 14px 18px; border: 1px solid rgba(66,211,232,.32); border-radius: 16px; background: rgba(66,211,232,.08); }
.cost-chip span, .cost-chip small { color: var(--muted); font-size: .72rem; }
.cost-chip strong { color: var(--cyan); font: 600 1.8rem/1.2 "Roboto Mono", monospace; }
.panel { margin-top: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 24px 64px rgba(0,0,0,.22); backdrop-filter: blur(12px); }
.lookup-form > label, .calculator-inputs label { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .05em; }
.input-action { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 9px; }
input { width: 100%; padding: 14px 16px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; outline: none; background: rgba(5,13,24,.7); font: 600 1rem "Roboto Mono", monospace; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(66,211,232,.12); }
.input-action button { padding: 0 22px; border: 0; border-radius: 12px; color: #04151b; background: var(--cyan); font-weight: 800; }
.input-action button:disabled { opacity: .55; cursor: wait; }
.status { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
.status.success { color: var(--green); }
.status.error { color: var(--red); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading p { margin: 0; color: var(--muted); font: 500 .76rem "Roboto Mono", monospace; }
.section-index { color: var(--cyan); font: 600 .7rem "Roboto Mono", monospace; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.level-card { padding: 16px; text-align: left; color: var(--text); border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); transition: transform .18s, border-color .18s; }
.level-card:hover { transform: translateY(-2px); border-color: currentColor; }
.level-card span, .level-card small { display: block; color: var(--muted); font-size: .7rem; }
.level-card strong { display: block; margin: 5px 0 3px; font: 600 1.38rem "Roboto Mono", monospace; }
.level-card.pressure, .level-card.pressure-soft { color: var(--red); }
.level-card.pivot { color: var(--cyan); }
.level-card.support, .level-card.support-soft { color: var(--green); }
.ohlc-strip { display: flex; gap: 26px; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.025); color: var(--muted); font-size: .75rem; }
.ohlc-strip strong { margin-left: 5px; color: var(--text); font-family: "Roboto Mono", monospace; }
.calculator-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.calculator-inputs input { margin-top: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.summary-grid article { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.summary-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .7rem; }
.summary-grid strong { font: 600 1rem "Roboto Mono", monospace; }
.summary-grid .break-even { border-color: rgba(53,212,154,.3); }
.summary-grid .break-even strong { color: var(--green); }
.table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; z-index: 1; padding: 12px 16px; text-align: right; color: var(--muted); background: #101d2e; font-size: .7rem; letter-spacing: .06em; }
th:first-child, td:first-child { text-align: left; }
td { padding: 11px 16px; text-align: right; border-top: 1px solid var(--line); font-size: .84rem; }
td:first-child { display: flex; align-items: center; gap: 10px; }
.direction { min-width: 42px; padding: 3px 7px; border-radius: 6px; text-align: center; font-size: .65rem; font-weight: 800; }
.price-change { font: 700 .7rem "Roboto Mono", monospace; white-space: nowrap; }
.level-marker { padding: 3px 7px; border: 1px solid currentColor; border-radius: 999px; font: 700 .66rem "Roboto Mono", monospace; letter-spacing: .04em; }
.loss-row { background: rgba(255,107,119,.035); }
.loss-row .direction { color: var(--red); background: rgba(255,107,119,.12); }
.profit-row { background: rgba(53,212,154,.035); }
.profit-row .direction { color: var(--green); background: rgba(53,212,154,.12); }
.cost-row .direction { color: #f5b94c; background: rgba(245,185,76,.12); }
.level-only-row { box-shadow: inset 4px 0 0 currentColor; }
.level-ah { color: #ff8992; background: rgba(255,107,119,.17); }
.level-nh { color: #ffb1b8; background: rgba(255,107,119,.11); }
.level-cdp { color: var(--cyan); background: rgba(66,211,232,.15); }
.level-nl { color: #78e6bf; background: rgba(53,212,154,.1); }
.level-al { color: var(--green); background: rgba(53,212,154,.18); }
.level-ah .level-marker, .level-nh .level-marker, .level-cdp .level-marker, .level-nl .level-marker, .level-al .level-marker { background: rgba(7,17,31,.3); }
.mono { font-family: "Roboto Mono", monospace; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }
.is-hidden { display: none; }
footer { padding: 24px 4px 0; text-align: center; color: #63758a; font-size: .68rem; }

@media (max-width: 720px) {
  .shell { width: min(100% - 20px, 560px); padding-top: 26px; }
  .hero { align-items: center; }
  .lead { font-size: .86rem; }
  .cost-chip { min-width: 115px; padding: 11px 13px; }
  .panel { padding: 18px; border-radius: 16px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .level-card.pivot { grid-column: span 2; }
  .summary-grid { grid-template-columns: 1fr; }
  .ohlc-strip { justify-content: space-between; gap: 8px; }
  .table-wrap { max-height: 520px; }
  th, td { padding: 10px 9px; }
}

@media (max-width: 440px) {
  .input-action { grid-template-columns: 1fr; }
  .input-action button { min-height: 48px; }
  .calculator-inputs { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; }
  .cost-chip { min-width: 105px; }
}
