:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1f2328;
  --sub: #6b6f76;
  --line: #e2ded6;
  --accent: #1f6f78;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0f1;
  --warn: #9a5b13;
  --warn-soft: #fbf3e6;
  --radius: 10px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); display: flex; flex-direction: column; font-size: 14px; }
button, select, input { font: inherit; color: inherit; }

/* 上のバー */
.bar { display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); position: relative; }
.mark::after { content: ""; position: absolute; left: 6px; top: 4px; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.file { flex: 1; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 8px 16px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { border-color: #c9c3b8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: .5; cursor: default; filter: none; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; padding: 11px; }

main { flex: 1; min-height: 0; display: flex; }

/* 最初の画面 */
.drop { flex: 1; display: grid; place-items: center; padding: 24px; }
.drop-inner { text-align: center; max-width: 520px; padding: 48px 40px; border: 2px dashed #cfc9be; border-radius: 18px; background: var(--panel); }
.drop.over .drop-inner { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 56px; height: 64px; margin: 0 auto 18px; border-radius: 8px; border: 2px solid var(--accent); position: relative; }
.drop-icon::after { content: ""; position: absolute; left: 20px; top: 20px; border-left: 18px solid var(--accent); border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.drop h1 { font-size: 20px; margin: 0 0 8px; }
.drop p { color: var(--sub); line-height: 1.7; margin: 0 0 18px; }
.drop .note { font-size: 12px; margin: 18px 0 0; }
.loading { margin-top: 20px; display: grid; gap: 6px; color: var(--sub); font-size: 12px; }
.error { color: #b42318 !important; margin-top: 16px !important; white-space: pre-wrap; }
.meter { height: 6px; background: #ece8e1; border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* ビューア */
.viewer { flex: 1; display: grid; grid-template-columns: 188px 1fr 300px; min-height: 0; }
.slides { overflow-y: auto; padding: 12px 10px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.slide { border: 2px solid transparent; border-radius: 8px; padding: 4px; cursor: pointer; background: none; text-align: left; }
.slide:hover { background: #f6f4f0; }
.slide.on { border-color: var(--accent); }
.slide.off { opacity: .55; }
.slide img, .slide .ph { width: 100%; aspect-ratio: 16/9; border-radius: 4px; display: block; background: #eee; border: 1px solid var(--line); object-fit: cover; }
.slide .cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin-top: 4px; padding: 0 2px; }
.slide .cap b { color: var(--ink); font-weight: 600; }
.tag { font-size: 10px; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.tag.none { background: #efede9; color: var(--sub); }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px; gap: 12px; }
.stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
#stage { max-width: 100%; max-height: 100%; aspect-ratio: 16/9; background: #000; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }

.controls { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.icon { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 14px; line-height: 1; }
.icon.play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; border-color: var(--accent); font-size: 15px; }
.time { font-variant-numeric: tabular-nums; color: var(--sub); min-width: 100px; text-align: center; font-size: 13px; }
.seek { flex: 1; position: relative; height: 24px; display: flex; align-items: center; }
.seek input { width: 100%; margin: 0; accent-color: var(--accent); position: relative; z-index: 1; background: transparent; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.marks i { position: absolute; top: 3px; bottom: 3px; width: 1px; background: #c9c3b8; }
#volume { width: 80px; accent-color: var(--accent); }
select { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--panel); }

.side { border-left: 1px solid var(--line); background: var(--bg); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h2 { font-size: 14px; margin: 0 0 12px; }
.card summary { font-weight: 700; cursor: pointer; }
details.card[open] summary { margin-bottom: 12px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--sub); display: flex; justify-content: space-between; }
.field input[type=range] { accent-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--panel); padding: 6px 4px; cursor: pointer; font-size: 12px; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.estimate { font-size: 12px; color: var(--sub); margin: 0 0 10px; line-height: 1.6; }
.progress { margin-top: 12px; display: grid; gap: 8px; }
.progress p { margin: 0; font-size: 12px; color: var(--sub); line-height: 1.5; }
.progress .btn { justify-self: start; }
.result { margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--accent-soft); font-size: 12px; line-height: 1.6; }
.result a { display: block; margin-top: 8px; }
.result video { width: 100%; margin-top: 8px; border-radius: 6px; background: #000; }
.hint { font-size: 11px; color: var(--sub); margin: 10px 0 0; line-height: 1.6; }
.warn { background: var(--warn-soft); border-color: #efdcbc; }
.warn h2 { color: var(--warn); }
.warn ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.6; color: #5c4320; }

@media (max-width: 1100px) {
  .viewer { grid-template-columns: 150px 1fr; }
  .side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .viewer { grid-template-rows: 1fr auto; overflow-y: auto; }
}
