:root {
  --bg: #f4f8ff;
  --paper: #ffffff;
  --ink: #1f2140;
  --muted: #5d6285;
  --line: #dfe4f5;
  --coral: #ff5d5d;
  --coral-soft: #ffe7e4;
  --teal: #0fae9e;
  --teal-soft: #d8f6f1;
  --sun: #f4a600;
  --sun-soft: #fff1cc;
  --violet: #6d4cf6;
  --violet-soft: #ebe5ff;
  --pink: #f0529c;
  --pink-soft: #ffe2f0;
  --sky: #2f8bf0;
  --sky-soft: #dcecff;
  --low: #16b37a;
  --mid: #f2a100;
  --high: #ef4b4b;
  --map-ground: #e9f3e4;
  --map-road: #ffffff;
  --map-bldg: #fdfcff;
  --shadow: 0 10px 30px -14px rgba(52, 44, 140, 0.35);
  --round: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Noto Sans JP", sans-serif;
  --body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12132a;
    --paper: #1c1e3a;
    --ink: #f1f1ff;
    --muted: #a8acd0;
    --line: #2f3260;
    --coral: #ff7b7b;
    --coral-soft: #3d1f2a;
    --teal: #3fd6c4;
    --teal-soft: #163a3b;
    --sun: #ffc23d;
    --sun-soft: #3b3017;
    --violet: #9d86ff;
    --violet-soft: #2b2456;
    --pink: #ff7ab8;
    --pink-soft: #3d1d34;
    --sky: #6aaeff;
    --sky-soft: #1b2c4e;
    --low: #3fd69a;
    --mid: #ffc23d;
    --high: #ff6f6f;
    --map-ground: #1b2b26;
    --map-road: #2c2f55;
    --map-bldg: #262852;
    --shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12132a;
  --paper: #1c1e3a;
  --ink: #f1f1ff;
  --muted: #a8acd0;
  --line: #2f3260;
  --coral: #ff7b7b;
  --coral-soft: #3d1f2a;
  --teal: #3fd6c4;
  --teal-soft: #163a3b;
  --sun: #ffc23d;
  --sun-soft: #3b3017;
  --violet: #9d86ff;
  --violet-soft: #2b2456;
  --pink: #ff7ab8;
  --pink-soft: #3d1d34;
  --sky: #6aaeff;
  --sky-soft: #1b2c4e;
  --low: #3fd69a;
  --mid: #ffc23d;
  --high: #ff6f6f;
  --map-ground: #1b2b26;
  --map-road: #2c2f55;
  --map-bldg: #262852;
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, var(--pink-soft) 0, transparent 40%),
    radial-gradient(circle at 100% 20%, var(--sky-soft) 0, transparent 35%),
    var(--bg);
  color: var(--ink);
  font: 400 15px/1.7 var(--body);
  padding-inline: 16px;
  min-height: 100%;
}
main, .top, .foot { max-width: 720px; margin-inline: auto; }
main { display: grid; gap: 16px; padding-bottom: 40px; }
h1, h2, h3, legend, .brand-name, .cta, .chip { font-family: var(--round); }
h1, h2, h3 { margin: 0; text-wrap: balance; line-height: 1.35; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.num { font-variant-numeric: tabular-nums; }

.mock-bar {
  max-width: 720px; margin: 12px auto 0; font-size: 0.78rem; color: var(--muted);
  background: var(--paper); border: 1px dashed var(--line); border-radius: 10px; padding: 6px 12px;
}

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.plogo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font: 800 26px/1 var(--round); color: #fff;
  background: conic-gradient(from 200deg, var(--coral), var(--sun), var(--teal), var(--sky), var(--violet), var(--pink), var(--coral));
  box-shadow: var(--shadow);
}
.brand-name { font-weight: 800; font-size: 1.02rem; line-height: 1.35; }
@media (max-width: 420px) { .brand-name { font-size: 0.92rem; } .mypage-btn { padding: 8px 10px; } }
.brand-sub { font-size: 0.8rem; color: var(--muted); }
.beta { font-size: 0.7rem; background: var(--violet); color: #fff; border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }
.mypage-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 14px;
  background: var(--paper); box-shadow: var(--shadow); font-weight: 700; font-size: 0.88rem; white-space: nowrap; flex: none;
}
.mypage-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--violet); stroke-width: 2; }

/* hero */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px 22px;
  background: linear-gradient(120deg, var(--violet) 0%, var(--pink) 45%, var(--sun) 100%);
  color: #fff; box-shadow: var(--shadow);
}
.hero-inner { position: relative; z-index: 1; display: grid; gap: 8px; max-width: 34em; }
.hero h1 { font-size: clamp(1.5rem, 5.5vw, 2.1rem); font-weight: 800; }
.hero p { opacity: 0.95; }
.blob { position: absolute; border-radius: 50%; opacity: 0.35; }
.b1 { width: 180px; height: 180px; background: var(--teal); right: -40px; top: -50px; }
.b2 { width: 90px; height: 90px; background: #fff; right: 90px; bottom: -30px; opacity: 0.25; }
.b3 { width: 60px; height: 60px; background: var(--sky); right: 30px; bottom: 40px; }
@media (prefers-reduced-motion: no-preference) {
  .b1 { animation: float 9s ease-in-out infinite; }
  .b3 { animation: float 7s ease-in-out infinite reverse; }
  @keyframes float { 50% { transform: translate(-10px, 12px); } }
}

.safety {
  display: flex; gap: 8px; align-items: center; font-size: 0.85rem; font-weight: 500;
  background: var(--sun-soft); border-radius: 12px; padding: 8px 12px;
}
.safety svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--sun); stroke-width: 2; }

.events { display: grid; gap: 8px; }
.event {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center;
  background: var(--paper); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow);
  border-left: 6px solid var(--pink);
}
.event .when { font: 800 0.95rem var(--round); color: var(--pink); grid-row: span 2; }
.event b { font-size: 0.92rem; }
.event span { font-size: 0.8rem; color: var(--muted); }

.panel { background: var(--paper); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }

/* form */
.form { display: grid; gap: 18px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
legend { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0; }
.stepno {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--violet); color: #fff; font-size: 0.85rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 0.9rem;
}
.chip[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); }
.time-field { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.time-field input, .mp-grid input, .mp-grid select, .demo-grid input, .demo-grid select {
  border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--bg); color: var(--ink); font-size: 1rem;
}
.dests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .dests { grid-template-columns: repeat(2, 1fr); } }
.dest {
  --c: var(--violet); --cs: var(--violet-soft);
  display: grid; gap: 6px; justify-items: start; text-align: left;
  border: 2px solid transparent; background: var(--cs); border-radius: 16px; padding: 12px;
  transition: transform .15s ease;
}
.dest svg { width: 30px; height: 30px; padding: 5px; border-radius: 10px; background: var(--c); fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dest b { font-family: var(--round); font-size: 0.95rem; }
.dest span { font-size: 0.75rem; color: var(--muted); }
.dest[aria-checked="true"] { border-color: var(--c); background: var(--paper); box-shadow: 0 0 0 4px var(--cs); }
@media (prefers-reduced-motion: no-preference) { .dest:hover { transform: translateY(-2px); } }
.c-violet { --c: var(--violet); --cs: var(--violet-soft); }
.c-coral { --c: var(--coral); --cs: var(--coral-soft); }
.c-teal { --c: var(--teal); --cs: var(--teal-soft); }
.c-sun { --c: var(--sun); --cs: var(--sun-soft); }
.c-pink { --c: var(--pink); --cs: var(--pink-soft); }
.c-sky { --c: var(--sky); --cs: var(--sky-soft); }
.profile-hint { font-size: 0.82rem; color: var(--muted); }
.profile-hint:empty { display: none; }
.cta {
  border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 800; font-size: 1.05rem; color: #fff;
  background: linear-gradient(90deg, var(--violet), var(--pink)); box-shadow: 0 8px 20px -8px var(--pink);
}
.cta.small { padding: 10px 18px; font-size: 0.95rem; }
.ghost { border: 2px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 16px; font-weight: 700; }

/* result */
.result { display: grid; gap: 14px; }
.result-head h2 { font-size: 1.3rem; font-weight: 800; }
.map-wrap { padding: 12px; display: grid; gap: 8px; }
#map { width: 100%; height: auto; display: block; }
#map text { font-family: var(--round); font-weight: 700; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.sw.low { background: var(--low); } .sw.mid { background: var(--mid); } .sw.high { background: var(--high); }
.sw.pick { background: transparent; border: 3px solid var(--violet); }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: pulse 1.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
  @keyframes pulse { 50% { opacity: 0.35; } }
}
.note { background: var(--sky-soft); border-radius: 12px; padding: 8px 12px; font-size: 0.88rem; }

.cards { display: grid; gap: 14px; }
.card {
  --c: var(--coral); --cs: var(--coral-soft);
  background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; display: grid;
}
.card.axis-near { --c: var(--coral); --cs: var(--coral-soft); }
.card.axis-calm { --c: var(--teal); --cs: var(--teal-soft); }
.card.axis-cheap { --c: var(--sun); --cs: var(--sun-soft); }
.card.axis-total { --c: var(--sky); --cs: var(--sky-soft); }
.card-top { background: var(--cs); padding: 14px 16px; display: grid; gap: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { background: var(--c); color: #fff; font: 800 0.78rem var(--round); border-radius: 999px; padding: 2px 10px; }
.card h3 { font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pid { font: 800 0.85rem var(--round); background: var(--paper); color: var(--c); border-radius: 8px; padding: 1px 8px; }
.reason { font-weight: 700; font-size: 0.95rem; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 12px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 460px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { background: var(--bg); border-radius: 12px; padding: 8px 10px; display: grid; gap: 0; }
.metric span { font-size: 0.72rem; color: var(--muted); }
.metric b { font: 800 1.1rem var(--round); font-variant-numeric: tabular-nums; }
.lvl { display: inline-flex; align-items: center; gap: 6px; }
.lvl::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--lc); }
.lvl-low { --lc: var(--low); } .lvl-mid { --lc: var(--mid); } .lvl-high { --lc: var(--high); }
.trend { display: grid; gap: 4px; }
.trend-cap { font-size: 0.75rem; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end; height: 54px; }
.bars i { display: block; border-radius: 4px 4px 1px 1px; background: var(--bc); min-height: 3px; opacity: 0.55; }
.bars i.now { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.bars-x { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; font-size: 0.62rem; color: var(--muted); text-align: center; }
.conf { font-size: 0.75rem; color: var(--muted); }
.feats { display: flex; flex-wrap: wrap; gap: 6px; }
.feat { font-size: 0.72rem; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.pick-btn {
  border: 0; border-radius: 999px; padding: 12px; font: 800 1rem var(--round); color: #fff; background: var(--c);
}
.pick-btn[disabled] { opacity: 0.6; cursor: default; }
.excluded summary { cursor: pointer; font-weight: 700; }
.excluded ul { margin: 8px 0 0; padding-left: 1.2em; font-size: 0.88rem; color: var(--muted); }
.fine { font-size: 0.75rem; color: var(--muted); }

/* guide */
.guide { display: grid; gap: 14px; border: 3px solid var(--violet); }
.guide h2 { font-size: 1.25rem; font-weight: 800; }
.route { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: r; }
.route li { counter-increment: r; display: flex; gap: 10px; align-items: flex-start; }
.route li::before { content: counter(r); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; font: 800 0.8rem var(--round); }
.q { display: grid; gap: 8px; }
.q h3 { font-size: 1rem; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.opt[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); }
.stars { display: flex; gap: 6px; }
.star { width: 44px; height: 44px; border: 0; background: var(--bg); border-radius: 12px; font-size: 1.4rem; line-height: 1; color: var(--line); }
.star.on { color: var(--sun); background: var(--sun-soft); }
.thanks { background: var(--teal-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; }

/* footer */
.foot { padding-block: 8px 32px; font-size: 0.85rem; color: var(--muted); }
.foot summary { cursor: pointer; }
.demo-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.demo-grid label { display: grid; gap: 4px; }

/* mypage sheet */
.sheet {
  border: 0; border-radius: 22px; padding: 20px; width: min(560px, calc(100% - 32px));
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(20, 16, 60, 0.45); }
.sheet form { display: grid; gap: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 1.2rem; font-weight: 800; }
.x { border: 0; background: var(--bg); border-radius: 50%; width: 36px; height: 36px; font-size: 1.2rem; }
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .mp-grid { grid-template-columns: 1fr; } }
.mp-grid label { display: grid; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.mp-grid input, .mp-grid select { width: 100%; }
.toggles { display: grid; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-weight: 500; }
.toggle input { width: 20px; height: 20px; accent-color: var(--violet); }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* facility image + live status */
.facility { margin: 0; padding: 10px; display: grid; gap: 10px; }
.facility img { width: 100%; height: auto; display: block; border-radius: 14px; }
.facility figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; padding-inline: 4px; }
.fc-title { font: 800 1rem var(--round); }
.fc-clock { font-size: 0.85rem; color: var(--muted); }
.fc-clock b { font: 800 1.1rem var(--round); color: var(--violet); }
.live { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 520px) { .live { grid-template-columns: repeat(3, 1fr); } }
.live li { border-radius: 12px; padding: 6px 8px; background: var(--bg); display: grid; gap: 2px; border-top: 4px solid var(--lc); }
.live li span { font-size: 0.72rem; color: var(--muted); }
.live li b { font: 800 1rem var(--round); font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--lc); border-radius: 3px; transition: width .3s ease; }

/* lot type icon on cards */
.card-top { position: relative; }
.lot-art { position: absolute; right: 12px; top: 12px; width: 64px; height: 48px; }
.card-top h3, .card-top .reason { padding-right: 72px; }

/* clock bar */
body { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
.clockbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--paper); box-shadow: 0 -8px 24px -12px rgba(52, 44, 140, 0.35);
  border-top: 4px solid transparent; border-image: linear-gradient(90deg, var(--violet), var(--pink), var(--sun), var(--teal)) 1;
  display: grid; gap: 6px;
}
.cb-row { max-width: 720px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.cb-row.small { gap: 8px; flex-wrap: wrap; }
.cb-play { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--violet), var(--pink)); display: grid; place-items: center; }
.cb-play svg { width: 20px; height: 20px; fill: #fff; }
.cb-time { flex: none; font: 800 1.5rem var(--round); min-width: 4.2ch; color: var(--violet); }
#clock { flex: 1; min-width: 0; accent-color: var(--pink); height: 28px; }
.cb-row select, .cb-now { border: 2px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); padding: 4px 10px; font-size: 0.82rem; font-weight: 700; }
.cb-now { margin-left: auto; }

/* survey status */
.sv-status { font-size: 0.8rem; border-radius: 10px; padding: 6px 10px; background: var(--bg); color: var(--muted); }
.sv-status.ok { background: var(--teal-soft); color: var(--ink); }

/* owner dashboard */
.owner { display: grid; gap: 14px; max-width: 720px; margin: 0 auto 16px; border: 3px solid var(--sun); }
.owner-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.owner h2 { font-size: 1.2rem; font-weight: 800; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.owner h3 { font-size: 0.95rem; margin-bottom: 6px; }
.owner-tag { font: 700 0.72rem var(--body); background: var(--sun-soft); color: var(--ink); border-radius: 999px; padding: 2px 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--bg); border-radius: 12px; padding: 10px; display: grid; gap: 2px; }
.kpi span { font-size: 0.75rem; color: var(--muted); }
.kpi b { font: 800 1.4rem var(--round); font-variant-numeric: tabular-nums; }
.kpi small { font-size: 0.72rem; color: var(--muted); }
.owner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .owner-grid { grid-template-columns: 1fr; } }
.hbar { display: grid; grid-template-columns: 6.5em 1fr 5.5em; gap: 8px; align-items: center; font-size: 0.82rem; margin-bottom: 6px; }
.hbar .track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 5px; background: var(--c, var(--violet)); }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tw { overflow-x: auto; }
#recent { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
#recent th, #recent td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
#recent th { color: var(--muted); font-weight: 700; }
