:root {
  --bg: #E6E6E9; --card: #FFFFFF; --line: #E4E4E7; --soft: #EFEFF1;
  --text: #141414; --text2: #3C3C40; --sub: #7B7B82; --faint: #A6A6AD;
  --dark: #1B1B1D; --dark-text: #F4F4F5; --dark-sub: #A3A3AA; --ng: #C2412D;
  --shadow: 0 3px 10px rgba(20, 20, 30, .15);
  --font: "Yu Gothic UI", "Meiryo UI", "Hiragino Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
.app { min-height: 100vh; display: flex; flex-direction: column; padding: 26px 28px 28px; gap: 20px; max-width: 1280px; margin: 0 auto; }

header { display: flex; align-items: center; gap: 14px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: var(--dark); display: grid; place-items: center; flex: none; }
.logo svg { width: 17px; height: 18px; margin-left: 3px; }
h1 { font-size: 24px; margin: 0; line-height: 1.25; }
.lead { margin: 2px 0 0; color: var(--sub); }

main { flex: 1; display: grid; grid-template-columns: 1fr minmax(300px, 32%); gap: 18px; min-height: 560px; }
.card { background: var(--card); border-radius: 22px; }
.left { display: flex; flex-direction: column; padding: 14px; min-width: 0; }
.right { display: flex; flex-direction: column; gap: 18px; }

/* ボタン */
.btn { height: 44px; border-radius: 999px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap; border: 1.3px solid #CDCDD2; background: #fff; color: #4A4A50;
  box-shadow: var(--shadow); text-decoration: none; transition: border-color .12s, color .12s, background .12s; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: #5C5C62; color: var(--text); }
.btn.small { height: 34px; padding: 0 16px; font-size: 13px; }
.btn.light { background: #fff; color: var(--text); border-color: transparent; box-shadow: none; }
.btn.light:hover { background: #E9E9EB; }
.btn.wide { width: 100%; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--dark); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.round svg { width: 14px; height: 14px; }
.round:hover { background: #36363A; }

/* ファイルの切り替え */
.files-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 4px 12px; }
.file-tab { height: 32px; border-radius: 999px; padding: 0 14px; border: 1.3px solid #CDCDD2; background: #fff; font: 13px var(--font);
  color: var(--text2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; max-width: 260px; }
.file-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tab.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.file-tab i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.file-tab i.ok { background: #1F9D55; }
.file-tab i.partial { background: #D9A021; }
.file-tab i.ng { background: var(--ng); }

/* ドロップ欄 */
.drop { flex: 1; border: 2px dashed #C9C9CF; border-radius: 16px; cursor: pointer; display: flex; transition: background .12s, border-color .12s; }
.drop:hover { background: #FAFAFB; }
.drop.over, body.dragging .drop { border-color: #5C5C62; background: #F4F4F6; }
.drop.busy { cursor: progress; }
.empty { margin: auto; text-align: center; padding: 24px; }
.circle { width: 116px; height: 116px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; margin: 0 auto 22px; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0; color: var(--sub); }
.empty .hint { margin-top: 18px; font-size: 12px; color: var(--faint); max-width: 420px; margin-left: auto; margin-right: auto; }

/* プレビュー */
.preview { display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.screen { position: relative; border-radius: 14px; overflow: hidden; background: var(--dark); aspect-ratio: 16 / 9; }
.screen canvas { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.screen-note { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(27, 27, 29, .6); font-weight: 600; }
.controls { display: flex; align-items: center; gap: 12px; }
.controls input[type=range] { flex: 1; accent-color: var(--dark); }
.time { color: var(--sub); font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.range-title { color: var(--sub); font-size: 12px; margin-top: 4px; }
.bar { position: relative; height: 14px; border-radius: 7px; overflow: hidden; background: #E4E4E7; display: flex; cursor: pointer; }
.bar .ok { background: var(--dark); }
.bar .gap { background: repeating-linear-gradient(45deg, var(--ng) 0 3px, #F2D3CD 3px 6px); }
.bar .head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); pointer-events: none; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--sub); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .ok::before { background: var(--dark); }
.legend .gap::before { background: repeating-linear-gradient(45deg, var(--ng) 0 3px, #F2D3CD 3px 6px); }
.audio-note { margin: 0; font-size: 12px; color: var(--faint); }
.again { margin-top: auto; padding-top: 8px; }

/* 右の黒いカード */
.hero { flex: 1; min-height: 260px; border-radius: 22px; background: var(--dark); color: var(--dark-text); position: relative; overflow: hidden;
  padding: 24px 26px; display: flex; flex-direction: column; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(48deg, transparent 0 46%, #232326 46% 62%, transparent 62% 70%, #2C2C30 70% 76%, transparent 76% 81%, #232326 81% 100%); }
.hero > * { position: relative; }
.verdict { align-self: flex-start; background: #fff; color: var(--dark); border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: 13px; }
.verdict.ng { background: var(--ng); color: #fff; }
.hero .label { color: var(--dark-sub); margin-top: 14px; }
.hero .num { font-size: 40px; font-weight: 700; line-height: 1.2; }
.hero .note { color: var(--dark-sub); font-size: 12px; overflow-wrap: anywhere; }
.hero .reason { margin-top: 12px; line-height: 1.7; }
.hero .grow { flex: 1; min-height: 16px; }
.progress { height: 14px; border-radius: 7px; background: #3A3A3E; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: #fff; border-radius: 7px; transition: width .15s; }

.stats { padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.stats span { display: block; color: var(--sub); font-size: 12px; }
.stats b { font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 20px;
  border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  .app { padding: 18px 16px; }
  main { grid-template-columns: 1fr; }
  .hero { min-height: 220px; }
}
