/* 色は config/ui.json の theme が正。app.js が下の CSS 変数を上書きする（JS が動く前の初期値だけここに置く）。 */
:root {
  --c-bg: #17120e;
  --c-panel: #241b15;
  --c-text: #f4ece3;
  --c-muted: #b8a898;
  --c-accent: #e0a458;
  --c-border: #3a2d23;
  --c-banner-bg: #5a1f1f;
  --c-banner-text: #ffe9e0;
  --c-error-bg: #4a1818;
  --banner-h: 0px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  padding: 0 16px 20px;
  line-height: 1.45;
}

/* 免責の帯：画面右上に常時表示（スクロール・全画面・小さいウィンドウでも消えない） */
.banner {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  max-width: min(560px, 100vw);
  padding: 8px 14px;
  background: var(--c-banner-bg);
  color: var(--c-banner-text);
  font-size: 0.95rem;
  font-weight: 600;
  border-bottom-left-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.banner[hidden] { display: none; }

.top { min-height: var(--banner-h); display: flex; align-items: center; padding: 4px min(580px, 100vw) 8px 0; }
h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.02em; }
h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--c-muted); font-weight: 600; }

.error-panel {
  background: var(--c-error-bg);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 18px 22px;
  max-width: 720px;
}
.error-panel[hidden], #app[hidden] { display: none; }

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.col { display: grid; gap: 14px; min-width: 0; }
.row2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.row2 .panel { min-width: 0; }

.panel {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 0;
}

/* 条件入力 */
.field { margin-bottom: 12px; }
.field > label, .field > .field-label { display: block; font-size: 0.9rem; color: var(--c-muted); margin-bottom: 4px; }
.field select {
  width: 100%;
  padding: 7px 8px;
  font-size: 1rem;
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: 6px;
}
.field select:disabled, .field.disabled { opacity: 0.45; }
.hint-inline { font-size: 0.8rem; color: var(--c-muted); margin-left: 6px; }
.seg { display: flex; gap: 6px; }
.seg label {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--c-bg);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--c-accent); color: var(--c-bg); font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--c-text); }
.price-row { display: flex; align-items: center; gap: 10px; }
.price-row input[type="range"] { flex: 1; accent-color: var(--c-accent); }
.price-row output { min-width: 5.5em; text-align: right; font-size: 1.25rem; font-weight: 700; }
.input-error { color: var(--c-accent); font-size: 0.9rem; margin: 8px 0 0; }
.input-error[hidden] { display: none; }

/* R1 */
.chart-wrap { position: relative; height: 200px; }
.r1-values { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); margin: 8px 0 0; padding: 0; text-align: center; font-size: 0.85rem; color: var(--c-muted); }
.r1-values li strong { display: block; font-size: 1.1rem; color: var(--c-text); }

/* R2・R4 */
.big-number { font-size: 5rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; color: var(--c-accent); }
.mid-number { font-size: 3rem; font-weight: 800; line-height: 1.1; }
.r2-sub { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 1.05rem; }
.delta-line strong { font-size: 1.5rem; }

/* R3 */
.sent-band { display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: var(--c-bg); }
.sent-band > div { height: 100%; transition: width 0.45s ease; }
.sent-legend { list-style: none; display: flex; gap: 14px; padding: 0; margin: 8px 0 10px; font-size: 0.95rem; flex-wrap: wrap; }
.sent-legend .swatch { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; margin-right: 5px; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.comments li { padding: 7px 10px; border-left: 4px solid var(--c-border); background: var(--c-bg); border-radius: 4px; font-size: 0.98rem; overflow-wrap: anywhere; }
.comments .who { display: block; font-size: 0.78rem; color: var(--c-muted); }

/* R5 */
.hint { margin: 0 0 8px; font-size: 0.85rem; color: var(--c-muted); }
.heat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.heat-cell { border-radius: 10px; padding: 10px 12px; transition: background-color 0.5s ease; min-height: 70px; border: 1px solid var(--c-border); }
.heat-cell .seg-name { display: block; font-size: 0.85rem; font-weight: 600; }
.heat-cell .seg-rate { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.heat-cell .seg-sub { display: block; font-size: 0.75rem; opacity: 0.85; }
.heat-legend { display: flex; margin-top: 10px; height: 10px; border-radius: 5px; overflow: hidden; }
.heat-legend span { flex: 1; }

/* 小さいウィンドウ：1列に積む（免責の帯は fixed のまま右上に残る） */
@media (max-width: 1000px) {
  body { padding-top: var(--banner-h); }
  .top { padding-right: 0; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .big-number { font-size: 4rem; }
}
