/* ToneTone の配色（アプリの tt_theme.dart と同じ値）。運用の道具なので落ち着いた面にする。 */
:root {
  --grape: #7a4dff;
  --ink: #241436;
  --muted: #7b6f93;
  --line: #e9e2f4;
  --surface: #ffffff;
  --ground: #f7f4fb;
  --ok: #1f8a5b;
  --ok-bg: #e7f6ee;
  --warn: #b4531a;
  --warn-bg: #fff1e6;
  --danger: #c2334a;
  --focus: #45d0ff;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--ink);
  color: #fff;
}
.logo {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}
.logo small { font-size: 12px; letter-spacing: 0.12em; margin-left: 6px; color: #c9b8ff; }
.env {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffd23f;
  color: var(--ink);
}
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #e8e0ff; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 60px; }

.gate {
  margin-top: 40px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
}
.gate #signin { display: flex; justify-content: center; margin-top: 16px; }

/*
  左の縦メニュー（2026-11-10）。見出し（推し・アプリ全体・記録・数字）の下に画面を並べる。
  幅の狭い画面では上に横並びにし、見出しは小さな区切りにする。
*/
.wrap { max-width: 1280px; }
.shell { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 24px; align-items: start; }
.side {
  position: sticky;
  top: 66px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.side-head { margin: 12px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); }
.tab {
  font: inherit;
  font-weight: 800;
  border: 0;
  background: none;
  padding: 8px 10px;
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.tab:hover { background: #f3effa; }
.tab[aria-selected='true'] { background: #efe8ff; color: var(--grape); }
.tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.main-col { min-width: 0; }
.page-title { margin: 2px 0 14px; font-size: 18px; font-weight: 800; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .side { position: static; flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 6px; }
  .side-head { flex: none; margin: 0 2px 0 8px; padding-left: 8px; border-left: 1px solid var(--line); font-size: 10px; }
  .tab { flex: none; padding: 6px 10px; }
}

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; max-width: 70ch; }

.btn {
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  border-radius: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn.primary { background: var(--grape); border-color: var(--grape); color: #fff; }
.btn.ghost { background: transparent; color: inherit; border-color: rgba(255, 255, 255, 0.3); }
dialog .btn.ghost { border-color: var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); font-weight: 800; background: #fbf9fe; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.actions { text-align: right; }

.name { display: flex; align-items: center; gap: 10px; }
.name .emoji { font-size: 22px; width: 32px; text-align: center; }
.name strong { display: block; }
.name small { color: var(--muted); display: block; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #f3effa; padding: 1px 6px; border-radius: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
code.detail { display: inline-block; max-width: 48ch; white-space: pre-wrap; word-break: break-all; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.missing { background: var(--warn-bg); color: var(--warn); }

.state { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.state.on { background: var(--ok-bg); color: var(--ok); }
.state.off { background: #efecf3; color: var(--muted); }
.state.warn { background: var(--warn-bg); color: var(--warn); }

dialog {
  width: min(94vw, 720px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(36, 20, 54, 0.25);
}
dialog::backdrop { background: rgba(36, 20, 54, 0.45); }
dialog form { padding: 20px 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.icon { font: inherit; font-size: 22px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.field em { font-style: normal; font-weight: 700; color: #a197b5; margin-left: 4px; }
.field input:not([type='checkbox']), .field textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.field input:disabled { background: #f3effa; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); align-self: end; padding-bottom: 10px; }
.field.check input { width: 18px; height: 18px; }

.files { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-top: 14px; }
.file-box { border: 1px dashed #d8cdee; border-radius: 12px; padding: 12px; }
.file-box h3 { margin: 0 0 8px; font-size: 13px; }
.file-box h3 em { display: block; font-style: normal; font-weight: 700; font-size: 11px; color: var(--muted); }
.file-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-row input { font-size: 12px; max-width: 100%; }
.file-box audio { width: 100%; margin-top: 8px; }
.muted { color: var(--muted); font-size: 12px; margin: 6px 0 0; word-break: break-all; }
.error { color: var(--danger); font-weight: 800; margin: 12px 0 0; }

#toast {
  /* ダイアログの上に出すためポップオーバーにしている（app.js の toast）。ブラウザのポップオーバーの既定の見た目を消す */
  inset: auto;
  margin: 0;
  border: 0;
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(92vw, 560px);
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(36, 20, 54, 0.25);
}
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }
.muted.warn { color: var(--warn); font-weight: 800; }

.grant { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; max-width: 720px; }
.grant-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.grant-row .grow { flex: 1 1 260px; }
.grant-row .btn { margin-bottom: 4px; }
.found { margin: 4px 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 800; }

/* ---------------------------------------------------------------- サムネイル */

.thumb-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.thumb { width: 96px; height: 96px; border-radius: 18px; overflow: hidden; background: #f3effa; display: grid; place-items: center; flex: none; }
.thumb-img { display: block; object-fit: cover; border-radius: 10px; background: #f3effa; }
.thumb-img.sm { width: 40px; height: 40px; }
.thumb-img.lg { width: 96px; height: 96px; border-radius: 18px; }
.emoji.sm { font-size: 22px; width: 40px; text-align: center; }
.emoji.lg { font-size: 44px; }

/* ---------------------------------------------------------------- 編集ダイアログ（整理後） */

dialog#editor { width: min(94vw, 640px); max-height: min(92vh, 860px); }
dialog#editor form { padding: 0; display: flex; flex-direction: column; max-height: inherit; }
.dialog-scroll { overflow-y: auto; padding: 20px 22px 8px; }
.dialog-head { align-items: flex-start; }
.meta { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }

.sec { padding: 14px 0; border-top: 1px solid var(--line); }
.dialog-head + .sec, .dialog-head + .sec[hidden] + .sec { border-top: 0; }
.sec-title { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint.bad { color: var(--danger); font-weight: 800; }
.warn-line { margin: 6px 0 0; font-size: 12px; font-weight: 800; color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; }

.look { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: start; }
@media (max-width: 520px) { .look { grid-template-columns: 1fr; } }
.look-art { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.look-art .hint { margin: 0; font-size: 11px; }
.look-text { display: flex; flex-direction: column; gap: 10px; }
.look-text .field { margin: 0; }

.thumb {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 22px;
  border: 1px dashed #cdbfee;
  background: #f6f2fd;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb:hover { border-color: var(--grape); }
.thumb:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.thumb .thumb-img.lg { width: 120px; height: 120px; border-radius: 0; }
.thumb .emoji.lg { font-size: 52px; }
.thumb-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 800;
  background: var(--ink);
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
}
.mini { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--muted); }
.mini input { width: 44px; text-align: center; font-size: 16px; padding: 4px; border-radius: 8px; border: 1px solid var(--line); }

.sound-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sound-meta { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; }
.sound-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-meta span { font-size: 12px; font-variant-numeric: tabular-nums; }
.sec audio { width: 100%; margin-top: 8px; }

.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-row .field { margin: 0; }
.price-row input { font-variant-numeric: tabular-nums; }

.dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fbf9fe;
  border-radius: 0 0 18px 18px;
}
.bar-buttons { display: flex; gap: 8px; }
.sell { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.sell input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d9d2e6;
  position: relative;
  transition: background 0.15s;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(36, 20, 54, 0.3);
  transition: transform 0.15s;
}
.sell input:checked + .switch { background: var(--ok); }
.sell input:checked + .switch::after { transform: translateX(18px); }
.sell input:focus-visible + .switch { outline: 3px solid var(--focus); outline-offset: 2px; }
.sell-text { display: flex; flex-direction: column; font-weight: 800; font-size: 14px; line-height: 1.2; }
.sell-text small { font-size: 11px; color: var(--muted); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
.actions .btn, .state { white-space: nowrap; }

/* ---------------------------------------------------------------- 推しラボ */
.lab { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; margin: 12px 0 20px; align-items: start; }
.lab-side { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.lab-side textarea { font-size: 12.5px; line-height: 1.55; }
.lab-side select, .lab-side textarea, .lab-side input { width: 100%; }
.field select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.lab-main { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-height: 520px; }
.lab-chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 62vh; }
.lab-msg { max-width: 78%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; line-height: 1.6; }
.lab-msg.user { align-self: flex-end; background: var(--grape); color: #fff; border-bottom-right-radius: 4px; }
.lab-msg.assistant { align-self: flex-start; background: #f3effa; border-bottom-left-radius: 4px; }
.lab-who { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.lab-metrics { margin-top: 6px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.lab-stars button { border: 0; background: none; cursor: pointer; font-size: 15px; color: #c9bfe0; padding: 0 1px; }
.lab-stars button.on { color: #f5a623; }
.lab-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.lab-form textarea { flex: 1; resize: vertical; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); font: inherit; }
.lab-logs-title { display: flex; align-items: center; gap: 10px; }
.lab-logs td { font-size: 12px; vertical-align: top; }
.lab-logs td.talk { max-width: 420px; }
.lab-logs td.talk small { display: block; color: var(--muted); }
@media (max-width: 860px) { .lab { grid-template-columns: 1fr; } .lab-msg { max-width: 92%; } }

.lab-system { margin: 4px 0 12px; font-size: 12px; }
.lab-system summary { cursor: pointer; color: var(--grape); font-weight: 800; }
.lab-system pre { white-space: pre-wrap; background: #f7f4fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 320px; overflow: auto; font-family: inherit; line-height: 1.55; }
.lab-again { padding: 2px 10px; font-size: 11.5px; }

/* ---------------------------------------------------------------- 説明・畳む（2026-10-27） */
/* 説明は畳んでおき、押すと開く。見落とすと困る決まりだけ .hint で出しておく */
.help { font-size: 12px; color: var(--muted); }
.help > summary { display: inline-flex; align-items: center; gap: 5px; padding: 2px 0; cursor: pointer; font-weight: 800; list-style: none; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before {
  content: 'i';
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font: italic 700 10px/1 Georgia, serif;
}
.help > summary:hover, .help[open] > summary { color: var(--grape); }
.help > p { margin: 6px 0 0; padding: 8px 12px; max-width: 72ch; background: #f8f5fd; border-radius: 10px; color: #5f5476; line-height: 1.6; }
.help > p + p { margin-top: 4px; }
.sec > .help { margin: 4px 0 10px; }
#tab-points > .help, #tab-oshi > .help { margin: 2px 0 12px; }

/* ふだんは変えない欄（推しの基本の「詳しい設定」） */
.more { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.more > summary { display: inline-flex; gap: 6px; cursor: pointer; font-size: 12px; font-weight: 800; color: var(--muted); list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: '▸'; display: inline-block; color: var(--muted); transition: transform 0.15s; }
.more[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .more > summary::before { transition: none; } }
.more[open] > summary { margin-bottom: 10px; color: var(--ink); }

/* ---------------------------------------------------------------- 推し（oshis.js） */
.oshi-avatar { display: grid; place-items: center; flex: none; border-radius: 10px; color: #fff; font-weight: 800; overflow: hidden; }
.oshi-avatar.sm { width: 40px; height: 40px; font-size: 18px; }
.oshi-avatar.lg { width: 96px; height: 96px; font-size: 40px; border-radius: 18px; }
.chip.off { background: #efecf3; color: var(--muted); text-decoration: line-through; }
dialog#oshi-editor { width: min(96vw, 900px); max-height: min(94vh, 980px); padding: 0; }
/* 見出しと部分の切り替えは上に置いたまま、中身だけをスクロールする */
dialog#oshi-editor[open] { display: flex; flex-direction: column; }
dialog#oshi-editor.tabbed { height: min(94vh, 980px); }
dialog#oshi-editor > .dialog-top { flex: none; padding: 20px 22px 0; border-bottom: 1px solid var(--line); }
dialog#oshi-editor > .dialog-top .dialog-head { margin-bottom: 8px; }
dialog#oshi-editor > .dialog-scroll { flex: 1 1 auto; min-height: 0; padding-bottom: 20px; }
dialog#oshi-editor .dialog-scroll > .sec:first-child, dialog#oshi-editor .panels > .sec { border-top: 0; padding-top: 0; }
dialog#oshi-editor > .dialog-scroll { padding-top: 16px; }
.grid2.issue { margin-top: 12px; }
.subtabs { display: flex; gap: 2px; margin: 0 -10px; overflow-x: auto; scrollbar-width: none; }
.subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  border: 0;
  background: none;
  padding: 8px 10px 9px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.subtab small { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: #f3effa; color: var(--muted); font-variant-numeric: tabular-nums; }
.subtab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--grape); }
.subtab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
/* シーンの声: シーンの見出しの右に「＋ 一言を足す」を置き、空きスロットは押したときだけ出す */
.scene-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.scene-head h4.sub { margin: 0; }
.scene-head .spacer { flex: 1; }
dialog .btn.ghost.add-slot { padding: 4px 10px; font-size: 12px; border-style: dashed; color: var(--grape); }
dialog#oshi-editor .thumb { position: relative; border: 0; cursor: pointer; padding: 0; }
dialog#oshi-editor select, dialog#oshi-editor .compact input:not([type='checkbox']) {
  font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
dialog#oshi-editor .compact { min-width: 720px; }
dialog#oshi-editor .compact td { padding: 6px 8px; }
dialog#oshi-editor tr.inactive td { opacity: 0.55; }
/* シーンの声のスロット。1 枚に一言・声・音量・試聴・保存をまとめる */
dialog#oshi-editor .slots { display: grid; gap: 8px; }
dialog#oshi-editor .slot { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
dialog#oshi-editor .slot.empty { border-style: dashed; background: var(--ground); }
dialog#oshi-editor .slot.dirty { border-color: var(--grape); box-shadow: 0 0 0 1px var(--grape) inset; }
dialog#oshi-editor .slot-no { flex: 0 0 22px; padding-top: 7px; text-align: center; font-weight: 800; color: var(--muted); }
dialog#oshi-editor .slot-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
dialog#oshi-editor .slot-body > input { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
dialog#oshi-editor .slot-level select { width: auto; }
/* 声・音を選ぶところ（シーンの声のスロットと、お知らせの音で同じ形） */
.slot-voice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.slot-voice .spacer { flex: 1; }
.slot-status .chip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.slot-level { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.slot-level select { width: auto; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
/* 音の大きさ（volume.js）。点は 元＝白抜き、いま＝ぶどう色、保存すると＝オレンジ（解析のグラフと同じ 2 色）。
   目盛りの帯は小さめ〜大きめ、縦の線はおすすめ。値はいつも文字でも出す */
.vol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.vol[hidden] { display: none; }
.sound-picker { display: grid; gap: 8px; }
.vol-meter { display: inline-flex; flex: none; }
.vol-items { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.vol-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.vol-item.now, .vol-item.next { color: var(--ink); font-weight: 700; }
.vol-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-sizing: border-box; }
.vol-dot.source { border: 2px solid var(--muted); background: #fff; }
.vol-dot.now { background: var(--viz-announce); }
.vol-dot.next { background: var(--viz-news); }
.vol-track { stroke: var(--viz-base); stroke-width: 2; stroke-linecap: round; }
.vol-band { fill: #e6dcff; }
.vol-tick { stroke: var(--grape); stroke-width: 1.5; opacity: 0.6; }
.vol-dot-source { fill: #fff; stroke: var(--muted); stroke-width: 2; }
.vol-dot-now { fill: var(--viz-announce); stroke: #fff; stroke-width: 2; }
.vol-dot-next { fill: var(--viz-news); stroke: #fff; stroke-width: 2; }
dialog#annc-editor { width: min(96vw, 760px); max-height: min(94vh, 980px); padding: 0; }
dialog#annc-editor > .dialog-scroll { max-height: inherit; padding-bottom: 20px; }
dialog#annc-editor .field select { width: 100%; }
.chip.pending { background: #efe8ff; color: var(--grape); }
h4.sub .scene-hint { font-weight: 700; color: var(--muted); font-size: 12px; }
.sec-title small { font-weight: 700; color: var(--muted); font-size: 12px; margin-left: 6px; }
.persona-text { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0 6px; resize: vertical; }
.common-rules pre, .versions pre { white-space: pre-wrap; font-size: 12px; background: #f8f5fd; border-radius: 10px; padding: 10px 12px; margin: 6px 0; }
.common-rules summary, .versions summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.versions { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.versions li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.versions li details { flex: 1; min-width: 0; }
.versions summary { color: var(--ink); }
h4.sub { margin: 16px 0 4px; font-size: 13px; }
dialog#oshi-editor .field input[type='color'] { height: 44px; padding: 4px; cursor: pointer; }
#tab-oshis td.nowrap { white-space: nowrap; }
#tab-oshis td small.sub { display: block; color: var(--muted); font-size: 11px; }
/* 本番の印（dev と見分けやすいように色を変える） */
.env.prod { background: #ff5a5f; color: #fff; }
.toolbar > .help { flex: 1 1 320px; }

/* SNS の YouTube：新しい動画を知らせるスイッチと、チャンネルを見ている様子 */
.watch { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.watch .hint { margin: 0; font-size: 11px; }
.watch code { font-size: 11px; }
.video-sound { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 解析：月を選ぶところ、ToneTone のお知らせの行、内訳の窓 */
.toolbar .field.month { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
#tab-analytics td small.sub, dialog#analytics-detail td small.sub { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
#tab-analytics tr.tonetone td { background: #fbf9fe; }
#tab-analytics .muted-cell, dialog#analytics-detail .muted-cell { color: var(--muted); }
dialog#analytics-detail { width: min(96vw, 900px); max-height: min(94vh, 980px); padding: 0; }
dialog#analytics-detail[open] { display: flex; flex-direction: column; }
dialog#analytics-detail > .dialog-top { flex: none; padding: 20px 22px 0; border-bottom: 1px solid var(--line); }
dialog#analytics-detail > .dialog-scroll { flex: 1 1 auto; min-height: 0; padding-bottom: 20px; }
dialog#analytics-detail .dialog-scroll > .sec:first-child { border-top: 0; padding-top: 0; }
dialog#analytics-detail .compact { min-width: 640px; }
dialog#analytics-detail .compact td { padding: 6px 8px; }
dialog#analytics-detail .chip { margin-left: 6px; }

/* 解析のグラフ（charts.js）。色は役割で決め、どの図でも同じものに同じ色にする:
   お知らせのリンク＝ぶどう色、最新情報のリンク＝オレンジ、新しく手に入れた人＝みどり。
   この 3 色は、色覚の多様性の検査（dataviz の validate_palette。全部の組み合わせ）を通した。
   みどりは白地とのコントラストが 3:1 に少し届かないので、値はいつも文字と「表で見る」でも読めるようにしている */
:root {
  --viz-announce: #7a4dff;
  --viz-announce-soft: #b9a3ff;
  --viz-news: #eb6834;
  --viz-owners: #1baf7a;
  --viz-accent: #7a4dff;
  --viz-grid: #f0ebf7;
  --viz-base: #d6cce6;
  --viz-deemph: #cfc6de;
}
.analytics { display: grid; gap: 18px; transition: opacity 0.15s; }
.analytics.loading { opacity: 0.5; }
#tab-analytics > .toolbar { justify-content: flex-start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1.15; color: var(--ink); }
.kpis.compact .kpi-value { font-size: 24px; }
.kpi-unit { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi-sub, .kpi-note { font-size: 12px; color: var(--muted); }
.kpi-delta { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 800; }
.kpi-delta span { font-weight: 500; color: var(--muted); }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.flat { color: var(--muted); }
/* 推移線はタイルの下端にそろえ、上の中身とは少なくとも 10px 空ける（透明な上の縁で空ける） */
.kpi-spark { position: relative; box-sizing: content-box; height: 30px; margin-top: auto; border-top: 10px solid transparent; }
.kpi-spark svg { display: block; width: 100%; height: 30px; overflow: visible; }
.kpi-spark-line { fill: none; stroke: var(--viz-deemph); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kpi-spark-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--surface); }
.kpi-split { margin-top: 8px; }
.kpi-split-bar { display: flex; gap: 2px; height: 8px; }
.kpi-split-bar span { display: block; min-width: 2px; }
.kpi-split-bar span:first-child { border-radius: 4px 0 0 4px; }
.kpi-split-bar span:last-child { border-radius: 0 4px 4px 0; }
.kpi-split-bar span:only-child { border-radius: 4px; }
.kpi-split-labels { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.kpi-split-labels span, .viz-legend span { display: inline-flex; align-items: center; gap: 5px; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.viz-grid.one { grid-template-columns: 1fr; }
.viz-card { min-width: 0; margin: 0; padding: 14px 16px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.viz-title { margin: 0; font-size: 14px; }
.viz-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.viz-plot { position: relative; min-height: 220px; margin-top: 4px; }
.viz-svg { display: block; overflow: visible; }
.viz-gridline { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-base { stroke: var(--viz-base); stroke-width: 1; shape-rendering: crispEdges; }
.viz-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz-tick.on { fill: var(--ink); font-weight: 800; }
.viz-tick.sub { font-size: 10px; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-dot.hollow { fill: var(--surface); stroke-width: 2; }
.viz-bar.partial { opacity: 0.45; }
.an-partial { margin: -6px 0 0; font-size: 12px; color: var(--muted); }
.viz-value { font-size: 12px; font-weight: 800; fill: var(--ink); }
.viz-crossline { stroke: var(--viz-base); stroke-width: 1; }
.viz-hit { fill: transparent; outline: none; cursor: crosshair; }
.viz-hit.on { fill: rgba(122, 77, 255, 0.06); }
.viz-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.viz-tip { position: absolute; z-index: 1; pointer-events: none; padding: 8px 10px; background: var(--ink); color: #fff; border-radius: 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(36, 20, 54, 0.25); }
.viz-tip-title { margin-bottom: 3px; font-size: 11px; color: #d9d0ee; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; }
.viz-tip-row strong { font-size: 13px; }
.viz-tip-pad { width: 14px; }
.viz-table { margin-top: 6px; }
.viz-table summary { cursor: pointer; font-size: 12px; font-weight: 800; color: var(--muted); }
.viz-table table { min-width: 0; margin-top: 6px; }
.viz-table td, .viz-table th { padding: 5px 8px; }
.viz-empty { display: grid; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; font-size: 13px; color: var(--muted); }
.viz-empty strong { color: var(--ink); }
.an-sec { display: grid; gap: 8px; }
.an-title { margin: 4px 0 0; font-size: 14px; }
.an-title small { margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
td.barcell { min-width: 150px; }
.cellbar { display: grid; gap: 5px; }
.cellbar-text { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.cellbar-text small { font-size: 11px; color: var(--muted); }
.cellbar-track { height: 6px; }
.cellbar-track span { display: block; height: 100%; border-radius: 0 3px 3px 0; }
td.rank { width: 36px; text-align: center; font-weight: 800; color: var(--muted); }
.hbars { display: grid; gap: 8px; max-width: 560px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-track span { display: block; height: 10px; border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
dialog#analytics-detail .kpis { margin-bottom: 4px; }
dialog#analytics-detail .viz-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
dialog#analytics-detail .kpis.compact { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
dialog#analytics-detail .an-partial { margin: 0 0 10px; }
dialog#analytics-detail th, #tab-analytics th { white-space: nowrap; }
.linklike { padding: 0; border: 0; background: none; font: inherit; color: var(--grape); font-weight: 700; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
.linklike:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* 画面の中の切り替え（お知らせ・音）。推しの窓の切り替えと同じ見た目で、下に線を引く */
#tab-announcements > .subtabs, #tab-sounds > .subtabs { margin: 0 0 14px; border-bottom: 1px solid var(--line); }

/* カード（ホーム・自動のお知らせ・共通の音） */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .table-wrap { margin-top: 8px; }
.card .video-sound { margin-top: 14px; }
.card .sound-picker { margin-top: 8px; }
.auto-none { margin-top: 14px; }
.mini-switch { display: inline-flex; }

/* ホーム */
.home-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; align-items: start; }
.home-grid .card + .card { margin-top: 0; }
.home-card .hint { margin-top: 4px; }
.home-line { margin: 6px 0 0; }
.home-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.home-stat { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--ground); }
.home-stat strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.home-stat span { font-size: 12px; color: var(--muted); font-weight: 700; }
.home-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.home-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.home-list .hint { margin: 0; }

/* 公開の設定（公開／招待制／メンテナンス）。2026-11-19 */
.mode-pick { border: 0; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.mode-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.mode-card:has(input:checked) { border-color: var(--grape); box-shadow: 0 0 0 1px var(--grape) inset; }
.mode-card input { margin-top: 3px; accent-color: var(--grape); }
.mode-body { display: grid; gap: 2px; }
.mode-body strong { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.invite-made { margin: 10px 0; padding: 12px 14px; border: 1px dashed var(--grape); border-radius: 12px; background: #faf7ff; }
.invite-made pre { margin: 6px 0 10px; font-size: 15px; font-weight: 800; letter-spacing: .06em; }

/* ボイスパックの中身（2026-11-27） */
.pack-items { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.pack-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pack-item small { margin-left: auto; }
