/* カケアイAI — ビルド不要のプレーン CSS（Xserver へそのまま配置） */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --text: #1f2328;
  --muted: #646a73;
  --line: #e2dfd8;
  --primary: #e8590c;
  --primary-ink: #ffffff;
  --primary-soft: #fff0e6;
  --accent: #1c7ed6;
  --ok: #2b8a3e;
  --ok-soft: #e6f4ea;
  --warn: #b35c00;
  --warn-soft: #fff4e0;
  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --rec: #e03131;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --surface: #1d2024; --surface-2: #25292e; --text: #e8e9eb; --muted: #9aa1aa;
    --line: #33383e; --primary: #ff7a2e; --primary-soft: #3a2416; --ok-soft: #173222; --warn-soft: #3a2c12;
    --danger-soft: #3c1b1b; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* 端末の幅より広い要素があっても、ページ全体が左右に動かないようにする */
/* （body に hidden を付けると sticky ヘッダーが効かなくなるため、html は hidden、body は clip のみ） */
html { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.7; font-size: 15px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
[hidden] { display: none !important; }

/* レイアウト */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .85rem; }
.brand .tag { font-size: .7rem; font-weight: 600; background: var(--text); color: var(--bg); padding: 1px 6px; border-radius: 4px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a, .nav button.linklike { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .92rem; }
.nav a:hover, .nav a.active { background: var(--surface-2); }
.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.container.narrow { max-width: 560px; }
.container.mid { max-width: 820px; }
.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 16px 40px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 800; letter-spacing: .01em; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; min-height: 40px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: .88rem; }
.btn.large { padding: 14px 26px; font-size: 1.05rem; min-height: 52px; }
button.linklike { background: none; border: none; font: inherit; cursor: pointer; color: var(--accent); padding: 0; }

/* フォーム */
label.field, .field { display: block; margin-bottom: 14px; }
.field > .label, label.field > span.label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .93rem; }
.field .hint { display: block; color: var(--muted); font-size: .82rem; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit;
  /* iPhone の Safari は 16px 未満の入力欄にフォーカスすると画面を拡大し、戻したあとも横にずれるため 16px 以上にする */
  font-size: max(16px, 1em); max-width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 1px; border-color: var(--primary); }
.req { color: var(--danger); font-size: .8em; margin-left: 4px; }
.error-text { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: inline-block; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: .92rem; }
.choice input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.choice input:focus-visible + span { outline: 2px solid var(--primary); }
.checkbox { display: flex; gap: 8px; align-items: flex-start; }
.checkbox input { margin-top: .35em; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.filters .field { margin: 0; }

/* お知らせ */
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 14px; }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.info { background: var(--surface-2); }
.alert > strong { display: block; margin-bottom: 2px; }
.alert ul { margin: 4px 0 0; padding-left: 1.2em; }

/* バッジ */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.live { background: var(--primary-soft); color: var(--primary); }
.badge.rec { background: var(--rec); color: #fff; }

/* テーブル */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 8px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; word-break: break-word; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); font-size: .9rem; }
.pagination .current { background: var(--text); color: var(--bg); border-color: var(--text); }
.pagination .disabled { opacity: .4; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

/* ランディング */
.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); margin-bottom: .4em; }
.hero .lead { font-size: 1.08rem; color: var(--muted); max-width: 640px; margin: 0 auto 24px; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 56px; position: relative; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.notice-list { padding-left: 1.2em; margin: 0; }
.notice-list li { margin-bottom: 6px; }

/* 撮影画面 */
.studio-steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.studio-steps span { font-size: .85rem; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.studio-steps span.current { background: var(--primary); color: #fff; font-weight: 700; }
.studio-steps span.done { background: var(--primary-soft); color: var(--primary); }

.preview-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.preview-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; transform: scaleX(-1); }
.preview-wrap.no-mirror video { transform: none; }
.preview-overlay { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.preview-overlay .badge { background: rgba(0,0,0,.6); color: #fff; }
.preview-overlay .badge.rec { background: var(--rec); }
.preview-overlay .badge.live-on { background: rgba(232, 89, 12, .9); }

.meter { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }

.live-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 900px) { .live-layout { grid-template-columns: 1fr; } }
.ai-state { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ai-state .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.ai-state[data-state=listening] .dot { background: var(--ok); animation: pulse 1.6s infinite; }
.ai-state[data-state=speaking] .dot { background: var(--primary); animation: pulse .7s infinite; }
.ai-state[data-state=connecting] .dot, .ai-state[data-state=reconnecting] .dot { background: var(--warn); animation: pulse 1s infinite; }
.ai-state[data-state=error] .dot, .ai-state[data-state=disconnected] .dot { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.transcript { height: 260px; overflow-y: auto; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .93rem; }
.transcript p { margin: 0 0 8px; }
.transcript .sys { color: var(--muted); font-size: .82rem; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 800; }
.live-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.device-indicator { display: flex; gap: 8px; align-items: center; font-size: .85rem; }
.device-indicator .on { color: var(--rec); font-weight: 700; }

.download-box { border: 2px dashed var(--primary); background: var(--primary-soft); border-radius: var(--radius); padding: 18px; }
.os-guide details { border-top: 1px solid var(--line); padding: 8px 0; }
.os-guide summary { cursor: pointer; font-weight: 600; }

.preset-card { display: flex; flex-direction: column; gap: 8px; }
.preset-card .name { font-weight: 700; }
.preset-card .summary { color: var(--muted); font-size: .86rem; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .75rem; color: var(--muted); }
.bars .bar i { display: block; width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (max-width: 640px) { .hide-sm { display: none; } }

/* 会話スタイルのやりとり例 */
.style-example { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; font-size: .9rem; }
.style-example > p { margin: 0 0 8px; }
.style-example .style-example-title { font-weight: 700; font-size: .82rem; margin: 10px 0 6px; }
.style-example-lines { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0 0 6px; }
.style-example-lines dt { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; align-self: start; text-align: center; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.style-example-lines dt.ai { color: var(--accent); border-color: currentColor; }
.style-example-lines dd { margin: 0; }
.style-example .hint { font-size: .78rem; margin: 0; }
.style-example > p:last-child { margin-bottom: 0; }

/* アップロードした録画（字幕付き再生） */
.recording-layout { align-items: start; }
.rec-player { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; display: block; }
.rec-player::cue { font-size: 1.05em; background: rgba(0, 0, 0, .7); }
.subtitle-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.subtitle-list li { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: baseline; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.subtitle-list li:last-child { border-bottom: none; }
.subtitle-list li.active { background: var(--primary-soft); }
.subtitle-list .ts { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: none; padding: 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.subtitle-list .who { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.subtitle-list .who.ai { color: var(--accent); border-color: currentColor; }
.subtitle-list .txt { word-break: break-word; }
.upload-box { margin-top: 16px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.upload-box h3 { margin-top: 0; }
.upload-box .meter > i { background: var(--primary); transition: width .2s linear; }
