* { box-sizing: border-box }
:root {
  color-scheme: dark;
  --bg:#090d1b; --line:#656fa7;
  --ink:#f9f3ee; --muted:#c2c9e3; --gold:#ffd895; --accent:#aba7ff;
  --card:linear-gradient(150deg,#252d50,#171d36 72%);
  --rim:0 8px 22px #03061452;
  font-family:"Yu Gothic Medium","Hiragino Kaku Gothic ProN",system-ui,sans-serif;
}
body { margin:0; min-height:100svh; color:var(--ink); background:radial-gradient(ellipse at 50% 0,#30234c 0,transparent 34rem),radial-gradient(ellipse at 100% 35%,#152b4d 0,transparent 38rem),var(--bg) }
button,input,select { font:inherit; min-height:46px; border:1px solid var(--line); border-radius:10px; color:var(--ink); padding:.62rem .82rem }
button { background:linear-gradient(165deg,#363f69,#222a4d); cursor:pointer; font-weight:700; touch-action:manipulation }
button:disabled { cursor:default; opacity:.48 }
button:enabled:hover { border-color:#c6bfff; filter:brightness(1.12) }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--gold); outline-offset:3px }
input,select { background:#10162a; border-color:#747eae; font-size:16px }
input::placeholder { color:#a4acd0 }
input[type=checkbox] { min-height:auto; width:20px; height:20px; accent-color:var(--gold) }
a { color:var(--gold) }
h1,h2,h3 { font-family:"Yu Mincho","Hiragino Mincho ProN",serif; margin:0 0 .48rem; line-height:1.25; overflow-wrap:anywhere }
h1 { font-size:clamp(2.85rem,11vw,5rem); letter-spacing:.045em }
h2 { font-size:clamp(1.55rem,6vw,2.05rem) }
h3 { font-size:1.2rem }
p { line-height:1.72; margin:.45rem 0 .85rem; overflow-wrap:anywhere }
small,.fine,.muted { color:var(--muted) }
.fine { font-size:.86rem }
.primary { color:#231625; background:linear-gradient(115deg,#ffe8ac,#ffbd77); border-color:#ffe6b1; box-shadow:0 3px 0 #935a3e42 }
.primary:enabled:hover { border-color:#fff3d9 }
.wide { width:100% }
.row { display:flex; gap:.55rem; flex-wrap:wrap; align-items:center }
.row>* { flex:1 }
.kicker { color:var(--accent); font-size:.74rem; font-weight:800; letter-spacing:.11em; margin-bottom:.3rem }
.shell { max-width:720px; margin:auto; padding:14px 16px max(24px,env(safe-area-inset-bottom)) }
.bar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px }
.bar .kicker { color:var(--gold); margin:0; display:flex; align-items:center; gap:8px }
.bar .kicker::before { content:""; width:26px; height:26px; background:url(icon-192.png) center/cover; border:1px solid #b18858; border-radius:7px }
.bar button { min-height:40px; font-size:.85rem; background:#202844 }
.panel,.role-card,.choice,.pass { background:var(--card); border:1px solid var(--line); border-top-color:#9296cd; border-radius:16px; box-shadow:var(--rim) }
.panel { margin:0 0 12px; padding:clamp(14px,4vw,23px) }
.panel>.primary,.pass>.primary { width:100%; margin-top:.35rem }
.panel>.kicker { color:var(--accent) }
.stack { display:grid; gap:8px }
.stack>button { text-align:left }
.choice { display:block; width:100%; text-align:left; padding:12px; margin:0 0 10px }
.choice span,.choice strong { display:block }
.choice strong { font-family:"Yu Mincho",serif; font-size:1.28rem; line-height:1.3; margin:.26rem 0 }
.choice span { font-size:.8rem; color:var(--muted); line-height:1.45 }
.choice img { display:block; width:100%; aspect-ratio:3/1; object-fit:cover; border-radius:9px; margin-bottom:9px; background:#10152b }
.case-grid { display:grid; gap:12px }
.case-grid .choice { margin:0; height:100% }
@media(min-width:620px) { .case-grid,.role-grid { grid-template-columns:repeat(2,minmax(0,1fr)) } }
.hero { display:grid; align-content:end; min-height:clamp(120px,24svh,240px); overflow:hidden; background:linear-gradient(0deg,#0b1028 0%,#0b102800 85%),url(hero.jpg) center 53%/cover,#222949; border-color:#a18ac0 }
.hero h2 { font-size:clamp(1.9rem,8vw,2.65rem); text-shadow:0 2px 12px #000 }
.title { min-height:100svh; display:grid; align-items:end; justify-items:center; text-align:center; background:linear-gradient(0deg,#080c1a 4%,#080c1ad9 25%,transparent 76%),url(hero.jpg) center 48%/cover,#161d3d; padding:22px 20px max(24px,env(safe-area-inset-bottom)) }
.title>div { width:min(100%,420px) }
.title h1 { text-shadow:0 4px 25px #07081c }
.title img { width:57px; border-radius:14px; border:1px solid #d0a871 }
.title a { display:inline-block; padding:11px 0; font-size:.84rem }
@media(min-width:800px) { .title { max-width:850px; margin:auto; border-inline:1px solid var(--line) } }
.stage-art { display:block; width:100%; height:auto; aspect-ratio:3/1; object-fit:cover; border:1px solid #8c91c7; border-radius:14px; margin-bottom:12px; background:#172440 }
.pass { min-height:min(45svh,360px); display:grid; align-content:center; text-align:center; gap:14px; padding:18px }
.seal { margin:auto; border:1px solid #b6a2ff; border-radius:50%; width:58px; height:58px; line-height:56px; font-size:24px; color:#ece5ff; background:radial-gradient(circle,#595186,#23284e) }
form,label { display:grid; gap:.4rem }
form { gap:.8rem }
label { color:var(--muted); font-size:.88rem }
label>input:not([type=checkbox]),label>select { width:100%; min-width:0 }
.error { color:#ffc1b6; margin:0 }
.error:empty,.fine[role=status]:empty { display:none }
.timer { display:block; width:fit-content; margin:.6rem 0; padding:.24rem .8rem; border:1px solid #ac8b59; border-radius:11px; color:var(--gold); background:#10162d; font-size:clamp(2rem,10vw,3.2rem); font-variant-numeric:tabular-nums }
.evidence,.role-summary,.friend-list li,.online-players li { border:1px solid #727da9; border-left:3px solid #9d9ede; background:#11182e; border-radius:10px; padding:.62rem .75rem }
.evidence { margin:.52rem 0 }
.evidence p { margin:.25rem 0 }
.secret { border-color:#d695b1; background:linear-gradient(130deg,#3b233e,#24203b) }
.secret strong { color:#ffd8eb }
hr { border:0; border-top:1px solid var(--line); margin:.85rem 0 }
.rule { padding-left:1.15rem; line-height:1.7 }
.rule li { margin:.48rem 0 }
summary { cursor:pointer; color:#ded6ff; font-weight:700 }
.help-guide { display:grid; gap:9px; margin-top:14px }
.help-guide details { background:#11182e; border:1px solid #7480ad; border-radius:10px; padding:10px 12px }
.help-guide summary { min-height:27px }
.help-guide p,.help-guide ol { margin-bottom:.25rem }
.home-shell>.primary { width:100%; margin-bottom:7px }
.home-shell>.choice { display:grid; grid-template-columns:minmax(72px,32%) minmax(0,1fr); grid-template-rows:auto auto; align-content:center; column-gap:12px; row-gap:3px; padding:8px 10px }
.home-shell>.choice img { grid-row:span 2; height:68px; aspect-ratio:auto; margin:0; align-self:center }
.home-shell>.choice span { align-self:end }
.home-shell>.choice strong { align-self:start; font-size:clamp(.95rem,4.4vw,1.4rem); margin:0 }
.home-shell .online-menu { margin-bottom:8px }
@media(max-height:650px) {
  .home-shell { padding:6px 12px 8px }
  .home-shell .bar,.home-shell .hero,.home-shell>.choice,.home-shell .online-menu { margin-bottom:6px }
  .home-shell .hero { padding:10px 13px; min-height:clamp(82px,21svh,136px) }
  .home-shell .hero h2 { font-size:1.65rem; margin:0 }
  .home-shell>.choice img { height:51px }
}
@media(max-height:500px) {
  .title { padding-bottom:12px }
  .title img { width:44px }
  .title h1 { font-size:2.7rem }
  .home-shell>.choice img { height:42px }
  .home-shell button { min-height:44px }
}
@media(max-height:460px) and (orientation:landscape) {
  .home-shell { display:grid; grid-template-columns:1fr 1fr; gap:5px 10px }
  .home-shell>.bar,.home-shell>.hero,.home-shell>.row,.home-shell>.primary { grid-column:span 2; margin:0 }
  .home-shell>.choice,.home-shell>.online-menu { margin:0 }
  .home-shell .hero { min-height:75px }
}
.role-grid { display:grid; gap:10px }
.role-card { min-width:0; padding:12px; display:flex; flex-direction:column }
.role-card-head,.private-role { display:flex; align-items:center; gap:12px }
.role-card img,.private-role img { width:78px; height:78px; object-fit:cover; border:1px solid #858ac4; border-radius:9px; flex:none }
.role-card h3 { margin:.17rem 0 }
.role-card p,.private-role p { font-size:.88rem; line-height:1.65 }
.role-card p { flex:1 }
.role-step { display:grid; grid-template-columns:44px 1fr 44px; align-items:center; text-align:center; gap:8px }
.role-step button { min-height:44px; padding:0 }
.role-card>strong { min-height:44px; display:grid; align-items:center }
.role-done { position:sticky; bottom:0; padding:9px 0 max(9px,env(safe-area-inset-bottom)); background:linear-gradient(0deg,var(--bg) 78%,#090d1b00); margin-top:8px }
.role-done button { width:100% }
.online-chat { overflow:auto; max-height:220px; min-height:48px; background:#10172e; border:1px solid #747fae; border-radius:9px; padding:6px 10px; margin-bottom:10px; overflow-wrap:anywhere }
.online-chat p { margin:.3rem 0 }
.room-code { display:inline-block; padding:.14rem .4rem; color:var(--gold); background:#10172e; border:1px solid #a18157; border-radius:6px; letter-spacing:.14em; font:700 1.2rem ui-monospace,monospace }
.online-back { margin-bottom:10px }
.friend-list,.online-players { list-style:none; padding:0; display:grid; gap:7px }
.friend-list li,.online-players li { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.5rem; overflow-wrap:anywhere }
@media(max-width:380px) { .private-role { align-items:flex-start }.private-role img { width:58px; height:58px } }
.roster { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr)); gap:7px; margin:10px 0 }
.roster-person { margin:0; overflow-wrap:anywhere }
.roster-person small { display:block; margin-top:.15rem }
[data-view=night],[data-view=role] { --card:linear-gradient(145deg,#312a52,#1a1c37); --line:#8d76b2; --accent:#d5baff }
[data-view=investigate],[data-view=morning],[data-view=lobby] { --card:linear-gradient(145deg,#213b54,#151f38); --line:#759cbc; --accent:#afdfef }
[data-view=vote],[data-view=result] { --card:linear-gradient(145deg,#482d42,#211e37); --line:#ad8099; --accent:#f1bfd4 }
@media(prefers-reduced-motion:no-preference) {
  button,a { transition:filter .15s,border-color .15s }
}
