:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #6b6258;
  --line: #e4dcd2;
  --paper: #f7f3ee;
  --card: #fffdfb;
  --accent: #8a4b08;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.6 "Source Han Sans SC", "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; text-decoration: none; }

nav { display: flex; align-items: center; gap: 4px; }

nav a, nav button {
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
}

main { max-width: 920px; margin: 0 auto; padding: 20px 16px 48px; }

.card {
  max-width: 420px;
  margin: 24px auto 0;
  padding: 24px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card button { width: 100%; min-height: 44px; margin-top: 4px; }

h1 { font-size: 1.5rem; margin: 0 0 12px; }

.note, .error { margin: 0 0 16px; }

.note { color: var(--muted); }

.error { color: #8d1d1d; }

form label { display: block; margin-bottom: 12px; font-size: 0.92rem; }

input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}

nav button { background: transparent; color: var(--accent); padding: 0; }

table { width: 100%; border-collapse: collapse; background: var(--card); }

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.run-panel { margin: 0 0 20px; }

.run-button {
  width: 100%;
  min-height: 44px;
}

.run-button:disabled {
  background: #b7aa9e;
  cursor: default;
}

.chart-scroll {
  margin: 0 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 8px 8px 4px;
}

.price-chart { display: block; width: 100%; min-width: 640px; height: auto; }

.chart-scroll figcaption { margin: 8px 8px 10px; }

.scroll-hint { margin: 0 0 8px; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  scrollbar-color: #8a4b08 #f3ece4;
}

.table-scroll::-webkit-scrollbar { height: 10px; }

.table-scroll::-webkit-scrollbar-thumb {
  background: #8a4b08;
  border-radius: 8px;
}

.table-scroll table {
  min-width: 760px;
  margin: 0;
}

.table-scroll th,
.table-scroll td { white-space: nowrap; }

.report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.report-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
}

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

.verdict { font-weight: 700; font-size: 1.125rem; }

.score { font-variant-numeric: tabular-nums; white-space: nowrap; }

.meta { display: block; color: var(--muted); font-size: 0.92rem; }

.text-link { display: inline-flex; min-height: 44px; align-items: center; }

.report {
  background: var(--card);
  padding: 4px 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.report h1 { font-size: 1.35rem; }
.report h2 { font-size: 1.15rem; }
.report pre, .report code { overflow-x: auto; }
.report img, .report svg { max-width: 100%; height: auto; }
.report a { overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .report table,
  .report thead,
  .report tbody,
  .report tr,
  .report td,
  .report th { display: block; width: auto; }

  .report thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .report tr {
    margin: 0 0 12px;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
  }

  .report td { border: 0; padding: 8px 0; }

  .report td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
  }
}
