:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e4e7ef;
  --blue: #2f6fde; --blue-soft: #e8f0ff; --green: #1f9d55; --green-soft: #e3f6ea;
  --amber: #c98a00; --amber-soft: #fff4d6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
a { color: var(--blue); text-decoration: none; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 96px; }
.muted { color: var(--muted); font-size: 14px; font-weight: normal; }

/* 머리줄 */
.top { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 3px solid var(--blue);
  display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.logo { font-weight: 800; font-size: 18px; color: var(--ink); }
.logo span { color: var(--blue); font-weight: 600; font-size: 13px; margin-left: 4px; }
.tabs a { margin-left: 4px; padding: 6px 12px; border-radius: 8px; color: var(--ink); }
.tabs a.on { background: var(--blue); color: #fff; }

/* 휴대폰: 아래 탭 */
.bottom { display: none; }
@media (max-width: 640px) {
  .tabs { display: none; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff;
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { flex: 1; text-align: center; padding: 8px 0 6px; font-size: 12px; color: var(--muted); }
  .bottom a b { display: block; font-size: 20px; line-height: 1.2; }
  .bottom a.on { color: var(--blue); font-weight: 700; }
}

.card, .hello { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.hello { background: linear-gradient(135deg, #2f6fde, #5a8ff0); color: #fff; }
.hello h1 { margin: 4px 0 10px; font-size: 22px; }
.hello .muted { color: #e6eeff; margin: 8px 0 0; }
.day { font-size: 13px; opacity: .85; }
.stage-chip { display: inline-block; background: rgba(255,255,255,.2); border-radius: 20px; padding: 4px 12px; font-weight: 700; }
.stage-chip span { font-weight: normal; opacity: .85; }
h2 { font-size: 18px; margin: 0 0 6px; }

/* 표현 한 줄 */
.phrase { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.phrase .txt { flex: 1; min-width: 0; }
.en { font-weight: 700; font-size: 17px; }
.ko { color: var(--muted); font-size: 14px; }
.situ { font-size: 12px; color: var(--blue); }
.phrase.big .en { font-size: 21px; }
.say { border: 0; background: var(--blue-soft); border-radius: 50%; width: 42px; height: 42px; font-size: 19px;
  cursor: pointer; flex: none; }
.say.slow { width: 34px; height: 34px; font-size: 15px; background: #f0f2f7; }
.say:active { transform: scale(.92); }
.marks { display: flex; gap: 4px; flex: none; }
.mark { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 6px; font-size: 12px;
  line-height: 1.25; min-width: 56px; cursor: pointer; }
.mark small { font-size: 11px; }
.mark.s1 { background: var(--amber-soft); border-color: #f1d27a; color: var(--amber); }
.mark.s2 { background: var(--green-soft); border-color: #9fd9b5; color: var(--green); font-weight: 700; }
@media (max-width: 480px) {
  .phrase:not(.big) { flex-wrap: wrap; }
  .phrase:not(.big) .marks { width: 100%; padding-left: 88px; }
}

/* 묶음 (처음엔 접힘) */
details.group { background: var(--card); border-radius: 14px; padding: 4px 16px; margin-bottom: 10px; }
details.group summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 17px; }
.cnt { font-weight: normal; font-size: 13px; color: var(--muted); margin-left: 6px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tools input { flex: 1; min-width: 160px; }

/* 숫자 */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.stat { flex: 1; min-width: 120px; background: #f6f8fc; border-radius: 10px; padding: 10px 12px; }
.stat.wide { flex-basis: 100%; }
.lbl { font-size: 13px; color: var(--muted); }
.num { font-size: 26px; font-weight: 800; }
.num small { font-size: 13px; font-weight: normal; color: var(--muted); margin-left: 2px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: var(--green); }

/* 버튼·입력 */
.btn { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 18px; font-size: 16px; font-weight: 700; cursor: pointer; text-align: center; }
.ghost { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 14px; cursor: pointer; }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { font-size: 13px; color: var(--muted); }
.form .wide, .form .quick { grid-column: 1 / -1; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.more { display: block; margin-top: 10px; font-size: 14px; }

/* 기록 표 (안쪽 스크롤 없음) */
.log { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.log th { position: sticky; top: 58px; background: #fff; text-align: left; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); padding: 6px 4px; }
.log td { border-bottom: 1px solid var(--line); padding: 8px 4px; vertical-align: top; }
.x { border: 0; background: none; color: #c33; cursor: pointer; font-size: 15px; }

/* 계획 */
.stage { border-left: 5px solid var(--line); }
.stage.now { border-left-color: var(--blue); }
.stage.done { opacity: .7; border-left-color: var(--green); }
.stage p { margin: 6px 0; }
.tag { font-style: normal; background: var(--blue); color: #fff; font-size: 12px; border-radius: 10px; padding: 2px 8px; }
.media { padding-left: 18px; margin: 8px 0 0; font-size: 14px; }
.media li { margin: 4px 0; }
.kind { font-size: 11px; background: var(--blue-soft); color: var(--blue); border-radius: 6px; padding: 1px 6px; }

/* 듣기 목록 */
.who-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin: 10px 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 14px; font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--blue); color: #fff; font-weight: 700; }
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.player iframe, .player #yt { position: absolute; inset: 0; width: 100%; height: 100%; }
.now-info { margin: 10px 0 8px; }
.now-title { font-size: 19px; font-weight: 800; }
.now-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.now-btns .btn { flex: 1 1 220px; }
.btn.green { background: var(--green); }
.toast { margin-top: 10px; background: var(--green-soft); color: var(--green); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.all-done { font-size: 17px; font-weight: 700; color: var(--green); }
.vrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.vrow.playing { background: var(--blue-soft); margin: 0 -16px; padding: 10px 16px; }
.vrow .no { width: 22px; text-align: right; color: var(--muted); font-size: 13px; flex: none; }
.thumb { position: relative; border: 0; padding: 0; background: #000; border-radius: 8px; overflow: hidden;
  width: 120px; aspect-ratio: 16 / 9; flex: none; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-style: normal; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.vtxt { flex: 1; min-width: 0; }
.vtitle { font-weight: 700; }
.vbtns { display: flex; gap: 4px; flex: none; }
.ghost.sm { padding: 5px 9px; font-size: 14px; min-width: 34px; }
#doneList .up, #doneList .down, #doneList .top { display: none; }
#doneList .vrow { opacity: .75; }
@media (max-width: 640px) {
  .vrow { flex-wrap: wrap; }
  .thumb { width: 104px; }
  .vbtns { width: 100%; justify-content: flex-end; }
}
.form > *, .vtxt, .now-info { min-width: 0; }
.vtitle, .now-title { overflow-wrap: anywhere; }

/* 코드 업데이트 */
.flash { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: #fdecea; color: #b42318; }
.err { color: #b42318; }
.laptop-stop { background: #fdecea; border: 2px solid #e5484d; border-radius: 12px; padding: 14px; margin-top: 10px; line-height: 1.7; }
.laptop-stop .t { font-weight: 800; color: #b42318; font-size: 17px; }
.pw-form { max-width: 360px; margin-top: 10px; }
.code-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.code-form input[type=file] { flex: 1; min-width: 220px; }
.lock-form { margin-top: 10px; }
.card.stale { border: 2px solid #E3B9B2; background: #FBEFED; }
code { font-size: 13px; background: #f0f2f7; border-radius: 4px; padding: 1px 4px; overflow-wrap: anywhere; }
.foot { text-align: center; font-size: 12px; margin: 10px 0 0; }
.foot a { color: var(--muted); }

/* 노래 / 영상 나눔 */
.kind-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.kind-tabs a { flex: 1; text-align: center; background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.kind-tabs a small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.kind-tabs a.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.kind-tabs a.on small { color: #dfe9ff; }

/* 홈 화면에 추가 */
.a2hs { border: 0; background: var(--amber-soft); color: #7a5600; font-weight: 700; font-size: 13px;
  border-radius: 20px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.a2hs-modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex;
  align-items: flex-end; justify-content: center; padding: 16px; }
.a2hs-modal[hidden] { display: none; }
.a2hs-modal .box { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 420px;
  margin-bottom: env(safe-area-inset-bottom); line-height: 1.7; }
.a2hs-modal h3 { margin: 0 0 6px; }
.a2hs-modal ol { padding-left: 20px; margin: 6px 0; }
.a2hs-modal .btn { width: 100%; margin-top: 8px; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 13px; }

/* 말하기 (Sunny 와 대화) */
.topic-sel { width: auto; max-width: 100%; flex: 1; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.auto { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.auto input { width: auto; }
#chat { display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 88%; border-radius: 16px; padding: 10px 14px; }
.bub .en { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.bub.ai { align-self: flex-start; background: var(--blue-soft); border-top-left-radius: 4px; }
.bub.ai .who { font-size: 12px; color: var(--blue); font-weight: 700; }
.bub.me { align-self: flex-end; background: var(--green-soft); border-top-right-radius: 4px; }
.bub.me .en { font-weight: 600; font-size: 17px; }
.bub.wait { color: var(--muted); font-style: italic; }
.bub-btns { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.bub .ko { margin-top: 4px; }
.hints { margin-top: 10px; border-top: 1px dashed #b9cdf3; padding-top: 6px; }
.hint { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.hint .say { width: 36px; height: 36px; font-size: 16px; background: #fff; }
.hint .txt { flex: 1; min-width: 0; }
.hint .en { font-size: 16px; }
.kotag { font-size: 11px; background: var(--amber-soft); color: var(--amber); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.talk-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); margin: 14px -16px -16px;
  padding: 12px 16px; border-radius: 0 0 14px 14px; }
.mic-row { display: flex; gap: 8px; }
.mic { flex: 1; border: 0; border-radius: 14px; background: var(--blue); color: #fff; font-size: 18px; font-weight: 800;
  padding: 16px 10px; cursor: pointer; }
.mic.ko { flex: 0 0 auto; background: var(--amber-soft); color: #7a5600; font-size: 15px; }
.mic.on { background: #e5484d; color: #fff; animation: pulse 1.2s infinite; }
.mic:disabled, .btn:disabled { opacity: .5; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(229,72,77,.15); } }
.type-row { display: flex; gap: 6px; margin-top: 8px; }
.type-row input { flex: 1; min-width: 0; }
.small { font-size: 13px; margin-top: 6px; }
.end { width: 100%; margin-top: 8px; }
.praise { background: var(--green-soft); color: #14663a; border-radius: 10px; padding: 8px 12px; margin: 4px 0 8px; }
.past-msgs { padding: 6px 0 12px; font-size: 14px; }
.pm { padding: 3px 0; }
.pm b { color: var(--blue); margin-right: 4px; }
.pm.me b { color: var(--green); }
@media (max-width: 640px) {
  .talk-bar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .bub { max-width: 94%; }
}
