:root{
  --bg:#f4f6f8; --surface:#ffffff; --surface2:#eef1f4; --text:#14181d; --muted:#5b6572;
  --border:#d7dde5; --accent:#e8b400; --accent-text:#14181d; --danger:#c62f3b;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#0d1117; --surface:#161c24; --surface2:#1e2632; --text:#eef2f6; --muted:#9aa7b5; --border:#2b3646; }
}
html[data-theme="light"]{ --bg:#f4f6f8; --surface:#ffffff; --surface2:#eef1f4; --text:#14181d; --muted:#5b6572; --border:#d7dde5; }
html[data-theme="dark"]{ --bg:#0d1117; --surface:#161c24; --surface2:#1e2632; --text:#eef2f6; --muted:#9aa7b5; --border:#2b3646; }
*{ box-sizing:border-box; }
body{ margin:0; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,"Hiragino Sans","Noto Sans JP",sans-serif; }
.topbar{ display:flex; justify-content:space-between; align-items:center; padding:10px 16px; position:sticky; top:0; background:var(--bg); z-index:5; }
.brand{ display:flex; gap:8px; align-items:center; font-weight:700; font-size:18px; }
main{ max-width:720px; margin:0 auto; padding:8px 14px 40px; }
.lead{ color:var(--muted); line-height:1.6; }
.card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px; margin:12px 0; }
.fld{ display:block; margin:10px 0; }
.fld span{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
.fld .row{ display:flex; gap:8px; margin:0; }
.fld .row input{ flex:1; }
input{ width:100%; padding:12px; font-size:16px; border:1px solid var(--border); border-radius:10px; background:var(--surface2); color:var(--text); }
button{ font-size:15px; border-radius:10px; padding:12px 16px; border:1px solid var(--border); background:var(--surface2); color:var(--text); cursor:pointer; }
button:active{ transform:scale(.96); }
button.primary{ background:var(--accent); color:var(--accent-text); border-color:transparent; font-weight:700; width:100%; }
button.secondary{ font-weight:600; }
button.ghost{ background:transparent; }
button.danger{ color:var(--danger); }
button.small{ padding:8px 10px; font-size:13px; }
#createBtn{ margin-top:6px; }
#joinBtn{ width:100%; }
.or{ text-align:center; color:var(--muted); margin:14px 0 4px; font-size:13px; }
.note{ color:var(--muted); font-size:13px; line-height:1.6; }
.roomhead{ display:flex; justify-content:space-between; gap:12px; }
.roomtitle{ font-size:20px; font-weight:700; }
.roommeta{ color:var(--muted); margin-top:4px; }
.sharebox{ display:flex; flex-direction:column; gap:6px; align-items:center; }
.sharebox img{ background:#fff; border-radius:8px; padding:4px; }
.np-label{ font-size:12px; color:var(--muted); letter-spacing:.08em; }
.np-info{ font-size:17px; font-weight:700; margin:6px 0; line-height:1.5; }
.np-info .by{ font-size:13px; color:var(--muted); font-weight:400; }
#playerWrap{ position:relative; aspect-ratio:16/9; background:#000; border-radius:10px; overflow:hidden; margin:8px 0; }
#playerWrap iframe{ position:absolute; inset:0; width:100%; height:100%; }
.modeswitch{ display:flex; gap:8px; align-items:center; margin-top:10px; flex-wrap:wrap; }
.modeswitch .mode-label{ font-size:13px; color:var(--muted); }
.modeswitch button.active{ background:var(--accent); color:var(--accent-text); border-color:transparent; font-weight:700; }
.controls{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.controls .primary{ width:auto; }
.results{ display:flex; flex-direction:column; gap:8px; margin:8px 0; }
.result{ display:flex; gap:10px; align-items:center; background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:8px; text-align:left; width:100%; }
.result img{ width:64px; height:48px; object-fit:cover; border-radius:6px; }
.result .t{ font-weight:600; font-size:14px; line-height:1.4; }
.result .a{ color:var(--muted); font-size:12px; }
.result .mid{ flex:1; min-width:0; }
.result .addops{ display:flex; flex-direction:column; gap:6px; }
.badge{ display:inline-block; font-size:11px; background:var(--accent); color:var(--accent-text); border-radius:6px; padding:1px 6px; margin-left:6px; vertical-align:middle; }
.badge.sp{ background:#1db954; color:#fff; }
.badge.rec{ background:#3b82f6; color:#fff; }
.queue{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.qitem{ display:flex; gap:10px; align-items:center; background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:8px; }
.qitem.current{ outline:2px solid var(--accent); }
.qitem img{ width:64px; height:48px; object-fit:cover; border-radius:6px; }
.qitem .info{ flex:1; min-width:0; }
.qitem .t{ font-weight:600; font-size:14px; line-height:1.4; overflow:hidden; text-overflow:ellipsis; }
.qitem .a{ color:var(--muted); font-size:12px; }
.qitem .ops{ display:flex; gap:4px; }
.qitem .ops button{ padding:6px 8px; font-size:13px; }
#toast{ position:fixed; left:50%; bottom:22px; transform:translateX(-50%); background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:10px; padding:10px 16px; font-size:14px; opacity:0; pointer-events:none; transition:opacity .25s; max-width:92vw; box-shadow:0 6px 24px rgba(0,0,0,.25); }
#toast.show{ opacity:1; }
h2{ font-size:16px; margin:4px 0 8px; }
