:root{
  --nt:#88619a; --nf:#33a474; --sj:#4298b4; --sp:#e4ae3a;
  --pink:#ff5c8a; --ink:#23222b; --muted:#6b6875; --bg:#f7f5fb; --card:#fff; --line:#e7e2f0;
}
*{box-sizing:border-box}
body{margin:0;font-family:"Hiragino Kaku Gothic ProN","Hiragino Sans","Noto Sans JP",system-ui,sans-serif;background:var(--bg);color:var(--ink);line-height:1.6}
.wrap{max-width:760px;margin:0 auto;padding:0 14px}
.hidden{display:none!important}
.note{font-size:.82rem;color:var(--muted)}
.row{display:flex;align-items:center;margin:12px 0;flex-wrap:wrap}
.row.gap{gap:10px}
select{padding:8px;border:1px solid var(--line);border-radius:8px;font-size:1rem}

/* header */
.site-header{background:#2b2440;color:#fff;position:sticky;top:0;z-index:20}
.header-inner{display:flex;align-items:center;gap:10px;padding:10px 14px;flex-wrap:wrap}
.logo{color:#fff;font-weight:900;font-size:1.4rem;text-decoration:none;letter-spacing:.02em}
.logo-sub{font-size:.78rem;opacity:.85}
.main-nav{margin-left:auto;display:flex;gap:4px;flex-wrap:wrap}
.nav-btn{background:transparent;border:1px solid rgba(255,255,255,.35);color:#fff;border-radius:999px;padding:5px 11px;font-size:.82rem;cursor:pointer}
.nav-btn.active{background:var(--pink);border-color:var(--pink);font-weight:700}

/* views */
.view{display:none;padding:18px 0 8px}
.view.active{display:block}
.hero h1{font-size:1.55rem;line-height:1.35;margin:.2em 0}
.hero p{color:var(--muted)}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:18px;margin:16px 0;box-shadow:0 2px 10px rgba(60,40,110,.06)}

/* MBTI buttons */
.mbti-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0}
@media(max-width:560px){.mbti-grid{grid-template-columns:repeat(4,1fr);gap:6px}}
.mbti-btn{background:#fff;border:2px solid var(--line);border-radius:14px;padding:8px 2px 6px;cursor:pointer;text-align:center;transition:.15s}
.mbti-btn img{width:52px;height:52px;object-fit:contain;display:block;margin:0 auto 2px}
.mbti-btn .code{display:block;font-weight:800;font-size:.95rem}
.mbti-btn .nick{display:block;font-size:.7rem;color:var(--muted)}
.mbti-btn.selected{border-color:var(--pink);background:#fff0f4;transform:scale(1.04);box-shadow:0 4px 14px rgba(255,92,138,.25)}
.mbti-btn[data-group="NT"]{border-top:5px solid var(--nt)}
.mbti-btn[data-group="NF"]{border-top:5px solid var(--nf)}
.mbti-btn[data-group="SJ"]{border-top:5px solid var(--sj)}
.mbti-btn[data-group="SP"]{border-top:5px solid var(--sp)}
.mbti-btn.selected[data-group]{border-top-width:5px}

/* buttons */
.primary-btn{background:var(--pink);color:#fff;border:none;border-radius:999px;padding:13px 22px;font-size:1rem;font-weight:800;cursor:pointer;width:100%}
.primary-btn:disabled{background:#c9c4d4;cursor:not-allowed}
.ghost-btn{background:#fff;border:2px solid var(--line);border-radius:999px;padding:11px 18px;font-weight:700;cursor:pointer}
.ghost-btn.small{padding:6px 12px;font-size:.85rem}

/* diagnosis play */
.play-head{display:flex;justify-content:space-between;font-weight:700}
.timer-bar{height:10px;background:#eee;border-radius:99px;overflow:hidden;margin:10px 0}
#timer-fill{height:100%;width:100%;background:linear-gradient(90deg,#ffb347,var(--pink));transition:width .1s linear}
.face-img{display:block;width:min(300px,80vw);height:auto;margin:10px auto;border-radius:18px;background:#fdf6ec}
.play-q{text-align:center;font-weight:800;font-size:1.15rem}
.judge-row{display:flex;gap:12px}
.judge{flex:1;padding:16px;border-radius:16px;border:none;font-size:1.2rem;font-weight:900;cursor:pointer;color:#fff}
.judge.nashi{background:#8d99ae}
.judge.ari{background:var(--pink)}
.halfway{background:#fff7e0;border:1px solid #f0d48a;padding:8px 12px;border-radius:10px;text-align:center;font-weight:700}

/* result */
.result-type{font-size:1.5rem;color:#b03060;margin:.2em 0}
.axis-row{margin:10px 0}
.axis-row .labels{display:flex;justify-content:space-between;font-size:.85rem;font-weight:700}
.axis-bar{height:12px;background:#eee;border-radius:99px;overflow:hidden}
.axis-bar>div{height:100%;background:linear-gradient(90deg,#7b6fd6,var(--pink))}
.liked-faces{display:flex;flex-wrap:wrap;gap:6px}
.liked-faces img{width:56px;height:56px;border-radius:10px;background:#fdf6ec}

/* stats */
.stat-card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;margin:12px 0}
.stat-head{display:flex;align-items:center;gap:10px}
.stat-head img{width:44px;height:44px}
.stat-bar-row{display:flex;align-items:center;gap:8px;font-size:.88rem;margin:6px 0}
.stat-bar-row .lbl{width:11em;flex-shrink:0}
.stat-bar{flex:1;height:10px;background:#eee;border-radius:99px;overflow:hidden}
.stat-bar>div{height:100%;background:#7b6fd6}

/* vote */
.vote-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
@media(max-width:560px){.vote-grid{grid-template-columns:repeat(3,1fr)}}
.vote-cell{background:#fff;border:2px solid var(--line);border-radius:12px;padding:6px;cursor:pointer;text-align:center;font-size:.78rem}
.vote-cell img{width:100%;height:auto;border-radius:8px;background:#fdf6ec}
.dist-row{display:flex;align-items:center;gap:8px;font-size:.88rem;margin:5px 0}
.dist-row img{width:26px;height:26px}
.dist-row .lbl{width:4.2em;font-weight:700}
.dist-bar{flex:1;height:10px;background:#eee;border-radius:99px;overflow:hidden}
.dist-bar>div{height:100%;background:var(--nf)}

/* comments */
.comment-zone{margin-top:22px;border-top:1px dashed var(--line);padding-top:14px}
.cform{display:flex;flex-direction:column;gap:8px;margin-bottom:14px}
.cform input,.cform textarea,.cform select{padding:9px;border:1px solid var(--line);border-radius:10px;font-size:.95rem;font-family:inherit}
.cform button{align-self:flex-start;background:#2b2440;color:#fff;border:none;border-radius:999px;padding:8px 18px;font-weight:700;cursor:pointer}
.comment{border-left:3px solid var(--line);padding:6px 0 6px 10px;margin:8px 0}
.comment .chead{display:flex;align-items:center;gap:7px;font-size:.85rem}
.comment .chead img{width:26px;height:26px;border-radius:50%;background:#f0ecf7}
.comment .cname{font-weight:800}
.comment .ctime{color:var(--muted);font-size:.75rem}
.comment .cbody{margin:4px 0;white-space:pre-wrap;word-break:break-word}
.comment .cactions{display:flex;gap:12px;font-size:.8rem}
.comment .cactions button{background:none;border:none;color:var(--muted);cursor:pointer;padding:0;font-size:.8rem}
.comment .children{margin-left:14px}
.like-on{color:var(--pink)!important;font-weight:800}

.site-footer{background:#2b2440;color:#cfc9dd;margin-top:34px;padding:20px 0 30px}
.site-footer .note{color:#a49ec0}

.liked-cell{position:relative;display:inline-block}
.liked-cell img{display:block}
.time-badge{position:absolute;right:4px;bottom:4px;background:rgba(0,0,0,.65);color:#fff;font-size:11px;padding:2px 6px;border-radius:8px}
.time-list{display:flex;flex-direction:column;gap:6px}
.time-row{display:flex;align-items:center;gap:10px;background:#faf7ff;border-radius:10px;padding:4px 10px 4px 4px}
.time-row img{width:44px;height:44px;object-fit:cover;border-radius:8px}
.time-verdict{font-weight:700;font-size:13px}
.time-verdict.ari{color:#ff5c8a}
.time-verdict.nashi{color:#8a8fa3}
.time-sec{margin-left:auto;font-variant-numeric:tabular-nums;font-weight:700}

body.playing{overflow:hidden}
#play-panel.stage{position:fixed;inset:0;z-index:60;border-radius:0;margin:0;display:flex;flex-direction:column;background:#fff;overflow:hidden}
#play-panel.stage .face-img{flex:1;min-height:0;width:100%;object-fit:contain;background:#fdf6ec}
#play-panel.stage .judge-row{padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:#fff}
#play-panel.stage .judge{height:72px;font-size:22px;border-radius:16px}
.swipe-hint{display:block;font-size:12px;color:#8a8fa3;font-weight:400;margin-top:2px}

.face-img{touch-action:none;-webkit-user-drag:none;user-select:none}

.time-group-title{font-weight:700;font-size:15px;margin:14px 0 6px;padding:6px 10px;border-radius:8px}
.time-group-title.ari{background:#ffe3ee;color:#d6336c}
.time-group-title.nashi{background:#eef1f6;color:#5a6480}
.time-row.fastest{background:#fff7d6;outline:2px solid #f5b301;border-radius:10px}
.time-row.fastest .time-sec{font-size:17px;color:#b97e00}
.fastest-badge{background:#f5b301;color:#fff;font-weight:700;font-size:11px;border-radius:999px;padding:2px 8px;margin-left:6px}
.liked-cell{position:relative;display:inline-block}
.liked-cell.fastest img{outline:3px solid #f5b301;outline-offset:1px}
.liked-cell .fastest-badge{position:absolute;top:4px;left:4px;margin:0}

.aff-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:8px 0}
.aff-card{display:block;border:1.5px solid #ffd3e2;background:#fff7fa;border-radius:12px;padding:10px;text-decoration:none;color:#333}
.aff-card b{display:block;font-size:14px;color:#d6336c}
.aff-card span{font-size:11px;color:#777}
.ad-slot{margin:12px 0;border:1px dashed #c9cede;border-radius:12px;padding:10px;text-align:center;background:#fafbff}
.ad-slot .ad-label{font-size:10px;color:#99a}
.ad-slot .ad-body{font-size:12px;color:#667}
@media (max-width:560px){.aff-grid{grid-template-columns:1fr}}

html,body{overflow-x:hidden}
img{max-width:100%}
.tabs{display:flex;flex-wrap:wrap;gap:6px}
.liked-faces{display:flex;flex-wrap:wrap;gap:6px}
h4{font-size:1.02rem}
.time-row{display:flex;align-items:center;gap:10px;max-width:100%}
