:root {
  --bg: #f3efe6;
  --ink: #1c1917;
  --muted: #6f675e;
  --card: #fffdf8;
  --line: #e3d9c8;
  --up: #1f7a45;
  --down: #b4332a;
  --ma5: #2b6cb0;
  --ma20: #c56a12;
  --cum: #6d4ea3;
  --shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(31, 122, 69, 0.06), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.5;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

header { padding: 36px 0 8px; }

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 4px;
  color: var(--ink);
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 15px;
  text-decoration: none;
}
.wordmark span { color: var(--muted); font: 400 12px "Avenir Next", sans-serif; letter-spacing: .04em; }
.wordmark:hover { text-decoration: underline; text-underline-offset: 5px; }

.lede a { color: var(--ink); }

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", Palatino, "Songti TC", "Noto Serif TC", serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.lede {
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.02rem;
}


h2 {
  margin: 28px 0 8px;
  font-size: 1.05rem;
  font-weight: 650;
}

h2 span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cards-more { margin-top: 10px; }

/* The date beside 當日強勢 only shows on phones, where 最新交易日 moves down. */
.card span i { display: none; font-style: normal; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px 10px;
}

.card b {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 640;
  letter-spacing: -0.03em;
}

.card span, .card small {
  color: var(--muted);
  font-size: 12px;
}

.card small { display: block; margin-top: 2px; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
}

.group { display: flex; flex-wrap: wrap; gap: 6px; }

button, .download {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  min-height: 44px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

button.on, button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #f3efe6;
}

button:focus-visible, .download:focus-visible {
  outline: 2px solid var(--ma5);
  outline-offset: 2px;
}

.hint, footer {
  color: var(--muted);
  font-size: 0.92rem;
}

.hint { margin: 8px 0 0; }

.chart {
  width: 100%;
  height: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.chart-short { height: 280px; }

.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
  /* Edge shadows show there is more table to scroll to. */
  background:
    linear-gradient(to right, var(--card) 30%, rgba(255, 253, 248, 0)) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--card) 30%, rgba(255, 253, 248, 0)) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(28, 25, 23, 0.16), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(28, 25, 23, 0.16), transparent) right / 14px 100% no-repeat scroll,
    var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th, td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

th:first-child, td:first-child { text-align: left; }

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  font-weight: 600;
}

tbody tr:hover { background: #f7f1e6; }
tbody tr { cursor: pointer; }

footer {
  padding: 8px 0 40px;
}

footer a { color: var(--ink); }

@media (max-width: 700px) {
  header { padding-top: 22px; }
  .chart { height: 320px; }
  .chart-short { height: 220px; }
  .card b { font-size: 1.15rem; }
}

/* Author signature: a quiet bridge back to the main site. */
.author {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 40px;
  margin-bottom: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.author-copy { min-width: 0; }
.author-label { margin: 0 0 10px; color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.author h2 { margin: 0; font-family: "Songti TC", "Noto Serif TC", serif; font-size: 1.5rem; }
.author h2 a { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.author h2 span { margin: 0; font: 400 13px "Avenir Next", sans-serif; letter-spacing: .04em; }
.author a { color: var(--ink); text-decoration: none; }
.author a:hover { text-decoration: underline; text-underline-offset: 5px; }
.author a:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; border-radius: 2px; }
.author-description { margin: 10px 0 8px; max-width: 38rem; color: var(--muted); font-size: 14px; line-height: 1.8; }
.author-social { display: flex; flex-wrap: wrap; gap: 0 24px; }
.author-social a { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 7px; min-height: 44px; font-size: 13px; }
.author-social span { color: var(--muted); font-size: 12px; }
.author-home { display: inline-flex; align-items: center; gap: 22px; min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; font-size: 14px; }
@media (max-width: 700px) {
  .author { align-items: flex-start; flex-direction: column; gap: 12px; margin-top: 28px; padding: 24px 0; }
  .author-social { column-gap: 16px; }
}

/* Phones: one headline number, then the chart; the rest follows the chart. */
@media (max-width: 700px) {
  .page { display: flex; flex-direction: column; padding-top: 22px; }
  .page > header, .page > main { display: contents; }
  .wordmark { order: 1; align-self: flex-start; }
  .kicker { order: 2; }
  h1 { order: 3; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
  #cards { order: 4; }
  .toolbar { order: 5; }
  #panel-daily { order: 6; }
  .lede { order: 7; font-size: 0.95rem; }
  .lede:first-of-type { margin-top: 22px; }
  .lede + .lede { margin-top: 0; }
  #cards-more { order: 8; margin-top: 8px; }
  #panel-cum { order: 9; }
  #panel-table { order: 10; }
  .hint { display: none; }

  #cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--line);
  }
  #cards .card { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 10px 0; }
  #cards .card:first-child { grid-column: 1 / -1; padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
  #cards .card:first-child b {
    font-family: "Iowan Old Style", Palatino, "Songti TC", serif;
    font-size: 3.2rem;
    font-weight: 500;
    line-height: 1.05;
  }
  #cards .card span i { display: inline; }
  #cards .card span i::before { content: "・"; }
  .cards-more { grid-template-columns: repeat(2, 1fr); }

  .toolbar { flex-wrap: nowrap; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .group { flex-wrap: nowrap; }
  button { white-space: nowrap; }
}
