:root {
  --bg: #f6f3f5; --card: #fff; --ink: #2a2327; --muted: #8f8389; --line: #eee6ea;
  --main: #e2557c; --main2: #f08a6c; --main-soft: #fdeaf0;
  --ok: #17a673; --ok-soft: #e2f6ee; --ng: #e04848; --ng-soft: #fdeaea;
  --tab-h: 62px; --safe-b: env(safe-area-inset-bottom);
  --grad: linear-gradient(135deg, var(--main) 0%, var(--main2) 100%);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:active:not(:disabled) { transform: scale(.97); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  height: 54px; padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.top.hidden-top { display: none; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; margin-left: -8px;
  color: var(--ink); border-radius: 50%; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; background: var(--main-soft);
  color: var(--main); padding: 5px 12px; border-radius: 99px; font-size: 14px; }
.timer.warn { background: var(--ng); color: #fff; }

main { max-width: 600px; margin: 0 auto; padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 24px); }
.splash { height: 70vh; display: grid; place-items: center; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tabbar[hidden] { display: none; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: #b3a8ad; font-size: 10px; font-weight: 700; }
.tabbar button.on { color: var(--main); }
.tabbar button.on svg { stroke-width: 2.4; }

/* hero header in tab pages */
.hero { margin: 0 -16px 16px; padding: 22px 20px 26px; background: var(--grad); color: #fff;
  border-radius: 0 0 26px 26px; }
.hero .greet { font-size: 13px; opacity: .9; margin: 0; }
.hero h2 { font-size: 21px; margin: 4px 0 16px; }
.hero-stats { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex: none;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.28) 0);
  display: grid; place-items: center; }
.ring div { width: 68px; height: 68px; border-radius: 50%; background: var(--main);
  display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 20px; } .ring small { font-size: 9px; opacity: .9; display: block; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; }
.mini div { background: rgba(255,255,255,.18); border-radius: 12px; padding: 8px 10px; }
.mini b { font-size: 17px; display: block; } .mini span { font-size: 10px; opacity: .9; }
.page-title { font-size: 24px; font-weight: 800; margin: 22px 0 14px; }

/* sections & cards */
.sec { font-size: 13px; font-weight: 800; color: var(--muted); margin: 22px 2px 10px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(80,30,50,.05); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action { background: var(--card); border-radius: 18px; padding: 16px; text-align: left;
  box-shadow: 0 2px 10px rgba(80,30,50,.05); display: flex; flex-direction: column; gap: 10px; }
.action .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--main-soft); color: var(--main); }
.action.blue .ic { background: #e6f0fd; color: #3a7bd5; }
.action.green .ic { background: var(--ok-soft); color: var(--ok); }
.action.amber .ic { background: #fff3dc; color: #d68a00; }
.action b { font-size: 15px; } .action small { font-size: 11px; color: var(--muted); }
.action.wide { grid-column: span 2; flex-direction: row; align-items: center; background: var(--grad);
  color: #fff; }
.action.wide .ic { background: rgba(255,255,255,.22); color: #fff; }
.action.wide small { color: rgba(255,255,255,.9); }
.action.wide .txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chev { width: 18px; height: 18px; color: #c9bec3; flex: none; }
.action.wide .chev { color: #fff; }

.rows { background: var(--card); border-radius: 18px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(80,30,50,.05); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left;
  border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .badge-n { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--main-soft);
  color: var(--main); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.row .body { flex: 1; min-width: 0; }
.row .name { font-size: 14px; font-weight: 700; }
.row .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 7px; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 3px; }
.row .pct { font-weight: 800; font-size: 14px; min-width: 40px; text-align: right; }
.row .pct.none { color: #cbbfc5; }
.row:disabled { cursor: default; }
.row:disabled:active { transform: none; }

.seg { display: flex; background: #ebe4e8; border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 9px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.kv { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line);
  font-size: 14px; }
.kv:first-child { border-top: 0; } .kv span { color: var(--muted); }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }
.note { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.6; margin-top: 24px; }

/* buttons */
.btn { display: block; width: 100%; border-radius: 14px; padding: 15px; font-weight: 800; font-size: 15px;
  background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(226,85,124,.28); }
.btn.sub { background: var(--card); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.ghost { background: none; color: var(--muted); box-shadow: none; font-weight: 700; font-size: 13px; }
.btn:disabled { opacity: .4; box-shadow: none; }

/* quiz */
.quiz-top { padding-top: 14px; }
.qhead { display: flex; justify-content: space-between; align-items: center; font-size: 12px;
  color: var(--muted); margin-bottom: 8px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--main-soft);
  color: var(--main); font-size: 11px; font-weight: 700; }
.progress { height: 6px; background: var(--line); border-radius: 3px; margin-bottom: 16px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad); transition: width .3s; }
.qcard { background: var(--card); border-radius: 18px; padding: 18px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(80,30,50,.05); }
.qno { font-size: 12px; font-weight: 800; color: var(--main); margin-bottom: 6px; }
.qtext { font-size: 16px; line-height: 1.8; white-space: pre-wrap; margin: 0; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--card); border: 2px solid transparent; border-radius: 16px; padding: 14px;
  line-height: 1.6; font-size: 15px; box-shadow: 0 2px 8px rgba(80,30,50,.05); transition: background .15s; }
.choice .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #f1ecef;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--muted); }
.choice.sel { border-color: var(--main); background: var(--main-soft); }
.choice.sel .num { background: var(--main); color: #fff; }
.choice.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice.ok .num { background: var(--ok); color: #fff; }
.choice.ng { border-color: var(--ng); background: var(--ng-soft); }
.choice.ng .num { background: var(--ng); color: #fff; }
.choice.dim { opacity: .55; }
.choice:disabled { cursor: default; }
.choice:disabled:active { transform: none; }
.figure-note { font-size: 12px; color: #9a6a00; background: #fff4d6; padding: 8px 12px;
  border-radius: 10px; margin-bottom: 12px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; background: var(--card);
  border-radius: 24px 24px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.12);
  padding: 20px 18px calc(14px + var(--safe-b)); max-height: 62vh; overflow: auto;
  animation: up .25s ease-out; }
.sheet .inner { max-width: 600px; margin: 0 auto; }
@keyframes up { from { transform: translateY(100%); } }
.verdict { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 900; margin-bottom: 10px; }
.verdict .mk { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.verdict.ok { color: var(--ok); } .verdict.ok .mk { background: var(--ok); }
.verdict.ng { color: var(--ng); } .verdict.ng .mk { background: var(--ng); }
.verdict .mk svg { stroke-width: 3; }
.expl { background: #faf7f8; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.8;
  margin-bottom: 14px; }
.expl b { display: block; font-size: 11px; color: var(--main); margin-bottom: 2px; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: rgba(246,243,245,.96);
  backdrop-filter: blur(10px); padding: 10px 16px calc(10px + var(--safe-b)); }
.bottom .inner { max-width: 600px; margin: 0 auto; display: flex; gap: 10px; }
.bottom .btn { white-space: nowrap; }
.bottom .btn.sub { flex: 0 0 78px; padding: 15px 0; }
.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin: 16px 0; }
.grid button { aspect-ratio: 1; background: var(--card); border-radius: 8px; font-size: 11px;
  font-weight: 700; color: var(--muted); }
.grid button.done { background: var(--main-soft); color: var(--main); }
.grid button.cur { outline: 2px solid var(--main); }

/* result */
.result-hero { text-align: center; padding: 28px 16px 30px; margin: 0 -16px 16px; background: var(--grad);
  color: #fff; border-radius: 0 0 26px 26px; }
.result-hero .big { font-size: 54px; font-weight: 900; line-height: 1.1; }
.result-hero .big small { font-size: 20px; opacity: .85; }
.pill { display: inline-block; margin-top: 10px; padding: 6px 18px; border-radius: 99px; font-weight: 900;
  background: #fff; }
.pill.ok { color: var(--ok); } .pill.ng { color: var(--ng); }
.result-hero .crit { font-size: 11px; opacity: .85; margin-top: 10px; }
.review { border-top: 1px solid var(--line); padding: 12px 0; }
.review:first-child { border-top: 0; }
.review summary { cursor: pointer; font-size: 13px; line-height: 1.6; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review .mark { font-weight: 900; margin-right: 6px; }
.review .mark.ok { color: var(--ok); } .review .mark.ng { color: var(--ng); }
.review ol { padding-left: 22px; font-size: 13px; line-height: 1.7; }
.review li.ans { color: var(--ok); font-weight: 800; }
.review li.mine { color: var(--ng); text-decoration: line-through; }

/* forms: login & survey */
.welcome { min-height: 100vh; margin: 0 -16px; padding: 64px 24px 40px; background: var(--grad); color: #fff;
  display: flex; flex-direction: column; }
.welcome .logo { width: 76px; height: 76px; border-radius: 22px; background: #fff; color: var(--main);
  display: grid; place-items: center; margin-bottom: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.welcome .logo svg { width: 40px; height: 40px; }
.welcome h2 { font-size: 26px; margin: 0 0 8px; line-height: 1.35; }
.welcome p { font-size: 13px; opacity: .92; margin: 0 0 28px; line-height: 1.7; }
.welcome .panel { margin-top: auto; background: #fff; color: var(--ink); border-radius: 22px; padding: 20px; }
.welcome .btn { background: var(--ink); box-shadow: none; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.field label em { color: var(--main); font-style: normal; margin-left: 4px; }
.input { width: 100%; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px;
  background: #fff; color: var(--ink); font-family: inherit; -webkit-appearance: none; appearance: none; }
.input:focus { outline: none; border-color: var(--main); }
.dob { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.dob .sel { display: flex; align-items: center; gap: 4px; }
.dob .sel span { font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.dob select { padding: 13px 22px 13px 10px; min-width: 0; text-align: center;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8389' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center / 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { padding: 10px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 700; }
.opt.on { border-color: var(--main); background: var(--main-soft); color: var(--main); }
.opts.two .opt { flex: 1; text-align: center; }
.err { color: var(--ng); font-size: 13px; min-height: 1.4em; margin: 4px 0 8px; }
.survey-head { margin: 0 -16px 20px; padding: 28px 20px 24px; background: var(--grad); color: #fff;
  border-radius: 0 0 26px 26px; }
.survey-head .step { font-size: 11px; font-weight: 800; opacity: .9; letter-spacing: .1em; }
.survey-head h2 { margin: 6px 0 6px; font-size: 22px; }
.survey-head p { margin: 0; font-size: 12px; opacity: .92; line-height: 1.6; }

/* LINE連携 */
:root { --line-green: #06c755; }
.line-ic { fill: currentColor; stroke: none; }
.link-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 0 0 14px;
  padding: 14px 16px; border-radius: 18px; background: #e9f9ef; border: 1.5px solid #bfeccf; }
.link-card .ic { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--line-green);
  color: #fff; display: grid; place-items: center; }
.link-card .txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.link-card b { font-size: 15px; color: #078a3d; } .link-card small { font-size: 11px; color: #4d7a5d; }
.link-card .chev { color: #7cc79a; }
.link-hero { text-align: center; padding: 24px 8px 18px; }
.line-badge { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; background: var(--line-green);
  color: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(6,199,85,.3); }
.line-badge svg { width: 42px; height: 42px; }
.link-hero h2 { font-size: 20px; margin: 0 0 6px; } .link-hero p { font-size: 13px; color: var(--muted); margin: 0; }
.perks .badge-n { background: #e9f9ef; color: #078a3d; }
.perks .badge-n svg { width: 20px; height: 20px; }
.btn.line { background: var(--line-green); box-shadow: 0 4px 14px rgba(6,199,85,.3); display: flex;
  align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.card .btn.line { margin-top: 4px; }
.btn.line svg { width: 22px; height: 22px; }
.avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.line-chip { display: inline-flex; align-items: center; gap: 4px; background: #e9f9ef; color: #078a3d; flex: none; }
.line-chip svg { width: 14px; height: 14px; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: #ddd3d8; position: relative; flex: none;
  transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--line-green); } .switch.on i { transform: translateX(20px); }
.mini-sel { width: auto; padding: 8px 12px; font-size: 15px; }
.mini-sel:disabled { opacity: .4; }

/* ranking */
.chips { display: flex; gap: 8px; margin-bottom: 12px; }
.chips button { padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--card);
  color: var(--muted); border: 1.5px solid var(--line); }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.caption { font-size: 11px; color: var(--muted); margin: 0 2px 10px; }
.my-rank { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1px; background: rgba(255,255,255,.3);
  border-radius: 18px; overflow: hidden; margin-bottom: 14px; color: #fff; }
.my-rank > div { background: var(--grad); padding: 14px 16px; background-attachment: fixed; }
.my-rank small { display: block; font-size: 11px; opacity: .9; }
.my-rank b { font-size: 28px; font-weight: 900; } .my-rank b span { font-size: 13px; font-weight: 700; margin-left: 2px; }
.mini-link { margin-top: 4px; padding: 0; color: #fff; font-weight: 800; font-size: 13px; text-decoration: underline; }
.medal { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; background: #f1ecef; color: var(--muted); }
.medal.m1 { background: linear-gradient(135deg, #ffd65a, #f2a500); color: #fff; }
.medal.m2 { background: linear-gradient(135deg, #dfe3e8, #a9b1bb); color: #fff; }
.medal.m3 { background: linear-gradient(135deg, #f0b27a, #c4733a); color: #fff; }
.rank-row { padding: 11px 16px; }
.rank-row.me { background: var(--main-soft); }
.rank-row .pct small { font-size: 11px; color: var(--muted); margin-left: 1px; }
.you { font-size: 10px; font-weight: 800; color: #fff; background: var(--main); border-radius: 99px;
  padding: 2px 7px; margin-left: 6px; vertical-align: 2px; }
.lock { text-align: center; padding: 26px 16px 8px; }
.lock-ic { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 16px; background: #f1ecef; color: var(--muted);
  display: grid; place-items: center; }
.lock b { font-size: 15px; } .lock p { font-size: 12px; color: var(--muted); margin: 6px 0 16px; line-height: 1.6; }
.lock .link-card { margin-bottom: 8px; }

/* dialog */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: rgba(30,20,26,.45); animation: fade .18s ease-out; }
.modal.out { animation: fadeout .16s ease-in forwards; }
.modal-card { width: 100%; max-width: 340px; background: var(--card); border-radius: 24px;
  padding: 26px 20px 18px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.2);
  animation: pop .22s cubic-bezier(.2,1.3,.4,1); }
.modal.out .modal-card { animation: none; }
.modal-ic { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid;
  place-items: center; background: var(--main-soft); color: var(--main); }
.modal-ic.danger { background: var(--ng-soft); color: var(--ng); }
.modal-ic svg { width: 28px; height: 28px; }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns .btn { padding: 13px 8px; white-space: nowrap; }
.btn.danger { background: var(--ng); box-shadow: 0 4px 14px rgba(224,72,72,.28); }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.loading { position: fixed; inset: 0; background: rgba(255,255,255,.45); display: grid; place-items: center; z-index: 30; }
.loading[hidden] { display: none; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--main-soft); border-top-color: var(--main);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  z-index: 40; background: rgba(42,35,39,.92); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 99px;
  white-space: nowrap; }
.toast[hidden] { display: none; }
