/* style.css — 歌詞動画メーカー */
:root {
  --bg-0: #0d0f12;
  --bg-1: #15181c;
  --bg-2: #1d2127;
  --bg-3: #262b32;
  --line: #2e343c;
  --ink-0: #f2f4f6;
  --ink-1: #aab1ba;
  --ink-2: #6e7680;
  --accent: #6ee7b7;      /* グリーンバック想起のミント */
  --accent-strong: #34d399;
  --accent-soft: rgba(110, 231, 183, 0.14);
  --warn: #f6a96b;
  --danger: #f17171;
  --radius: 10px;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --sans: 'Inter', 'Noto Sans JP', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  color: var(--ink-0);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

/* ===== App Shell ===== */
.app-shell { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  flex-shrink: 0;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-0);
}
.topbar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.topbar .proj-name {
  background: transparent;
  border: 1px solid transparent;
  font-weight: 600;
  padding: 4px 8px;
  min-width: 160px;
}
.topbar .proj-name:hover { border-color: var(--line); }
.topbar .spacer { flex: 1; }
.topbar .save-state { font-size: 12px; color: var(--ink-2); margin-right: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-0);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: #3a414b; background: var(--bg-3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #07130d; border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.icon { padding: 7px; }

/* ===== Project list (home) ===== */
.home {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px;
}
.home h1 { font-size: 22px; margin: 0 0 6px; }
.home .sub { color: var(--ink-1); margin-bottom: 28px; }
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.proj-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: border-color .12s, transform .12s;
}
.proj-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.proj-card .name { font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.proj-card .meta { font-size: 12px; color: var(--ink-2); }
.proj-card .del {
  position: absolute; top: 10px; right: 10px; opacity: 0;
  transition: opacity .12s;
}
.proj-card:hover .del { opacity: 1; }
.proj-card.new {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed;
  color: var(--ink-1);
  min-height: 90px;
  font-weight: 600;
}
.proj-card.new:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Editor layout ===== */
.editor {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr 320px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "left preview right"
    "timeline timeline timeline";
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
}
.panel.right { border-right: none; border-left: 1px solid var(--line); }
.panel h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 0 0 10px;
  font-weight: 700;
}
.panel-section { margin-bottom: 22px; }
.panel-section:last-child { margin-bottom: 0; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--ink-1); margin-bottom: 4px; }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  width: 100%;
}
.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field .range-val { font-size: 11px; color: var(--ink-2); float: right; }
.field input[type=color] {
  width: 100%; height: 32px; padding: 2px; background: var(--bg-2);
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  color: var(--ink-1);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropzone .fname { color: var(--ink-0); font-weight: 600; margin-top: 4px; word-break: break-all; }

textarea.lyrics-input { min-height: 140px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }

/* Preview */
.preview-wrap {
  grid-area: preview;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#15181c 0% 25%, #181b20 0% 50%) 50% / 20px 20px;
  position: relative;
  overflow: hidden;
  padding: 16px;
}
.preview-canvas-box {
  position: relative;
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0,0,0,0.5);
  border-radius: 4px;
  overflow: hidden;
  max-width: 100%;
  max-height: 100%;
}
.preview-canvas-box canvas { display: block; width: 100%; height: 100%; }

.transport {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 16px;
}
.transport .time { font-family: var(--mono); font-size: 12px; color: var(--ink-1); min-width: 84px; text-align: center; }
.transport input[type=range] { width: 280px; accent-color: var(--accent); }

/* Timeline */
.timeline-wrap {
  grid-area: timeline;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  height: 230px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.timeline-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.timeline-toolbar .zoom { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--ink-2); font-size: 12px; }
.timeline-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}
.timeline-track {
  position: relative;
  height: 100%;
  min-width: 100%;
}
.timeline-ruler {
  position: sticky; top: 0; z-index: 3;
  height: 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.timeline-ruler .tick {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
  font-size: 10px; color: var(--ink-2);
  padding-left: 3px;
}
.timeline-lines { position: relative; }
.timeline-row {
  position: relative;
  height: 30px;
  border-bottom: 1px solid #20242a;
}
.lyric-block {
  position: absolute;
  top: 4px; bottom: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--ink-0);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  user-select: none;
}
.lyric-block.selected { background: rgba(110,231,183,0.32); border-color: #fff; box-shadow: 0 0 0 1px #fff; }
.lyric-block .handle {
  position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize;
}
.lyric-block .handle.l { left: 0; }
.lyric-block .handle.r { right: 0; }
.playhead {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--danger);
  z-index: 5; pointer-events: none;
}
.playhead::before {
  content: ''; position: absolute; top: 0; left: -4px;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--danger);
}

/* Effect picker grid */
.effect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.effect-opt {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 7px;
  padding: 8px 8px;
  font-size: 11.5px;
  text-align: left;
  line-height: 1.3;
  color: var(--ink-1);
}
.effect-opt:hover { border-color: var(--accent); }
.effect-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink-0); font-weight: 600; }

.empty-hint {
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: center;
  padding: 30px 10px;
}

/* Export modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,7,9,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 92vw;
}
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.progress-bar {
  height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; margin: 12px 0 6px;
}
.progress-bar .fill { height: 100%; background: var(--accent); transition: width .15s; }
.modal .stage { font-size: 12px; color: var(--ink-2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--ink-0);
  padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.error { border-color: var(--danger); color: var(--danger); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 6px; border: 2px solid var(--bg-1); }
