/* Air Flow Room — Fujiya Campus CI（Navy / Gold / Cream） */
:root {
  --cream: #fafae3;
  --navy: #1a3468;
  --deep: #1a2e5a;
  --gold: #f5c440;
  --blue: #2b6baf;
  --sky: #5ab9d0;
  --ink: #1a3468;
  --muted: #55607a;
  --line: rgba(26, 52, 104, 0.16);
  --paper: #ffffff;
  --danger: #b3261e;
  --radius: 12px;
  --tap: 44px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "top top" "stage panel";
}
.top {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px;
  background: var(--navy); color: var(--cream);
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .name { font-weight: 800; letter-spacing: 0.02em; }
.brand .sub { font-size: 12px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .ghost { color: var(--cream); background: transparent; border-color: rgba(250, 250, 227, 0.5); }

.stage { grid-area: stage; position: relative; min-height: 0; background: var(--deep); overflow: hidden; }
#gl { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }

.legend {
  position: absolute; right: 12px; top: 56px; bottom: 76px;
  display: flex; gap: 6px; pointer-events: none;
}
.legend .bar { width: 14px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.6); }
.legend .ticks { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000a; }

.views { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
.views button, .hud button, .hud select {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(26, 46, 90, 0.75); color: #fff; cursor: pointer;
}
.hud {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #fff;
}
.hud .ghost { background: rgba(26, 46, 90, 0.75); color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.hud .play { background: var(--gold); color: var(--navy); font-weight: 800; border: none; min-height: var(--tap); padding: 0 18px; }
.hud .clock { font-variant-numeric: tabular-nums; font-size: 14px; text-shadow: 0 1px 2px #000a; }
.hud .status { font-size: 12px; opacity: 0.9; text-shadow: 0 1px 2px #000a; }
.badge {
  position: absolute; right: 12px; top: 12px; font-size: 12px; color: var(--navy);
  background: rgba(250, 250, 227, 0.92); padding: 4px 10px; border-radius: 999px; pointer-events: none;
}
.tip {
  position: absolute; max-width: 240px; padding: 8px 12px; border-radius: 10px;
  background: var(--cream); color: var(--navy); font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 16px #0006; pointer-events: none;
}
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.lbl.north { background: var(--cream); color: var(--navy); }
.lbl.wind { background: rgba(90, 185, 208, 0.92); color: #0b2440; }
.nogl { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: #fff; text-align: center; }

.panel {
  grid-area: panel; min-height: 0; display: flex; flex-direction: column;
  background: var(--cream); border-left: 1px solid var(--line);
}
.tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; background: #fff; }
.tabs button {
  flex: 1 0 auto; min-height: var(--tap); padding: 0 10px; border: none; border-radius: 10px;
  background: transparent; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tabs button.on { background: var(--gold); color: var(--navy); }
.body { flex: 1; overflow-y: auto; padding: 4px 16px 32px; overscroll-behavior: contain; }

.sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: none; }
.sec h2 { font-size: 15px; margin: 0 0 10px; }
.sec h3 { font-size: 14px; margin: 0 0 6px; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 8px 0 0; }
.warn { font-size: 13px; color: #8a4b00; background: #fff4d6; border-radius: 8px; padding: 8px 10px; line-height: 1.5; }

.field { display: block; margin: 10px 0; }
.field .lab { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.field .val { font-weight: 400; color: var(--muted); }
.inp { display: flex; align-items: center; gap: 6px; }
.inp input, .field select, .plans input, .row input[type="text"] {
  width: 100%; min-height: var(--tap); padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.inp .unit { font-size: 13px; color: var(--muted); min-width: 2em; }
.field input[type="range"] { width: 100%; min-height: var(--tap); accent-color: var(--blue); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  flex: 1 0 auto; min-height: var(--tap); padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 13.5px;
}
.seg button.on { background: var(--navy); color: var(--cream); border-color: var(--navy); font-weight: 700; }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary, button.ghost, button.danger {
  min-height: var(--tap); padding: 0 16px; border-radius: 10px; cursor: pointer; font-weight: 700;
}
button.primary { background: var(--navy); color: var(--cream); border: none; }
button.ghost { background: #fff; border: 1px solid var(--line); }
button.danger { background: #fff; color: var(--danger); border: 1px solid #e8b4b0; }
button.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
button.wide { width: 100%; margin-top: 8px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chips button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }

.palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.palette button {
  display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 10px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 13.5px;
}
.palette button:hover { border-color: var(--gold); }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: none; background: var(--sky); }
.sw[data-type="ac"], .sw[data-type="cassette"] { background: #e8eef7; border: 1px solid #9aa9c4; }
.sw[data-type="circulator"] { background: var(--gold); }
.sw[data-type="heater"] { background: #d9593f; }
.sw[data-type="pc"], .sw[data-type="laptop"], .sw[data-type="monitor"], .sw[data-type="console"], .sw[data-type="kettle"], .sw[data-type="heatsrc"], .sw[data-type="lamp"], .sw[data-type="tv"], .sw[data-type="fridge"] { background: #f08a5d; }
.sw[data-type="iwall"] { background: #e9e4cf; border: 1px solid #b8b29a; }
.sw[data-type="idoor"] { background: #a8825d; }
.sw[data-type="sit"], .sw[data-type="stand"] { background: #f2a88c; }
.sw[data-type="cutout"], .sw[data-type="pillar"] { background: #737a8c; }
.sw[data-type="window"], .sw[data-type="tallwindow"] { background: #9fd6f2; }
.sw[data-type="door"], .sw[data-type="bed"], .sw[data-type="table"], .sw[data-type="desk"], .sw[data-type="shelf"], .sw[data-type="chest"] { background: #a8825d; }

.total { display: flex; align-items: baseline; gap: 6px; }
.total .big { font-size: 44px; font-weight: 800; color: var(--navy); line-height: 1; }
.scores { list-style: none; padding: 0; margin: 10px 0 0; }
.scores li { display: grid; grid-template-columns: 7.5em auto; gap: 2px 8px; padding: 8px 0; border-top: 1px dashed var(--line); }
.scores .lab { font-weight: 700; font-size: 13.5px; }
.scores .stars { color: #c99000; letter-spacing: 1px; }
.scores .txt { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.plans { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.plans li { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.progress { height: 10px; border-radius: 5px; background: #e6e6cf; overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; background: var(--blue); transition: width 0.3s; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card p { margin: 0 0 6px; font-size: 13px; }
.tablewrap { overflow-x: auto; margin-top: 12px; }
table.cmp { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.cmp th, .cmp td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; background: #fff; }
.cmp th:first-child { text-align: left; }
.cmp td.best { background: #fdeeb8; font-weight: 800; }
.cmp tr.sum td, .cmp tr.sum th { font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--cream); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
dialog { border: none; border-radius: 16px; padding: 0; max-width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); color: var(--ink); background: var(--cream); }
dialog::backdrop { background: rgba(26, 46, 90, 0.6); }
.about { padding: 20px; line-height: 1.7; font-size: 14px; }
.about h2 { margin: 0 0 8px; font-size: 18px; }
.about h3 { margin: 16px 0 4px; font-size: 15px; border-left: 4px solid var(--gold); padding-left: 8px; }
.about ul, .about ol { padding-left: 1.3em; margin: 4px 0; }
.noscript { padding: 16px; }

@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 52px minmax(0, 56dvh) 1fr; grid-template-areas: "top" "stage" "panel"; }
  .top { padding: 0 12px; }
  .brand .sub { display: none; }
  .panel { border-left: none; border-top: 1px solid var(--line); }
  .legend { top: 52px; bottom: 70px; right: 8px; }
  .views { left: 8px; top: 8px; }
  .badge { right: 8px; top: 8px; font-size: 11px; }
  .hud { left: 8px; right: 8px; bottom: 8px; gap: 6px; }
  .hud .status { flex-basis: 100%; }
  .body { padding: 0 12px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .progress span { transition: none; }
}
