/* 操作コンソール：主役はプレビュー。サイドメニューは静かに、触る場所だけをはっきりと。 */
:root {
  --bg: #0f1012; --panel: #16171a; --raise: #1e2024; --raise2: #2a2d33; --line: #25272c; --line2: #34373e;
  --ink: #ecebe6; --sub: #9b9da4; --faint: #6c6f77;
  --accent: #ffd23f; --accent-ink: #151309; --rec: #ff4b3e; --on: #4ade80; --err: #ff6b5b; --demo: #62d0ff;
  --r: 12px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans CJK JP", system-ui, sans-serif;
  font-feature-settings: "palt" 1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 上部バー ---- */
.top { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .14em; font-size: 14px; color: inherit; text-decoration: none; }
.brand small { font-weight: 500; letter-spacing: .04em; color: var(--faint); font-size: 12px; margin-left: 6px; }
.mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); letter-spacing: 0; font-size: 15px; }
.top-right { display: flex; align-items: center; gap: 16px; }
.status { display: flex; align-items: center; gap: 8px; color: var(--sub); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.on { background: var(--on); box-shadow: 0 0 0 4px rgba(74,222,128,.15); animation: pulse 1.6s ease-in-out infinite; }
.dot.demo { background: var(--demo); }
.dot.err { background: var(--err); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(74,222,128,.05); } }
.plan-badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line2); border-radius: 999px; padding: 3px 4px 3px 10px; text-decoration: none; color: var(--sub); font-size: 12px; }
.plan-badge b { color: var(--ink); letter-spacing: .1em; font-size: 11px; }
.plan-badge span { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.plan-badge:hover { border-color: var(--accent); }

/* ---- 全体の格子 ---- */
.grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; padding: 16px; height: calc(100% - 52px); }
.panel { min-height: 0; overflow: auto; }
.right { display: flex; flex-direction: column; gap: 12px; }

/* ---- サイドメニュー ---- */
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.sec { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.sec + .sec { border-top: 1px solid var(--line); }
h2 { margin: 0; font-size: 11px; letter-spacing: .16em; color: var(--sub); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.lbl { color: var(--sub); font-size: 12px; }
.hint { color: var(--faint); font-size: 11.5px; line-height: 1.6; margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }

/* 入力欄 */
select, input:not([type]), input[type=password], textarea {
  width: 100%; min-width: 0; background: var(--raise); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; outline: none;
  transition: border-color .15s;
}
select:hover, input:not([type]):hover, input[type=password]:hover, textarea:hover { border-color: #454953; }
select:focus, input:focus, textarea:focus { border-color: var(--accent); }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239b9da4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
textarea { resize: vertical; min-height: 58px; line-height: 1.6; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
::placeholder { color: var(--faint); }

/* ボタン */
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--raise); color: var(--ink);
  font-weight: 600; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--raise2); border-color: #454953; }
.ghost { border: 1px solid var(--line2); border-radius: 8px; padding: 7px 12px; color: var(--ink); background: var(--raise); white-space: nowrap; }
.ghost:hover { border-color: #565b66; background: var(--raise2); }
.ghost.on { border-color: var(--accent); color: var(--accent); }
.small { padding: 4px 9px; font-size: 12px; }
kbd { font-family: inherit; font-size: 10px; color: var(--faint); border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* マイク */
.mic-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 16px; align-items: center; }
.mic-btn { position: relative; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px rgba(255,210,63,.1); transition: background .2s, box-shadow .2s, transform .12s; }
.mic-btn:hover { box-shadow: 0 0 0 8px rgba(255,210,63,.16); }
.mic-btn:active { transform: scale(.96); }
.mic-btn .ic { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mic-btn .ic-stop { display: none; fill: currentColor; stroke: none; }
.mic-btn.on { background: var(--rec); color: #fff; box-shadow: 0 0 0 6px rgba(255,75,62,.16); }
.mic-btn.on .ic-mic { display: none; }
.mic-btn.on .ic-stop { display: block; }
.mic-btn.on::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--rec); animation: ring 1.8s ease-out infinite; pointer-events: none; }
@keyframes ring { from { transform: scale(1); opacity: .6; } to { transform: scale(1.28); opacity: 0; } }
.mic-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mic-info b { font-size: 15px; font-weight: 700; }
.meter { height: 4px; border-radius: 2px; background: var(--line2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--on); transform-origin: 0 50%; transform: scaleX(0); transition: transform .08s linear; }
.try-row { display: flex; gap: 8px; }
.type { flex: 1; min-width: 0; display: flex; }
.type input { height: 36px; }

.pro-note[hidden] { display: none; }
.pro-note { border: 1px solid #5c4f1c; background: #221f12; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pro-note b { color: var(--accent); font-size: 12.5px; }
.pro-note p { margin: 0; color: var(--sub); font-size: 12px; line-height: 1.6; }
.pro-note a { color: var(--accent); font-size: 12px; }

/* 書体テーマ：実際の地と字で見せる */
.themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.theme { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--sub); font-size: 11.5px; min-width: 0; }
.theme .tile { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  background: var(--sw-bg); color: var(--sw-ink); font-size: 24px; line-height: 1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: box-shadow .15s; }
.theme .tile::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--sw-accent); }
.theme:hover .tile { box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.theme[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.theme[aria-checked="true"] .tile { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }

/* Pro 書体とお試し */
.pro-themes .themes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pro-tag { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; color: var(--accent-ink); background: var(--accent); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.theme.locked .tile { filter: grayscale(.6) brightness(.7); }
.theme.locked .tile::before { content: ""; position: absolute; left: 6px; top: 6px; width: 14px; height: 14px; border-radius: 4px; background-color: rgba(0,0,0,.55); background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='2' fill='%23fff'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center / 10px no-repeat, rgba(0,0,0,.55); }
.trial { display: flex; flex-direction: column; gap: 6px; }
.trial-bar { height: 3px; border-radius: 2px; background: var(--line2); overflow: hidden; }
.trial-bar i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transition: transform .4s linear; }
.trial.active .hint { color: var(--accent); }

/* アクセントカラー */
.accents { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acc { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); transition: transform .12s, box-shadow .15s; flex: none; }
.acc:hover { transform: scale(1.08); }
.acc[aria-checked="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.acc-auto { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--sub); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.acc-auto i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.acc-auto[aria-checked="true"] { border-color: var(--ink); color: var(--ink); }
.acc-custom { position: relative; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: none;
  background: conic-gradient(#ff4f4f, #ffd23f, #3ddc84, #4cc9f0, #4f7cff, #a78bfa, #ff4f8b, #ff4f4f); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.acc-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.acc-custom[aria-checked="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.accents.locked .acc, .accents.locked .acc-custom { opacity: .35; }

/* レイアウト：セグメント */
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; }
.segmented button { height: 30px; border-radius: 7px; color: var(--sub); font-weight: 600; font-size: 13px; transition: background .15s, color .15s; }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] { background: var(--raise2); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* スライダー */
.sliders { display: flex; flex-direction: column; gap: 16px; }
.slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 10px; }
.slider output { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink); background: var(--raise); border-radius: 6px; padding: 1px 8px; min-width: 44px; text-align: center; }
.slider input { grid-column: 1 / -1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; margin: 6px 0; cursor: pointer;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--p, 50%) 100% no-repeat, var(--line2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(255,210,63,.25); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(255,210,63,.25); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent); }

/* スイッチ */
.switches { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch:hover { background: rgba(255,255,255,.02); }
.switch input { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0; border-radius: 999px; background: var(--line2); cursor: pointer; transition: background .18s; }
.switch input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #d9d9d4; transition: transform .18s, background .18s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(14px); background: var(--accent-ink); }

/* OBS */
details.obs { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
details.obs summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; height: 40px; color: var(--ink); }
details.obs summary::-webkit-details-marker { display: none; }
details.obs summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--sub); border-bottom: 1.5px solid var(--sub); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
details.obs[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
details.obs summary small { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; }
details.obs[open] { padding-bottom: 12px; }
.steps-mini { margin: 4px 0 12px; padding-left: 18px; color: var(--sub); font-size: 12px; line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.obs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* ---- プレビュー ---- */
.preview-head { display: flex; align-items: center; justify-content: space-between; }
.preview-head h2 { margin: 0; }
.ops { display: flex; gap: 6px; }
.preview { position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 100%; max-height: 62vh; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line);
  background: repeating-conic-gradient(#1b1c20 0 25%, #16171a 0 50%) 0 0 / 20px 20px; }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.transcript { flex: 1; min-height: 160px; display: flex; flex-direction: column; }
.live { min-height: 1.5em; margin: 10px 0 6px; color: var(--sub); }
.tx { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.tx li { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.tx time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }

.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 12px; background: var(--raise2); border: 1px solid var(--line2); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s; max-width: 90vw; }
.toast.on { opacity: 1; translate: -50% 0; }

@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .panel { overflow: visible; }
  .controls { order: 2; }
}
@media (max-width: 640px) {
  .status #statusText, .brand small { display: none; }
  .grid { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mic-btn.on::after, .dot.on { animation: none; }
  * { transition-duration: 0s !important; }
}
