/* ミミレゾ — 試験信号（カラーバー）と方眼紙の研究室 */
:root {
  --paper: #eeece6;
  --sheet: #fbfaf6;
  --ink: #15151a;
  --dim: #5f5d64;
  --faint: rgba(21, 21, 26, .12);
  --y: #f2c230; --c: #2bb6d9; --g: #3dbe6a; --m: #d9418f; --r: #e5483b; --b: #3150c9;
  --pix: 'DotGothic16', 'BIZ UDPGothic', monospace;
  --body: 'BIZ UDPGothic', 'Hiragino Sans', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --sh: 4px 4px 0 var(--ink);
  --sh-lg: 7px 7px 0 var(--ink);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.8;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.dim { color: var(--dim); }
.tiny { font-size: 12.5px; color: var(--dim); line-height: 1.7; }
strong, b { font-weight: 700; }
strong { background: linear-gradient(transparent 62%, rgba(242, 194, 48, .55) 62%); }

/* 背景とモザイク */
#field { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; image-rendering: pixelated; }
#wipe { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; display: none; pointer-events: none; }
.bars { position: fixed; top: 0; left: 0; right: 0; height: 6px; display: flex; z-index: 40; }
.bars i { flex: 1; }
.bars i:nth-child(1) { background: #c9c6bd; } .bars i:nth-child(2) { background: var(--y); }
.bars i:nth-child(3) { background: var(--c); } .bars i:nth-child(4) { background: var(--g); }
.bars i:nth-child(5) { background: var(--m); } .bars i:nth-child(6) { background: var(--r); }
.bars i:nth-child(7) { background: var(--b); }

main { position: relative; z-index: 2; max-width: 600px; margin: 0 auto; padding: 34px 18px 40px; }
.screen { animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* カード */
.card {
  background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px;
  box-shadow: var(--sh); padding: 18px 18px; margin: 18px 0; position: relative;
}

/* ボタン */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 58px; padding: 12px 18px; cursor: pointer; text-decoration: none;
  background: var(--sheet); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px;
  box-shadow: var(--sh); font-weight: 700; font-size: 17px; position: relative; overflow: hidden;
  transition: transform .08s, box-shadow .08s, background .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active, .btn.pressed { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .38; cursor: default; transform: none; box-shadow: 2px 2px 0 var(--ink); }
.btn-main { background: var(--ink); color: var(--paper); font-family: var(--pix); font-weight: 400; font-size: 21px; margin-top: 22px; justify-content: space-between; box-shadow: 5px 5px 0 var(--m); }
.btn-main:hover { box-shadow: 7px 7px 0 var(--m); }
.btn-main:active { box-shadow: 1px 1px 0 var(--m); }
.btn-main i { font-style: normal; font-size: 12px; color: var(--y); }
.btn-sub { font-size: 15px; min-height: 50px; }
.ripple { position: absolute; border-radius: 0; pointer-events: none; background: currentColor; opacity: .18; animation: rip .5s steps(6) forwards; }
@keyframes rip { from { transform: scale(0); } to { transform: scale(1); opacity: 0; } }
.link { background: none; border: 0; text-decoration: underline; color: var(--dim); cursor: pointer; display: block; margin: 12px auto 0; font-size: 14px; }
.link:disabled { opacity: .35; cursor: default; }

/* はじめ */
.kicker { font-size: 11px; color: var(--dim); margin: 0 0 6px; }
.blink { color: var(--r); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.title { font-family: var(--pix); font-weight: 400; line-height: 1.02; margin: 0; letter-spacing: -.01em; }
.title span { display: block; }
.title .t1 { font-size: clamp(30px, 8vw, 44px); }
.title .t2 {
  font-size: clamp(76px, 23vw, 132px); line-height: .95;
  background: linear-gradient(90deg, var(--ink) 0 100%); -webkit-background-clip: text; background-clip: text;
  text-shadow: 4px 4px 0 var(--y), 8px 8px 0 var(--m);
  animation: chroma 4s steps(1) infinite;
}
@keyframes chroma {
  0%, 92% { text-shadow: 4px 4px 0 var(--y), 8px 8px 0 var(--m); }
  93% { text-shadow: -5px 2px 0 var(--c), 6px -2px 0 var(--r); }
  95% { text-shadow: 3px 0 0 var(--g), -3px 3px 0 var(--b); }
  97% { text-shadow: 4px 4px 0 var(--y), 8px 8px 0 var(--m); }
}
.title .t3 { font-size: clamp(30px, 8vw, 44px); text-align: right; }
.hook { font-family: var(--pix); font-size: 22px; margin: 14px 0 0; }
.hook span { background: var(--ink); color: var(--paper); padding: 2px 10px; }
.lead { margin: 18px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 0; list-style: none; }
.chips li { border: 1.5px solid var(--ink); padding: 1px 10px; font-size: 13px; background: var(--sheet); }
.notice-h { font-family: var(--pix); margin: 0 0 4px; font-size: 18px; }
.notice ol { margin: 0 0 8px; padding-left: 1.3em; }
.notice li { margin: 2px 0; }

.ladder { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 26px 0 6px; }
.ladder figure { margin: 0; text-align: center; }
.ladder canvas { width: 100%; aspect-ratio: 1; display: block; border: 1.5px solid var(--ink); image-rendering: pixelated; background: var(--sheet); }
.ladder figcaption { font-family: var(--pix); font-size: 10.5px; margin-top: 3px; white-space: nowrap; }
.ladder figure.on canvas { outline: 3px solid var(--m); outline-offset: 1px; }

.vs-banner { margin: 18px 0 0; padding: 12px 14px; background: var(--y); border: 2px solid var(--ink); box-shadow: var(--sh); font-weight: 700; }
.vs-banner small { display: block; font-weight: 400; font-size: 13px; }

.history { margin-top: 26px; }
.history-h { font-family: var(--pix); margin: 0; }
.history ol { list-style: none; padding: 0; margin: 6px 0 0; }
.history li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--faint); padding: 6px 0; font-size: 14px; }
.history li b { font-family: var(--pix); font-weight: 400; }

/* 見出しなど */
.step-tag { display: inline-block; font-size: 12px; background: var(--ink); color: var(--paper); padding: 1px 8px; margin: 0; }
.h2 { font-family: var(--pix); font-weight: 400; font-size: clamp(28px, 8vw, 40px); line-height: 1.2; margin: 10px 0 14px; }
.q-sub { font-weight: 700; margin: 6px 0; }

/* HUD */
#hud { position: sticky; top: 6px; z-index: 30; background: rgba(238, 236, 230, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 2px solid var(--ink); }
.hud-in { max-width: 600px; margin: 0 auto; padding: 8px 18px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 4px 14px; align-items: center; }
.hud-brand { font-family: var(--pix); font-size: 14px; }
.hud-steps { grid-column: 1 / -1; grid-row: 2; list-style: none; display: flex; gap: 3px; padding: 0; margin: 0; }
.hud-steps li { flex: 1; height: 7px; background: var(--faint); position: relative; }
.hud-steps li.done { background: var(--ink); }
.hud-steps li.now { background: repeating-linear-gradient(90deg, var(--m) 0 4px, transparent 4px 7px); animation: march .6s steps(7) infinite; }
@keyframes march { to { background-position: 7px 0; } }
.hud-meter { justify-self: end; text-align: right; line-height: 1.1; }
.hud-label { display: block; font-size: 10px; color: var(--dim); }
.hud-val { font-family: var(--pix); font-size: 20px; }
.hud-val b { font-weight: 400; }
.hud-val small { font-size: 11px; margin-left: 2px; }
.hud-val em { font-style: normal; font-size: 12px; background: var(--ink); color: var(--paper); padding: 0 5px; margin-left: 4px; vertical-align: 3px; }
.hud-val.bump { animation: bump .35s; }
@keyframes bump { 30% { transform: scale(1.12); color: var(--m); } }

/* 準備 */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { border: 2px solid var(--ink); background: var(--sheet); padding: 12px 4px; font-weight: 700; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); border-radius: 4px; }
.seg button.on { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--c); }
.vol { text-align: center; }
.vol-viz { display: flex; gap: 4px; justify-content: center; align-items: flex-end; height: 56px; margin-bottom: 8px; }
.vol-viz i { width: 12px; height: 8px; background: var(--ink); transition: height .08s steps(3); }

/* 質問 */
.q-head { display: flex; align-items: center; gap: 10px; }
.q-cat { font-size: 12px; border: 1.5px solid var(--ink); padding: 0 8px; }
.q-text { font-size: clamp(21px, 5.6vw, 26px); line-height: 1.55; margin: 18px 0 22px; min-height: 4.6em; font-weight: 700; }
.answers { display: grid; gap: 10px; }
.answers .btn { justify-content: flex-start; font-weight: 700; min-height: 56px; }
.answers .btn .n { font-family: var(--mono); font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border: 1.5px solid currentColor; flex: none; }
.answers .btn .bar { margin-left: auto; display: flex; gap: 2px; }
.answers .btn .bar i { width: 7px; height: 14px; background: var(--faint); }
.answers .btn .bar i.f { background: var(--ink); }
.answers .btn.picked { background: var(--ink); color: var(--paper); }
.answers .btn.picked .bar i.f { background: var(--y); }
.keys-hint { text-align: center; margin-top: 16px; }
@media (hover: none) { .keys-hint { display: none; } }

/* 2択 */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.duo .btn { min-height: 76px; font-size: 19px; flex-direction: column; gap: 0; line-height: 1.2; }
.btn-yes { background: var(--g); }
.btn-no { background: var(--sheet); }
.btn-low { background: var(--c); }
.btn-high { background: var(--y); }
.btn-bright { background: var(--y); }
.btn-dark { background: var(--b); color: #fff; }
.arr { font-family: var(--mono); font-size: 26px; }
.duo .btn.right { animation: right .45s; }
.duo .btn.wrong { animation: wrong .4s; }
@keyframes right { 40% { transform: scale(1.04); box-shadow: 0 0 0 6px var(--g); } }
@keyframes wrong { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.toast { min-height: 1.6em; text-align: center; font-size: 14px; margin: 10px 0 0; }
.toast.show { animation: toast 2.2s forwards; }
@keyframes toast { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* TEST 1 */
.hi-wrap { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: stretch; }
.hi-tower { position: relative; height: 290px; border: 2px solid var(--ink); background: var(--sheet); box-shadow: var(--sh); overflow: hidden; }
.hi-tower .seg-f { position: absolute; left: 0; right: 0; border-top: 1px solid var(--faint); font-family: var(--mono); font-size: 10px; padding-left: 4px; color: var(--dim); }
.hi-tower .fill { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(0deg, var(--g) 0 6px, transparent 6px 8px); transition: height .5s steps(8); opacity: .8; }
.hi-tower .cur { position: absolute; left: 0; right: 0; height: 4px; background: var(--m); transition: bottom .5s cubic-bezier(.2, .9, .3, 1.3); }
.hi-tower .cur::after { content: '◀'; position: absolute; right: 4px; top: -9px; font-size: 12px; color: var(--m); }
.hi-read { display: flex; flex-direction: column; justify-content: center; }
.hi-read p { margin: 0; }
.hi-hz { font-family: var(--pix); line-height: 1; margin: 4px 0 10px !important; }
.hi-hz b { font-weight: 400; font-size: clamp(46px, 14vw, 72px); }
.hi-hz small { font-size: 18px; margin-left: 4px; }
.hi-status { font-weight: 700; }
.hi-status.playing::before { content: '◉ '; color: var(--r); animation: blink .5s steps(2) infinite; }
.hi-age { font-size: 13px; color: var(--dim); }

/* TEST 2 */
.trial { text-align: right; margin: 0; font-size: 13px; }
.p-viz { width: 100%; height: auto; display: block; background: var(--sheet); border: 2px solid var(--ink); box-shadow: var(--sh); margin-top: 6px; }
.p-diff { text-align: center; margin: 14px 0 0; }
.p-diff b { font-family: var(--pix); font-weight: 400; font-size: 22px; }

/* TEST 3 */
.c-wheel { display: block; width: min(260px, 70vw); margin: 4px auto 0; }
.c-name { text-align: center; font-family: var(--pix); font-size: 22px; margin: 6px 0 0; min-height: 1.4em; }

/* TEST 4 */
.pads { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 18px; }
.pad { aspect-ratio: .62; border: 2px solid var(--ink); border-radius: 4px; box-shadow: var(--sh); cursor: pointer; position: relative; background: var(--sheet); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; font-family: var(--pix); font-size: 18px; touch-action: manipulation; transition: transform .06s, box-shadow .06s; }
.pad::before { content: ''; position: absolute; left: 10%; right: 10%; top: 10%; height: var(--h, 40%); background: var(--col); opacity: .9; }
.pad.hit { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); background: var(--col); }
.pad.hit::before { opacity: 0; }
.pad:disabled { cursor: default; }
.pads-demo { margin: 14px 0 6px; }
.pads-demo .pad { aspect-ratio: 1; font-size: 14px; }
.m-head { display: flex; justify-content: space-between; align-items: center; }
.m-head p { margin: 0; font-size: 22px; }
.m-head .mono { font-family: var(--pix); }
.m-lives { color: var(--r); letter-spacing: .1em; }
.m-status { text-align: center; font-weight: 700; margin: 12px 0 4px; min-height: 1.6em; }
.m-dots { display: flex; gap: 6px; justify-content: center; min-height: 18px; flex-wrap: wrap; }
.m-dots i { width: 14px; height: 14px; border: 2px solid var(--ink); }
.m-dots i.f { background: var(--ink); }
.m-dots i.x { background: var(--r); }

/* 解析中 */
.calc-log { list-style: none; padding: 0; margin: 0 0 14px; font-size: 13px; min-height: 9em; }
.calc-log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-log li::before { content: '> '; color: var(--m); }
.calc-log li.ok::after { content: ' ✔'; color: var(--g); }
.calc-bar { height: 16px; border: 2px solid var(--ink); background: var(--sheet); }
.calc-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 10px); transition: width .25s steps(5); }

/* 結果 */
.r-hero { text-align: center; padding-top: 22px; overflow: hidden; }
.r-kicker { font-size: 11px; color: var(--dim); margin: 0; }
.r-label { margin: 4px 0 0; font-weight: 700; }
.r-tier { font-family: var(--pix); font-size: clamp(92px, 30vw, 168px); line-height: 1; margin: 4px 0 0; text-shadow: 5px 5px 0 var(--tc, var(--m)); }
.r-tier.long { font-size: clamp(62px, 19vw, 110px); }
.r-px { font-family: var(--pix); font-size: 22px; margin: 6px 0 0; }
.r-px b { font-weight: 400; font-size: 34px; }
.r-px small { font-size: 14px; margin-left: 2px; }
.r-px .sep { margin: 0 8px; color: var(--dim); }
.r-top { margin: 4px 0 0; }
.r-top b { font-family: var(--pix); font-weight: 400; font-size: 24px; background: var(--ink); color: var(--paper); padding: 0 8px; }
.r-top small { font-size: 13px; }
.r-print-wrap { position: relative; margin: 18px auto 6px; width: min(360px, 82vw); }
#r-print { width: 100%; aspect-ratio: 1; display: block; border: 2px solid var(--ink); background: #f7f5ef; }
.r-print-cap { display: block; font-size: 11.5px; color: var(--dim); margin-top: 6px; }
.r-prefix { font-weight: 700; margin: 16px 0 0; font-size: 15px; }
.r-type { font-family: var(--pix); font-weight: 400; font-size: clamp(26px, 7.4vw, 44px); text-wrap: balance; line-height: 1.15; margin: 2px 0 0; }
.r-en { font-size: 11px; color: var(--dim); margin: 2px 0 0; }
.r-catch { font-weight: 700; margin: 10px 0 0; }
.sec-h { font-family: var(--pix); font-size: 20px; margin: 0 0 8px; }
.sub-h { font-weight: 700; margin: 14px 0 4px; font-size: 14px; border-left: 6px solid var(--m); padding-left: 8px; line-height: 1.3; }

.stat { padding: 12px 0; border-bottom: 1.5px dashed var(--faint); }
.stat:last-child { border-bottom: 0; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat-name { font-weight: 700; font-size: 14px; }
.stat-val { font-family: var(--pix); font-size: 24px; white-space: nowrap; }
.stat-val small { font-size: 13px; margin-left: 2px; }
.stat-bar { position: relative; height: 14px; border: 1.5px solid var(--ink); margin: 6px 0 4px; background: var(--sheet); }
.stat-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--col, var(--ink)); transition: width 1.2s steps(14); }
.stat-bar u { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.stat-bar u::after { content: 'ふつう'; position: absolute; top: -15px; left: -14px; font-size: 9px; white-space: nowrap; text-decoration: none; color: var(--dim); }
.stat-note { font-size: 13px; color: var(--dim); margin: 0; }
.stat-note b { color: var(--ink); }

#r-radar { display: block; width: 100%; max-width: 380px; margin: 0 auto; }
#r-radar .poly { transform-origin: 0 0; animation: grow 1s cubic-bezier(.2, .9, .3, 1.3) both; }
#r-radar .poly.b { animation-delay: .25s; }
@keyframes grow { from { transform: scale(0) rotate(-40deg); } }
.legend { text-align: center; font-size: 13px; margin: 6px 0 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--ink); vertical-align: -1px; margin: 0 4px 0 10px; }

.aru { margin: 0; padding-left: 1.2em; }
.aru li { margin: 3px 0; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.r-two p:not(.sub-h) { margin: 0; font-size: 14.5px; }

.r-vs { background: var(--y); }
.vs-big { font-family: var(--pix); font-size: 54px; line-height: 1; margin: 4px 0; text-align: center; }
.vs-big small { font-size: 20px; }
.vs-row { display: grid; grid-template-columns: 4.5em 1fr 1fr; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.vs-row .w { font-family: var(--pix); font-size: 15px; text-align: center; padding: 2px 0; border: 1.5px solid var(--ink); background: var(--sheet); }
.vs-row .w.win { background: var(--ink); color: var(--y); }
.vs-head { display: grid; grid-template-columns: 4.5em 1fr 1fr; gap: 8px; font-weight: 700; font-size: 12px; text-align: center; }

.share-img { width: 100%; display: block; border: 2px solid var(--ink); margin: 10px 0 4px; background: var(--paper); aspect-ratio: 1200 / 630; }
.share-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share-btns .btn-x { grid-column: 1 / -1; background: var(--ink); color: #fff; box-shadow: 4px 4px 0 var(--c); }
.btn-ofuse { background: var(--m); color: #fff; margin-top: 8px; }
.r-ofuse p { margin: 0 0 6px; font-size: 14.5px; }
.ad { margin: 18px 0; min-height: 100px; }

.foot { position: relative; z-index: 2; display: flex; justify-content: center; gap: 16px; padding: 20px 18px 40px; font-size: 12px; color: var(--dim); }
.foot a { color: var(--dim); }

@media (min-width: 900px) {
  main { padding-top: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
