/*
 * お客さんが見る画面の共通部品（案A「ひるの島」）。最終案は server/miniature/design/final.html。
 *
 * 色は HP（hopon.co.jp）のロゴの点とイラストから取った。書体は HP と同じ Zen Kaku Gothic New を
 * 画面に出る字だけに切り出して置いてある（design/src/make_assets.py）。無い字は端末の書体で出る。
 * ロゴと車両の絵は /assets/brand.svg の <symbol>。**外側の viewBox は 0 起点にする**
 * （記号の viewBox が原点からずれていると、上と左が切れる）。
 */
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 400; font-display: swap; src: url("/assets/fonts/zkgn-400.woff2?v=3") format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 700; font-display: swap; src: url("/assets/fonts/zkgn-700.woff2?v=3") format("woff2"); }

:root {
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --bg: #FAF7EF; --surface: #FFFFFF; --surface-2: #F3EEE2; --line: #E6DFCF;
  --ink: #2E2E41; --muted: #77737F; --faint: #B4AEA2;
  --primary: #1A9398; --on-primary: #FFFFFF; --em: #087A86;
  --sun: #F2BD35; --on-sun: #2E2E41; --sun-off: #EFE5CF;
  --ok: #2FA36B; --warn: #E9A21B; --red: #E56B66;
  --art-trike: #087A86; --art-ground: #ECE5D6;
  --mark: #231F20;                       /* DRAWER・BOARD のロゴ（パネルと同じ黒） */
  --shadow: 0 1px 0 rgba(46,46,65,.04), 0 12px 30px -16px rgba(46,46,65,.28);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
b, strong { font-weight: 700; }
button { font: inherit; color: inherit; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ── ロゴ ── */
.logo { display: block; height: 28px; width: auto; color: #111; flex: none; }
.dlogo { display: block; height: 12px; width: auto; color: var(--mark); flex: none; }
.dlogo.inline { display: inline-block; height: .7em; vertical-align: baseline; margin-right: .08em; }
.blogo { display: block; height: 20px; width: auto; color: var(--mark); }
.rule { width: 1px; height: 26px; background: var(--line); flex: none; }

/* ── 札（つながり・状態） ── */
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  font-size: 13px; padding: 6px 13px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow); white-space: nowrap;
}
.chip.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent); }
.dot.sun { background: var(--sun); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun) 28%, transparent); }
.dot.ng { background: var(--red); }
.badge {
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
  font-size: 13px; font-weight: 700; padding: 6px 13px 6px 10px; border-radius: 99px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.badge svg { width: 16px; height: 16px; flex: none; }
.badge.sun { background: var(--sun); color: var(--on-sun); }
.badge.teal { background: var(--primary); color: var(--on-primary); }
.badge.muted { color: var(--muted); }

/* ── 絵（地面・太陽・車両）。太陽は車両の状態: 施錠中は沈んだ砂色、開錠・IG ON で黄色く昇る ── */
.art { position: relative; overflow: hidden; }
.art .ground { position: absolute; left: 0; right: 0; bottom: 0; height: var(--gh); background: var(--art-ground); z-index: 1; }
.art .orb {
  position: absolute; border-radius: 50%; width: var(--ow); height: var(--ow);
  left: var(--ox); bottom: calc(var(--gh) - var(--ow) / 2); background: var(--sun-off);
  transition: background .4s, box-shadow .4s;
}
.art.on .orb, .art.sun .orb { background: var(--sun); }
.art.on .orb { box-shadow: 0 0 0 calc(var(--ow) * .08) rgba(242,189,53,.16), 0 0 0 calc(var(--ow) * .17) rgba(242,189,53,.07); }
.art .trike {
  position: absolute; z-index: 2; left: var(--tx); width: var(--tw); height: auto;
  bottom: calc(var(--gh) - var(--tw) * .004); color: var(--art-trike);
}

/* ── 残り時間の輪 ── */
.ring { transform: rotate(-90deg); flex: none; }
.ring .track { fill: none; stroke: var(--line); stroke-width: 4; }
.ring .prog { fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray .9s linear; }

/* ── ボタン ── */
.btn {
  height: 64px; border: 0; border-radius: 20px; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  transition: transform .08s, background .15s, color .15s, box-shadow .15s, opacity .15s;
}
.btn svg { width: 22px; height: 22px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 12px 26px -14px var(--primary); }
.btn.primary.on { background: var(--sun); color: var(--on-sun); box-shadow: 0 12px 26px -14px var(--sun); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:disabled { opacity: .36; box-shadow: none; cursor: default; }

/* ── 知らせの帯 ── */
.banner {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px;
  background: var(--surface-2); font-size: 13px; line-height: 1.6;
}
.banner.warn { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); }
.banner svg { width: 20px; height: 20px; flex: none; color: var(--primary); }
.banner button {
  margin-left: auto; flex: none; border: 0; border-radius: 10px; padding: 7px 12px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
}

/* ── 灯火の部品（スライド・タイル・色・明るさ） ── */
.card { background: var(--surface); border-radius: 22px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.card .note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.slide {
  position: relative; display: grid; touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--surface-2); border-radius: 16px; padding: 5px;
}
.slide .knob {
  position: absolute; top: 5px; bottom: 5px; left: 5px; border-radius: 12px;
  background: var(--primary); box-shadow: 0 8px 16px -10px var(--primary);
  transition: transform .16s ease-out, background .16s; pointer-events: none;
}
.slide.center .knob { background: var(--surface); box-shadow: 0 6px 14px -8px rgba(46,46,65,.4); }
.slide button {
  position: relative; z-index: 1; height: 58px; border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.slide button svg { width: 22px; height: 22px; }
.slide button.sel { color: var(--on-primary); font-weight: 700; }
.slide.center button.sel { color: var(--ink); }
.slide.dim { opacity: .35; pointer-events: none; }
.tile {
  width: 100%; min-height: 64px; border: 0; border-radius: 16px; cursor: pointer;
  font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--surface-2); color: var(--ink); transition: background .12s, color .12s, box-shadow .12s;
}
.tile svg { width: 22px; height: 22px; }
.tile.on { background: var(--primary); color: var(--on-primary); }
.tile.red { color: var(--red); }
.tile.red.on { background: var(--red); color: #fff; }
.tile.hz.on { background: var(--sun); color: var(--on-sun); box-shadow: 0 10px 20px -12px var(--sun); }
.tile:disabled { opacity: .35; cursor: default; }
.tile:active:not(:disabled) { transform: translateY(1px); }
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.palette button {
  width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.14);
}
.palette button.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.palette .pick {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none; cursor: pointer;
  background: conic-gradient(#ff5a5a, #ffd25a, #5aff8d, #5ad7ff, #7a7bff, #ff5ae0, #ff5a5a);
  border: 3px solid var(--sun);
}
.palette .pick input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.range { display: flex; align-items: center; gap: 12px; }
.range output { min-width: 2.4em; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 28px; background: transparent; margin: 0;
  --v: 50%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary) var(--v), var(--surface-2) var(--v));
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-2); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--primary); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(46,46,65,.3), inset 0 0 0 1px var(--line);
}
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(46,46,65,.3); }
input[type=range]:disabled { opacity: .35; }
