:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #232733;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --line: #2c313c;
  --green: #2fbf71;
  --yellow: #e8b22e;
  --red: #e2533f;
  --blue: #4d9be6;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0 14px env(safe-area-inset-bottom, 16px);
  max-width: 560px;
  margin-inline: auto;
}

.app-header {
  position: sticky;
  top: 0;
  background: linear-gradient(var(--bg) 70%, transparent);
  padding: 14px 0 8px;
  z-index: 5;
}
.title-row { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 1.25rem; margin: 0; }
.meta { color: var(--muted); font-size: 0.82rem; margin: 4px 0 0; }
.reload {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; width: 42px; height: 38px; font-size: 1.2rem;
}
.reload:active { background: var(--line); }

.rule-banner {
  background: rgba(77, 155, 230, 0.12);
  border: 1px solid var(--blue);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  margin-bottom: 12px;
}
.rule-banner b { color: var(--text); }
.rule-sub { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

.cards { display: flex; flex-direction: column; gap: 12px; }

.aft-box {
  margin: 0 14px 10px; padding: 10px 11px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line);
}
.aft-box.alert {
  background: rgba(226, 83, 63, 0.14); border-color: var(--red);
}
.aft-top { display: flex; justify-content: space-between; align-items: baseline; }
.aft-title { font-size: 0.84rem; color: var(--muted); font-weight: 700; }
.aft-box.alert .aft-title { color: #ffb3a7; }
.aft-level { font-size: 0.98rem; font-weight: 800; }
.aft-reasons { margin: 7px 0 0; padding-left: 16px; }
.aft-reasons li { font-size: 0.8rem; color: var(--muted); margin-bottom: 3px; }
.aft-box.alert .aft-reasons li { color: #f0c9c2; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 14px 10px;
}
.name-block { min-width: 0; }
.name { font-size: 1.08rem; font-weight: 700; }
.sub { color: var(--muted); font-size: 0.8rem; }

.risk-badge {
  flex-shrink: 0; text-align: center; border-radius: 12px;
  padding: 8px 12px; min-width: 96px;
}
.risk-badge .lbl { font-size: 0.7rem; opacity: 0.85; display: block; }
.risk-badge .val { font-size: 1.15rem; font-weight: 800; }
.risk-高 { background: rgba(226, 83, 63, 0.18); color: var(--red); border: 1px solid var(--red); }
.risk-中 { background: rgba(232, 178, 46, 0.16); color: var(--yellow); border: 1px solid var(--yellow); }
.risk-低 { background: rgba(47, 191, 113, 0.16); color: var(--green); border: 1px solid var(--green); }
.risk-不明 { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }

.note {
  margin: 0 14px 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--card-2); font-size: 0.86rem;
}
.note.warn { background: rgba(226, 83, 63, 0.14); color: #ffb3a7; }

.metrics { display: flex; gap: 10px; padding: 0 14px 12px; }
.metric { flex: 1; background: var(--card-2); border-radius: 12px; padding: 10px; }
.metric .m-top { display: flex; justify-content: space-between; align-items: baseline; }
.metric .m-name { font-size: 0.78rem; color: var(--muted); }
.metric .m-level { font-size: 1.0rem; font-weight: 800; }
.metric .m-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; min-height: 1em; }
.lv-高 { color: var(--green); }
.lv-中 { color: var(--yellow); }
.lv-低 { color: var(--muted); }
.lv-不明 { color: var(--muted); }

/* ボラは高すぎも注意色にする（個別に上書き） */
.metric.vol .lv-高 { color: var(--yellow); }

.gauge { height: 6px; background: #0e1117; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.gauge > span { display: block; height: 100%; border-radius: 4px; }

.reasons { border-top: 1px solid var(--line); }
.reasons summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  font-size: 0.86rem; color: var(--blue); display: flex; justify-content: space-between;
}
.reasons summary::-webkit-details-marker { display: none; }
.reasons summary .chev { transition: transform 0.15s; }
.reasons[open] summary .chev { transform: rotate(90deg); }
.reasons ul { margin: 0; padding: 2px 14px 14px 30px; }
.reasons li { font-size: 0.86rem; margin-bottom: 6px; }

.legend, .disclaimer { color: var(--muted); font-size: 0.8rem; margin-top: 20px; }
.legend h2 { font-size: 0.95rem; color: var(--text); }
.legend ul { padding-left: 18px; }
.legend li { margin-bottom: 8px; }
.legend b, .disclaimer b { color: var(--text); }
.disclaimer { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 28px; }
.disclaimer p { margin: 4px 0; }

.error { text-align: center; color: var(--muted); padding: 40px 0; }
