:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #e3e8ef;
  --fg: #1d2430;
  --muted: #6b7789;
  --accent: #e8734a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.7;
}
.zh { font-family: "PingFang SC", "Hiragino Sans GB", sans-serif; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 17px; margin: 0; }

main { display: flex; height: calc(100vh - 57px); }

aside {
  width: 262px; flex: none; background: var(--panel);
  border-right: 1px solid var(--line); overflow-y: auto; padding: 14px;
}
button.act.big { width: 100%; padding: 11px 16px; font-size: 14px; margin-bottom: 14px; }

#projects { list-style: none; margin: 0; padding: 0; }
#projects li {
  padding: 10px 12px; border-radius: 9px; cursor: pointer; margin-bottom: 4px;
}
#projects li:hover { background: #f2f5f9; }
#projects li.on { background: #fff1ea; box-shadow: inset 0 0 0 1px #f3c4b0; }
#projects li b { display: block; font-size: 14px; }
#projects li span { font-size: 11.5px; color: var(--muted); }

section#workspace { flex: 1; overflow-y: auto; padding: 22px 28px 60px; }
section#workspace.empty { display: flex; align-items: center; justify-content: center; }
.hint { color: var(--muted); }

.wshead { display: flex; align-items: center; justify-content: space-between; }
.wshead h2 { margin: 0 0 12px; font-size: 20px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  background: none; border: none; padding: 9px 15px; cursor: pointer;
  font-size: 13.5px; color: var(--muted); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* このあとに display を持つ規則（.dlg など）が来ても隠れたままにする */
.tab.hidden, .hidden { display: none !important; }
.row { display: flex; gap: 26px; }
.col { flex: 1; min-width: 0; }

h3 { font-size: 14.5px; margin: 0 0 6px; }
.note { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.msg { color: var(--muted); font-size: 12.5px; }
.msg.err { color: #d1493f; }

input, select, textarea, button { font-family: inherit; font-size: 13px; }
input[type=text], input:not([type]), input[type=number], input[type=password], select {
  padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff;
}
textarea {
  width: 100%; height: 430px; padding: 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; resize: vertical;
}
label { display: block; margin-bottom: 10px; }

button.act {
  background: var(--accent); color: #fff; border: none; border-radius: 7px;
  padding: 8px 16px; cursor: pointer; font-weight: 700;
}
button.ghost {
  background: #fff; border: 1px solid #cbd5e1; border-radius: 7px;
  padding: 8px 14px; cursor: pointer; color: var(--fg); text-decoration: none;
}
a.ghost { display: inline-block; }
.btns { display: flex; gap: 9px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

.themes { display: flex; flex-wrap: wrap; gap: 8px; }
button.theme {
  display: flex; align-items: center; gap: 7px; background: #fff;
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 12px; cursor: pointer;
}
.sw {
  width: 26px; height: 18px; border-radius: 4px; border: 2px solid;
  display: inline-flex; align-items: center; justify-content: center;
}
.sw i { width: 8px; height: 8px; border-radius: 2px; display: block; }

table.cues { width: 100%; border-collapse: collapse; }
table.cues th {
  text-align: left; font-size: 12px; color: var(--muted);
  padding: 5px 6px; border-bottom: 1px solid var(--line);
}
table.cues td { padding: 3px 4px; }
table.cues input { width: 100%; }
table.cues td:nth-child(1), table.cues td:nth-child(2) { width: 88px; }
table.cues td:last-child { width: 34px; }
button.del {
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 15px; padding: 4px;
}

.progress { height: 6px; background: #e6eaf0; border-radius: 4px; margin: 12px 0 7px; }
.progress .bar { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }

video { width: 100%; max-width: 720px; margin-top: 14px; border-radius: 9px; background: #000; }

.dlg {
  position: fixed; inset: 0; background: rgba(20, 26, 36, .45);
  display: flex; align-items: center; justify-content: center;
}
.dlgbox {
  background: #fff; border-radius: 12px; padding: 22px 24px; width: 420px;
}
.dlgbox input { width: 100%; }


#projects li .kind {
  display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: #eef2f7; color: var(--muted); margin-left: 6px;
}
.cardlist { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.cardlist .item { width: 186px; }
.cardlist video { width: 186px; margin: 0; border-radius: 8px; }
.cardlist .cap {
  font-size: 11.5px; color: var(--muted); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
label.filelabel { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* ---------------- 一句カードの編集画面 ---------------- */
.cardsplit { display: flex; gap: 20px; align-items: flex-start; }
.cardnav { width: 190px; flex: none; }
.cardnav ul { list-style: none; margin: 12px 0 0; padding: 0; }
.cardnav li { padding: 8px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 3px; }
.cardnav li:hover { background: #f2f5f9; }
.cardnav li.on { background: #fff1ea; box-shadow: inset 0 0 0 1px #f3c4b0; }
.cardnav li b { display: block; font-size: 13px; }
.cardnav li span { font-size: 11px; color: var(--muted); }
.cardedit { flex: 1; min-width: 0; }

.titleinput { font-size: 17px; font-weight: 700; border: none; border-bottom: 1px solid var(--line);
  padding: 4px 2px; width: 60%; background: none; }

.pagebox { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 12px; background: #fff; }
.pagehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pagehead b { font-size: 13px; }
.pagetools { display: flex; align-items: center; gap: 6px; }
button.mini { font-size: 11.5px; padding: 3px 8px; border-radius: 5px;
  border: 1px solid #cbd5e1; background: #fff; cursor: pointer; }
button.mini.act { background: var(--accent); color: #fff; border: none; font-weight: 700; }
.pagetools .audio { font-size: 11px; color: #b0453c; }
.pagetools .audio.ok { color: #2f8f56; }

textarea.pagetext { height: 88px; font-family: inherit; font-size: 14px; }

/* ふりがなの確認欄。空のものは色を変えて見落とさないようにする */
.rubybox { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rubyitem { display: inline-flex; flex-direction: column; align-items: center;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: #fbfcfd; }
.rubyitem.empty { border-color: #e8a89f; background: #fff6f4; }
.rubyitem .kanji { font-size: 14px; line-height: 1.2; }
.rubyitem input { width: 68px; font-size: 11.5px; text-align: center; border: none;
  border-top: 1px solid var(--line); background: none; padding: 2px 0; }

table.vocabedit { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
table.vocabedit th { text-align: left; font-size: 11.5px; color: var(--muted);
  padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.vocabedit td { padding: 4px 6px; vertical-align: top; }
table.vocabedit td:nth-child(1) { width: 22%; }
table.vocabedit td:nth-child(2) { width: 42%; }
table.vocabedit td:last-child { width: 30px; }
table.vocabedit input { width: 100%; }

.speech { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.speech .lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.speech input { flex: 1; }
.bulk { margin-bottom: 12px; }
.bulk textarea { height: 96px; font-size: 12.5px; }
.bulk button { margin-top: 6px; }
.bulk .note { margin-top: 6px; }
.voicerow { display: flex; gap: 7px; margin-bottom: 4px; }
.voicerow input { flex: 1; min-width: 0; }
#voice-msg { white-space: pre-line; }
label.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
label.inline .note { margin: 0; }
label.mini.upl { display: inline-block; margin: 0; cursor: pointer;
  font-size: 11.5px; padding: 3px 8px; border-radius: 5px;
  border: 1px solid #cbd5e1; background: #fff; }
.timingrow { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.timingrow .tlabel { width: 130px; font-size: 12.5px; }
.timingrow input { width: 82px; }
.timingrow .tat { font-size: 12px; color: var(--muted); }
.modepick { display: flex; gap: 20px; margin-bottom: 10px; }
#whole-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #fbfcfd; margin-bottom: 14px; }
#whole-player { width: 100%; max-width: 520px; margin-top: 10px; }

/* ---------------- タイムライン ---------------- */
#timeline { margin: 10px 0 6px; user-select: none; }
.ruler { position: relative; height: 16px; margin-bottom: 2px; }
.ruler span { position: absolute; font-size: 10.5px; color: var(--muted);
  transform: translateX(-50%); white-space: nowrap; }
.track { position: relative; display: flex; height: 34px; margin-bottom: 5px;
  background: #eef1f5; border-radius: 6px; overflow: hidden; }
.track.audio { height: 26px; }
.clip { position: relative; height: 100%; display: flex; align-items: center;
  border-right: 1px solid rgba(255,255,255,.85); overflow: hidden; }
.cliplabel { font-size: 11px; color: #fff; padding-left: 8px;
  white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.clip.audioclip { background: #6b7789; color: #fff; font-size: 11px;
  padding-left: 8px; border-radius: 6px; }
.grip { position: absolute; right: 0; top: 0; bottom: 0; width: 8px;
  cursor: col-resize; background: rgba(255,255,255,.5); }
.grip:hover { background: rgba(255,255,255,.9); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px;
  background: #d1493f; pointer-events: none; }
.note.warn { color: #b0453c; }
audio.pageaudio { width: 100%; max-width: 460px; height: 34px; margin-top: 10px; }
.clip { cursor: pointer; }
.clip:hover { filter: brightness(1.12); }

/* 音量 */
.vols { display: flex; flex-direction: column; gap: 6px; }
label.vol { display: grid; grid-template-columns: 72px 1fr 46px;
  align-items: center; gap: 8px; margin: 0; font-size: 12.5px; }
label.vol input[type=range] { width: 100%; }
.volnum { font-size: 11.5px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums; }

/* タイムライン：押せる／鳴っているのが分かるように */
.clip.noaudio { cursor: default; opacity: .72; }
.clip.playing { box-shadow: inset 0 0 0 3px #fff; filter: brightness(1.2); }
.clip.playing .cliplabel { font-weight: 700; }


/* ---------------- 最初の画面 ---------------- */
.welcome { max-width: 720px; text-align: center; }
.welcome h2 { font-size: 22px; margin: 0 0 6px; }
.welcome .lead { color: var(--muted); margin: 0 0 22px; }
.choices { display: flex; gap: 16px; }
button.choice {
  flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 20px; cursor: pointer; text-align: left; font-family: inherit;
  display: flex; flex-direction: column; gap: 6px; transition: .15s;
}
button.choice:hover { border-color: var(--accent); box-shadow: 0 3px 14px rgba(232,115,74,.14); }
button.choice .ico { font-size: 26px; }
button.choice b { font-size: 15px; }
button.choice .desc { font-size: 12.5px; color: var(--muted); line-height: 1.65; }

.firsthint { background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; }
.firsthint h3 { font-size: 15px; margin-bottom: 6px; }
.firsthint p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
ol.flow { margin: 0; padding-left: 20px; color: var(--fg); font-size: 13px; }
ol.flow li { margin-bottom: 5px; }

/* ---------------- 進み具合の帯 ---------------- */
ol.steps { display: flex; gap: 6px; list-style: none; margin: 14px 0 8px; padding: 0; }
ol.steps li {
  flex: 1; display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  background: #eef1f5; border-radius: 8px; padding: 8px 12px;
}
ol.steps li b {
  width: 20px; height: 20px; border-radius: 50%; background: #cbd5e1; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
ol.steps li.done { background: #eaf6ee; color: #2f8f56; }
ol.steps li.done b { background: #2f8f56; }
ol.steps li.done b::after { content: "✓"; }
ol.steps li.done b { font-size: 0; }
ol.steps li.done b::after { font-size: 12px; }
ol.steps li.now { background: #fff1ea; color: var(--accent); font-weight: 700; }
ol.steps li.now b { background: var(--accent); }
.nexthint { font-size: 13px; color: var(--fg); background: #fffaf7;
  border-left: 3px solid var(--accent); padding: 8px 12px; margin: 0 0 18px; }

/* ---------------- 各段 ---------------- */
.stepbox { border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 18px 20px; margin-bottom: 14px; }
.stepbox h3 { display: flex; align-items: center; gap: 9px; font-size: 15px;
  margin-bottom: 8px; }
.stepbox h3 .num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.btns .sep { flex: 1; }
details.design summary { font-size: 13px; color: var(--muted); cursor: pointer; }
