/* 見た目は Eromby（emov_viewer）に合わせている。カードはゲームのパッケージに合わせて縦長 */
:root {
  --bg: #101010;
  --bg-2: #181818;
  --bg-3: #242424;
  --line: #2c2c2c;
  --text: #e8e8e8;
  --muted: #9a9a9a;
  --accent: #e5383b;
  --accent-2: #c1121f;
  --radius: 6px;
  --gutter: clamp(12px, 3vw, 40px);
  --card: 168px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }

/* ---- 上の帯 ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gutter) 8px;
  background: rgba(16, 16, 16, .92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
/* ロゴ「ゲEMU」: 白いゲの右に、大きな赤い E と MU を並べる */
.brand { display: inline-flex; align-items: baseline; gap: 1px; line-height: 1; color: var(--text); flex: none; font-weight: 800; }
.brand-ge { font-size: 22px; letter-spacing: -.04em; }
.brand-e { font-size: 30px; color: var(--accent); letter-spacing: -.02em; }
.brand-rest { font-size: 19px; color: var(--accent); letter-spacing: .02em; }
.libs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.libs::-webkit-scrollbar { display: none; }
.libs a { padding: 6px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; }
.libs a:hover { color: var(--text); background: var(--bg-3); }
.libs a.active { color: var(--text); background: var(--bg-3); }
.search { flex: 1; display: flex; justify-content: flex-end; min-width: 0; }
.search input {
  width: min(420px, 100%); padding: 7px 12px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid transparent; outline: none;
}
.search input:focus { border-color: var(--accent); }
.me-chip { flex: none; order: 6; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-3); color: var(--text); font-weight: 700; font-size: 14px; border: 1px solid #3a3a3a; overflow: hidden; }
.avatar { display: inline-grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--bg-3); color: var(--text); font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.mid { width: 40px; height: 40px; font-size: 16px; border: 1px solid #3a3a3a; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; border: 1px solid #3a3a3a; }
.me-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.me-head h2 { margin: 0; }
.me-chip:hover, .me-chip.active { border-color: var(--accent); }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; }
  .search { order: 5; flex-basis: 100%; }
  .search input { width: 100%; }
  .libs { flex: 1; min-width: 0; }
  .me-chip { order: 4; }
}

main { padding: 0 0 48px; }
.empty { color: var(--muted); padding: 40px var(--gutter); text-align: center; }
.loading { color: var(--muted); padding: 24px var(--gutter); }

/* ---- 横に流れる段（ホーム・関連） ---- */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; gap: 12px; padding: 0 var(--gutter); margin-bottom: 10px; }
.section-head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.section-head a.more { color: var(--muted); font-size: 13px; }
.section-head a.more:hover { color: var(--accent); }
.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--card); gap: 14px;
  overflow-x: auto; padding: 4px var(--gutter) 8px; scroll-snap-type: x proximity; scrollbar-width: none;
  scroll-padding-inline: var(--gutter); overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.row::-webkit-scrollbar { display: none; }
.row:focus { outline: none; }
.row:focus-visible { box-shadow: inset 0 0 0 2px rgba(229, 56, 59, .35); border-radius: var(--radius); }
.row-wrap { position: relative; }
/* 段の端に重ねる送りボタン（タッチ端末では出さず、指で横に送る） */
.row-nav {
  position: absolute; top: 4px; bottom: 8px; width: 56px; border: 0; cursor: pointer; z-index: 2;
  font-size: 44px; line-height: 1; color: #fff; display: grid; place-items: center;
  opacity: .7; transition: opacity .2s, color .2s;
}
.row-nav[hidden] { display: none; }
.row-nav.next { right: 0; background: linear-gradient(90deg, transparent, rgba(16, 16, 16, .92) 60%); }
.row-nav.prev { left: 0; background: linear-gradient(270deg, transparent, rgba(16, 16, 16, .92) 60%); }
.row-nav:hover { color: var(--accent); }
.row-wrap:hover .row-nav, .row:focus-within ~ .row-nav, .row:focus ~ .row-nav { opacity: 1; }
@media (hover: none) { .row-nav { display: none; } }
.row > * { scroll-snap-align: start; }
.row.wide { grid-auto-columns: calc(var(--card) * 1.9); }
@media (max-width: 700px) { :root { --card: 34vw; } .row.wide { grid-auto-columns: 62vw; } }

/* ---- カード ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); gap: 22px 14px; padding: 0 var(--gutter); }
@media (max-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; } }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(calc(var(--card) * 1.9), 1fr)); }
@media (max-width: 700px) { .grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { display: block; min-width: 0; }
.thumb {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(160deg, #2a2a2a, #1a1a1a);
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease, opacity .2s; opacity: 0; }
.thumb img.ready { opacity: 1; }
.card:hover .thumb img, .card:focus-visible .thumb img { transform: scale(1.04); }
.card:focus-visible { outline: none; }
.card:focus-visible .thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 画像の無いゲームは、題名をパッケージ風に出す */
.noart {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  padding: 12px; text-align: center; font-weight: 700; line-height: 1.3; word-break: break-word; color: #d8d8d8;
}
.noart small { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .08em; }
.thumb img.ready ~ .noart { display: none; }
.thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
  background: rgba(0, 0, 0, .35); pointer-events: none; z-index: 3;
}
.thumb .play span {
  width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
.thumb .play span::before { content: ""; border-left: 16px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }
/* 真ん中の丸だけ押せる（押すとその場で遊ぶ、ほかの所は詳細へ）。タッチ端末では押せない */
@media (hover: hover) {
  .card:hover .thumb .play { opacity: 1; }
  .card:hover .thumb .play span { pointer-events: auto; cursor: pointer; transition: transform .15s; }
  .card:hover .thumb .play span:hover { transform: scale(1.1); }
}
.badge {
  position: absolute; right: 6px; top: 6px; z-index: 2; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600;
  background: rgba(0, 0, 0, .7); color: #ddd;
}
.fav-mark {
  position: absolute; left: 6px; top: 6px; z-index: 2; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center; font-size: 12px; color: #fff;
}
.card .title { margin-top: 6px; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 機種のカード（横長。後ろに代表作のカバーを並べる） */
.facet .thumb { aspect-ratio: 16 / 9; }
.facet .collage { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); filter: brightness(.55); }
.facet .collage img { position: static; opacity: 1; height: 100%; }
/* 本体の写真は明るい台紙に置く（白い背景の写真が多いので） */
.facet .hw { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #ffffff, #d9dce2); }
.facet .hw img { position: absolute; left: 8%; top: 6%; width: 84%; height: 66%; object-fit: contain; opacity: 1; mix-blend-mode: multiply; }
.card.facet:hover .hw img { transform: scale(1.05); }
.facet.has-hw .thumb::after { background: linear-gradient(transparent 55%, rgba(0, 0, 0, .82)); }
.credits { margin: 28px var(--gutter) 0; color: var(--muted); font-size: 12px; }
.credits summary { cursor: pointer; }
.credits ul { margin: 6px 0 0; padding-left: 18px; columns: 2; }
.credits a { color: #bbb; text-decoration: underline; }
@media (max-width: 700px) { .credits ul { columns: 1; } }
.facet .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(0, 0, 0, .85)); }
.facet .label { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1; }
.facet .label b { display: block; font-size: 16px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet .label small { color: #ccc; }
.facet .short { position: absolute; right: 10px; top: 8px; z-index: 1; font-weight: 800; font-size: 13px; color: var(--accent); letter-spacing: .06em; }

/* ---- 一覧の見出し・並べ替え ---- */
.lib-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 20px; padding: 20px var(--gutter) 6px; }
.lib-head h1 { margin: 0; font-size: 26px; font-weight: 600; }
.lib-head .note { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px var(--gutter) 14px; color: var(--muted); }
.toolbar select, .toolbar button {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 10px;
}
.toolbar button { cursor: pointer; }
.toolbar button:hover { border-color: var(--muted); }
.toolbar button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.toolbar .count { margin-left: auto; }
.sentinel { height: 1px; }

/* 右端の見出しの帯（名前順で件数が多い一覧） */
.az-index {
  position: fixed; right: max(2px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 3px; border-radius: 12px;
  background: rgba(20, 20, 20, .55); touch-action: none; user-select: none; -webkit-user-select: none;
  max-height: calc(100dvh - 140px); overflow: hidden;
}
.az-index span { font-size: 11px; line-height: 1.25; font-weight: 700; color: #bbb; padding: 0 5px; cursor: pointer; }
.az-index span:hover, .az-index.active span:hover { color: var(--accent); }
.az-index.active { background: rgba(20, 20, 20, .85); }
@media (max-height: 640px) { .az-index span { font-size: 9px; line-height: 1.1; } }
.az-bubble {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 16; min-width: 84px; padding: 14px 20px;
  border-radius: 14px; background: rgba(0, 0, 0, .78); color: #fff; font-size: 40px; font-weight: 800; text-align: center; pointer-events: none;
}
.az-bubble[hidden] { display: none; }
/* 帯とカードが重ならないよう、右に少し余白 */
.grid { padding-right: calc(var(--gutter) + 18px); }

/* ---- 詳細 ---- */
.detail { position: relative; }
.backdrop { position: absolute; inset: 0 0 auto; height: min(70vh, 620px); overflow: hidden; z-index: 0; }
.backdrop img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.4); transform: scale(1.1); image-rendering: auto; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(16, 16, 16, .1), var(--bg) 96%), linear-gradient(90deg, rgba(16, 16, 16, .85), transparent 70%); }
.detail-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 36px; padding: 48px var(--gutter) 0; align-items: start; }
@media (max-width: 900px) { .detail-main { grid-template-columns: 1fr; gap: 18px; padding-top: 18px; } .detail-cover { width: min(56vw, 260px); } }
.detail-cover { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.detail-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.detail-cover img.ready { opacity: 1; }
.detail-cover img.ready ~ .noart { display: none; }
.back-link { display: inline-flex; align-items: center; margin: 0 0 10px; padding: 4px 12px 4px 8px; border: 1px solid #3a3a3a;
  border-radius: 999px; background: rgba(0, 0, 0, .35); color: #ddd; cursor: pointer; font-size: 13px; }
.back-link:hover { border-color: var(--accent); color: #fff; }
.detail h1 { margin: 0 0 6px; font-size: clamp(20px, 2.6vw, 32px); line-height: 1.25; font-weight: 600; word-break: break-word; }
.detail .original { color: var(--muted); margin-bottom: 8px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #cfcfcf; align-items: center; }
.meta-line .pill { border: 1px solid #555; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.meta-line a.pill:hover { border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: var(--radius);
  background: var(--bg-3); border: 1px solid #3a3a3a; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: #666; }
.btn[hidden] { display: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.on { color: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: 12px; margin: -8px 0 14px; }
.netplay-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 16px; }
.netplay-row[hidden] { display: none; }
.netplay-row .btn { padding: 7px 16px; }
.muted { color: var(--muted); }
.overview { white-space: pre-wrap; color: #d6d6d6; max-width: 80ch; margin: 0 0 16px; }
.source { color: var(--muted); font-size: 12px; margin: -10px 0 14px; }
.source a { color: #bbb; text-decoration: underline; }
.overview-en { margin: 0 0 16px; color: var(--muted); }
.overview-en summary { cursor: pointer; font-size: 13px; }
.overview-en .overview { margin-top: 8px; color: #bdbdbd; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--bg-3); border: 1px solid #333; font-size: 13px; }
a.chip:hover { border-color: var(--accent); color: #fff; }
.chip small { color: var(--muted); margin-left: 4px; }

/* スクリーンショット（横に流れる段。画像は切らずに全体を見せる） */
.row.shots-row { grid-auto-columns: max-content; align-items: start; }
.shot { display: block; padding: 0; border: 0; background: var(--bg-3); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
.shot img { height: 200px; width: auto; max-width: 80vw; object-fit: contain; transition: transform .25s; }
.shot:hover img { transform: scale(1.03); }
.shot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 700px) { .shot img { height: 130px; } }
.viewer {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, .9); cursor: zoom-out; animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, .7); }
.viewer-count { position: fixed; top: calc(env(safe-area-inset-top) + 14px); left: 50%; transform: translateX(-50%); color: #ccc; font-size: 13px; }
.viewer-nav {
  position: fixed; top: 50%; transform: translateY(-50%); width: 56px; height: 80px; border: 0; border-radius: var(--radius);
  background: rgba(255, 255, 255, .06); color: #fff; font-size: 44px; line-height: 1; cursor: pointer;
}
.viewer-nav:hover { color: var(--accent); background: rgba(255, 255, 255, .12); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
@media (hover: none) { .viewer-nav { width: 44px; height: 64px; font-size: 36px; background: rgba(0, 0, 0, .35); } }
/* スクショの段は、タッチ端末でも「‹ ›」を画像の上に重ねて出す（何枚あるか・横に送れることが分かるように） */
.shots-row-wrap .row-nav { width: 48px; font-size: 40px; opacity: .9; }
.shots-row-wrap .row-nav.next { background: linear-gradient(90deg, transparent, rgba(16, 16, 16, .85) 55%); }
.shots-row-wrap .row-nav.prev { background: linear-gradient(270deg, transparent, rgba(16, 16, 16, .85) 55%); }
@media (hover: none) { .shots-row-wrap .row-nav { display: grid; } .shots-row-wrap .row-nav[hidden] { display: none; } }

/* ROM の一覧（同じゲームの地域違い・改造版など） */
.roms { padding: 0 var(--gutter); max-width: 1000px; }
.rom {
  /* ファイル名・印・大きさ。印が多いときや幅が狭いときは、印を2行目に回す（はみ出さない） */
  display: flex; align-items: center; gap: 6px 12px;
  padding: 9px 12px; border-radius: var(--radius); cursor: pointer; border: 1px solid transparent;
}
label.rom { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content) auto; }
@media (max-width: 700px) {
  label.rom { grid-template-columns: auto minmax(0, 1fr) auto; }
  label.rom .tags { grid-column: 2 / -1; grid-row: 2; }
  label.rom .tags:empty { display: none; }
}
.rom:hover { background: var(--bg-2); }
.rom.sel { border-color: var(--accent); background: rgba(229, 56, 59, .08); }
.rom input { accent-color: var(--accent); margin: 0; }
.rom .fn { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.rom .tags { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.rom .tag { font-size: 11px; border: 1px solid #555; border-radius: 4px; padding: 0 5px; color: #ccc; white-space: nowrap; }
.rom .tag.warn { border-color: #6b4a2a; color: #f0b27a; }
.rom .sz { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 管理: 招待コード・ユーザー / アカウント */
.field { padding: 8px 10px; border-radius: 8px; border: 1px solid #444; background: #151515; color: #eee; font-size: 14px; min-width: 0; flex: 1 1 200px; max-width: 320px; }
.field:focus { outline: none; border-color: var(--accent); }
.admin-list { display: flex; flex-direction: column; margin-top: 10px; }
.admin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.admin-row.dim { opacity: .55; }
.admin-row .grow { flex: 1 1 200px; min-width: 0; }
.invite-code { font-size: 15px; letter-spacing: .08em; background: #1c1c1c; border: 1px solid #3a3a3a; border-radius: 6px; padding: 2px 8px; }
.tag-pill { font-size: 11px; border: 1px solid #555; border-radius: 4px; padding: 0 5px; margin-left: 6px; color: #ccc; }

/* お気に入りを端末に取っておいている知らせ */
.fav-toast { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 1500;
  max-width: min(420px, calc(100vw - 24px)); padding: 8px 12px; border-radius: 8px; background: rgba(24, 24, 24, .95);
  border: 1px solid #3a3a3a; color: #ddd; font-size: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.fav-toast[hidden] { display: none; }
.fav-inline { color: var(--accent); }

/* ネットプレイのコメント（アカウントの画面） */
.cm-edit { display: grid; gap: 6px; margin: 8px 0; max-width: 420px; }
.cm-edit-row { display: flex; align-items: center; gap: 8px; }
.cm-edit-row b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; flex: none; }
.cm-edit-row .field { max-width: none; }

/* 今遊んでいる人（観戦） */
.live-card .thumb { position: relative; }
.live-tag { position: absolute; left: 6px; top: 6px; z-index: 2; background: #e5383b; color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 4px; padding: 1px 6px; }
.live-who { position: absolute; right: 6px; bottom: 6px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  border: 2px solid #e5383b; background: var(--bg-3); display: grid; place-items: center; font-weight: 700; }

/* ネットプレイの方式 */
.np-mode { display: inline-flex; gap: 4px; margin-left: 8px; }
.np-mode .btn.on { border-color: var(--accent); color: #fff; background: rgba(229, 56, 59, .25); }

/* 上のメニューの LIVE と、遊び始めた人の知らせ */
.live-nav { flex: none; order: 5; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: #e5383b; color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; }
.live-nav[hidden] { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: live-blink 1.2s ease-in-out infinite; }
@keyframes live-blink { 50% { opacity: .25; } }
@media (max-width: 700px) { .live-nav { order: 3; } }
.live-toasts { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 2000;
  display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 24px)); }
.live-toast { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px;
  background: rgba(24, 24, 24, .96); border: 1px solid #3a3a3a; border-left: 3px solid #e5383b; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.live-toast img { width: 54px; height: 72px; object-fit: cover; border-radius: 4px; background: #242424; }
.live-toast-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.live-toast-who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #bbb; }
.live-toast-who .avatar { width: 20px; height: 20px; font-size: 11px; }
.live-toast b { font-size: 14px; line-height: 1.3; }
.live-toast-close { align-self: start; border: 0; background: none; color: #999; font-size: 18px; cursor: pointer; padding: 0 2px; }

/* ホームの「今遊んでいる人」 */
.room-card > a { display: block; color: inherit; text-decoration: none; }
.room-card .sub a { color: var(--accent); font-weight: 700; text-decoration: none; }
.live-tag.np { background: #2f6fde; }
.live-none { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; padding: 0 var(--gutter); font-size: 13px; }
.live-dot.off { background: #666; animation: none; }

/* 一覧の絞り込み・おまかせ */
.toolbar .filters { display: contents; }
.toolbar select.on { border-color: var(--accent); color: #fff; }
.toolbar .dice { white-space: nowrap; }
/* ホームのみんなの様子 */
.who-badge { position: absolute; right: 6px; bottom: 6px; z-index: 2; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, .7);
  color: #fff; font-size: 11px; font-weight: 700; }
.who-face { position: absolute; right: 6px; bottom: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); }
.who-face .avatar { width: 100%; height: 100%; font-size: 12px; }

/* コントローラーで操作しているときの今の場所 */
body.pad-mode :focus { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
body.pad-mode .card:focus { outline-offset: 4px; }
body.pad-mode .card:focus .thumb { transform: scale(1.03); transition: transform .12s; }

/* コントローラーの割り当て */
.pad-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line, #2a2a2a); }
.pad-row b { word-break: break-all; }
.pad-live { color: var(--accent); font-weight: 700; font-size: 13px; min-width: 60px; text-align: right; }
.pad-wizard { padding: 16px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.pad-step { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
@media (max-width: 600px) { .pad-row { grid-template-columns: 1fr auto; } .pad-live { grid-column: 1 / -1; text-align: left; } }

/* グループ（管理） */
.group-pick { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.small-select { padding: 4px 6px; width: auto; }

/* セーブの一覧 */
.save-list { display: flex; flex-direction: column; gap: 12px; padding: 0 var(--gutter); max-width: 1000px; }
.save-game { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.save-art img, .save-noart { width: 72px; height: 96px; object-fit: cover; border-radius: 4px; background: var(--bg-3); display: block; }
.save-title { font-weight: 600; font-size: 15px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.save-title a:hover { color: var(--accent); }
.save-plat { font-size: 12px; color: var(--muted); border: 1px solid #555; border-radius: 4px; padding: 0 6px; }
.save-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.save-kind { min-width: 7em; }
.save-at, .save-size { color: var(--muted); font-variant-numeric: tabular-nums; }
.save-size { margin-right: auto; }
.btn.small { padding: 4px 10px; font-size: 12px; font-weight: 600; }
.save-body > .btn.primary { margin-top: 8px; }
.small { font-size: 12px; }

/* 取り込み */
.panel { margin: 20px var(--gutter); padding: 16px 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; max-width: 760px; }
.panel h2 { margin: 0 0 8px; font-size: 16px; }
.panel p { margin: 6px 0; color: #cfcfcf; }
.panel .muted { color: var(--muted); }
