/* 쓰작 — 모바일 공통 스타일 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1220; --panel: #181c2e; --panel2: #202540;
  --text: #e8e9f0; --dim: #9298b8; --line: #2a3050;
  --accent: #f5c56b; --accent2: #7aa2ff; --bad: #e07a7a;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 15px; line-height: 1.6;
  max-width: 560px; margin: 0 auto;
}
.hidden { display: none !important; }
.view { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== 생성 화면 ===== */
#view-create { padding: 40px 20px 30px; gap: 26px; }
.create-hero h1 { font-size: 34px; letter-spacing: 1px; }
.tagline { color: var(--accent); margin-top: 6px; }
.create-section h2 { font-size: 15px; color: var(--dim); margin-bottom: 12px; }
.search-row { display: flex; gap: 8px; }
input, select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 15px; outline: none;
}
input:focus { border-color: var(--accent2); }
button {
  padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 14px; cursor: pointer;
}
button.primary { background: var(--accent); color: #201a08; border: none; font-weight: 700; }
.search-result { margin-top: 10px; padding: 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); white-space: pre-line; color: var(--dim); }
.hint { color: var(--dim); font-size: 12.5px; margin-bottom: 12px; line-height: 1.7; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 20px; background: var(--panel);
  border: 1px solid var(--line); font-size: 13px; color: var(--dim);
}
.chip:active { border-color: var(--accent); color: var(--accent); }
button.small { font-size: 12.5px; padding: 6px 4px; text-align: left; }
.form { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: flex; gap: 10px; }
.fine { color: var(--dim); font-size: 12.5px; text-align: center; margin-top: auto; }

/* ===== 메인 헤더 ===== */
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 14px 16px 0;
}
.head-top { display: flex; justify-content: space-between; align-items: flex-start; }
.h-name { font-size: 18px; font-weight: 700; }
.h-goal { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.h-right { text-align: right; }
.h-day { font-size: 12px; color: var(--accent2); }
#btn-reset { padding: 4px 10px; font-size: 13px; margin-top: 4px; }
.head-bottom { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.luck-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: 14px; cursor: pointer; }
.luck-icon { color: var(--accent); }
.slots { display: flex; gap: 5px; flex: 1; }
.slot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.slot.used { background: var(--line); }
.intervene-btn { background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.progress { height: 3px; background: var(--line); margin: 0 -16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .6s; }

/* ===== 지금 (라이브 장면) ===== */
main { flex: 1; overflow-y: auto; }
.pane { padding: 18px 16px 90px; }
.now-time { text-align: center; color: var(--dim); font-size: 12.5px; margin-bottom: 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.narr { color: var(--dim); font-size: 14px; padding: 0 6px; }
.bubble {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px; padding: 9px 13px; max-width: 88%;
  animation: pop .25s ease;
}
.bubble .who { font-size: 11.5px; color: var(--accent2); display: block; margin-bottom: 2px; }
.bubble.me { align-self: flex-end; border-radius: 16px 4px 16px 16px; background: #2b3358; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.peek { display: block; margin: 22px auto 0; border-radius: 20px; }

/* ===== 그동안 (피드) ===== */
.feed { display: flex; flex-direction: column; gap: 12px; }
.day-sep { text-align: center; color: var(--dim); font-size: 12px; margin-top: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.card.unread { border-color: var(--accent2); }
.card h4 { font-size: 14px; margin-bottom: 5px; }
.card p { font-size: 13.5px; color: var(--dim); white-space: pre-line; }
.card.k-intervention { border-color: var(--accent); background: #23201a; }
.card.k-intervention h4 { color: var(--accent); }
.card.k-season { border-color: var(--accent2); }
.card.k-scar { border-color: var(--bad); }
.card.k-scar h4 { color: var(--bad); }
.card.k-daily { opacity: .8; }
.card.k-scene { opacity: .85; border-style: dashed; }
.card.k-scene h4 { color: var(--dim); font-weight: 400; font-size: 12.5px; }
.card.k-scene p { color: var(--text); }
.card.k-diary { background: #1e1c16; border-color: #4d4530; }
.card.k-diary h4 { color: #cbb87a; font-family: inherit; }
.card.k-diary p { color: #d8cba4; font-style: italic; line-height: 1.9; }
.expand-btn {
  margin-top: 10px; padding: 8px 12px; font-size: 12.5px; width: 100%;
  background: none; border: 1px dashed var(--line); color: var(--accent2);
}
.detail { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px;
  display: flex; flex-direction: column; gap: 7px; }
.d-line { font-size: 13.5px; color: var(--dim); }
.d-line.d-say { color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; padding: 7px 11px; }
.d-line.d-say b { color: var(--accent2); font-size: 11.5px; display: block; margin-bottom: 1px; }

/* ===== 이야기 ===== */
.mile { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.mile .dot { color: var(--line); }
.mile.done .dot { color: var(--accent); }
.mile.done { color: var(--text); }
.mile { color: var(--dim); }
.story-h { font-size: 15px; color: var(--accent); margin: 22px 0 10px; }
.bio { background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 18px; white-space: pre-line; font-size: 14px; }
.season-end { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.season-end input { margin-top: 4px; }

/* ===== 홈 — 스토리 카드 대시보드 ===== */
#view-home { padding: 34px 18px 24px; gap: 18px; }
.home-head { display: flex; justify-content: space-between; align-items: flex-start; }
.home-title { font-size: 30px; letter-spacing: 1px; }
.home-sub { color: var(--dim); font-size: 13px; margin-top: 4px; }
.story-cards { display: flex; flex-direction: column; gap: 14px; }
.story-card {
  text-align: left; padding: 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); width: 100%;
}
.story-card:active { border-color: var(--accent); }
.sc-top { display: flex; align-items: center; gap: 8px; }
.sc-top b { font-size: 17px; }
.sc-top .cat { font-size: 10.5px; color: var(--accent); border: 1px solid var(--accent); border-radius: 20px; padding: 1px 8px; }
.sc-day { margin-left: auto; font-size: 11.5px; color: var(--accent2); }
.sc-goal { color: var(--dim); font-size: 13px; margin: 6px 0 10px; }
.sc-bar { margin: 0 0 10px; border-radius: 3px; overflow: hidden; height: 4px; }
.sc-last { font-size: 12.5px; color: var(--text); background: var(--panel2); border-radius: 8px; padding: 8px 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { font-size: 11.5px; color: var(--dim); margin-top: 8px; }
.story-card.add { text-align: center; border-style: dashed; color: var(--accent); padding: 22px; font-size: 15px; }
.story-card.add small { color: var(--dim); font-size: 12px; }

/* 오프닝 브리핑 */
.card.k-briefing { border-color: var(--accent2); background: #181f33; }
.card.k-briefing h4 { color: var(--accent2); letter-spacing: 1px; }
.card.k-briefing p { color: var(--text); line-height: 1.9; }

/* ===== 병렬 시점 ===== */
.ticker-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; overflow: hidden;
}
.ticker-dot { width: 7px; height: 7px; border-radius: 50%; background: #7fd39a; flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.ticker-line { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-line small { color: var(--accent2); margin-right: 4px; }
.tick-in { animation: tickin .45s ease; }
@keyframes tickin { from { opacity: 0; transform: translateY(8px); } }
.shadow-sep { text-align: center; color: #b98a8a; font-size: 12px; margin: 14px 0 4px; letter-spacing: 1px; }
.shadow-line { color: #c9a0a0; font-style: italic; border-left: 2px solid #6b3a3a; padding-left: 10px; }
.card.k-shadow { border-color: #6b3a3a; background: #221a1e; }
.card.k-shadow h4 { color: #d09090; }
.shadow-h { color: #d09090 !important; }
.shadow-card {
  background: #221a1e; border: 1px solid #6b3a3a; border-radius: 12px;
  padding: 13px 15px; font-size: 13.5px; color: #c9a0a0; font-style: italic;
}
.dash-nav { display: flex; gap: 10px; margin-top: 20px; }
.dash-nav button { flex: 1; font-size: 13.5px; padding: 13px; }

/* ===== 예감 ===== */
.hunch-card {
  background: linear-gradient(160deg, #1f2440, #23201a);
  border: 1px solid var(--accent); border-radius: 14px;
  padding: 15px 16px; margin-bottom: 14px;
}
.hunch-head { font-size: 11.5px; color: var(--accent); letter-spacing: 2px; margin-bottom: 6px; }
.hunch-title { font-size: 16px; font-weight: 700; }
.hunch-title small { color: var(--dim); font-weight: 400; }
.hunch-hint { font-size: 13px; color: var(--dim); margin: 6px 0 10px; }
.hunch-luck { font-size: 13px; color: var(--text); display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.hunch-luck label { color: var(--accent); }
.hunch-luck .dim { color: var(--dim); font-size: 11.5px; }
.hunch-btns { display: flex; gap: 8px; }
.hunch-btns button { flex: 1; border-color: var(--accent2); font-size: 13.5px; }
.hunch-btns button[data-dir="bad"] { border-color: var(--line); color: var(--dim); }
.hunch-open {
  background: var(--panel); border: 1px dashed var(--accent2); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--dim);
}
.card.k-hunch { border-color: var(--accent2); background: #1c2138; }
.card.k-hunch h4 { color: var(--accent2); }

/* ===== 상태 (대시보드) ===== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.stat.wide { grid-column: 1 / -1; }
.stat-label { font-size: 11.5px; color: var(--dim); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-value.mood { font-size: 17px; color: var(--accent2); }
.stat-value .dim { color: var(--dim); font-weight: 400; }
.up { color: #7fd39a; font-size: 12px; } .down { color: var(--bad); font-size: 12px; } .flat { color: var(--dim); font-size: 12px; }
.spark { width: 100%; height: 36px; margin-top: 6px; }
.hbar { height: 7px; background: var(--line); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.hbar-fill { height: 100%; background: #7fd39a; border-radius: 4px; transition: width .5s; }
.hbar-fill.low { background: var(--bad); }
.hbar-fill.gold { background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.cast-list { display: flex; flex-direction: column; gap: 10px; }
.cast-row { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.cast-name { font-size: 14.5px; font-weight: 600; }
.cast-name small { color: var(--dim); font-weight: 400; }
.cast-meta { float: right; font-size: 11.5px; color: var(--accent2); margin-top: -20px; }
.abar { height: 5px; background: var(--line); border-radius: 3px; margin: 8px 0 5px; overflow: hidden; }
.abar-fill { height: 100%; background: linear-gradient(90deg, #5b79c7, #9db4f0); border-radius: 3px; }
.cast-note { font-size: 12px; color: var(--dim); }
.conf-row { display: flex; justify-content: space-between; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 14px; }
.stages { display: flex; align-items: center; gap: 4px; }
.stages small { color: var(--dim); margin-left: 5px; font-size: 11px; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.sdot.on { background: var(--accent); }

/* ===== 탭 ===== */
nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; display: flex;
  background: var(--panel); border-top: 1px solid var(--line); z-index: 5;
}
.tab { flex: 1; padding: 14px 0 18px; background: none; border: none; color: var(--dim); font-size: 14px; border-radius: 0; }
.tab.active { color: var(--accent); font-weight: 700; }
.badge { background: var(--bad); color: #fff; border-radius: 10px; font-size: 10.5px; padding: 1px 6px; vertical-align: 2px; }

/* ===== 모달 ===== */
.modal { position: fixed; inset: 0; background: rgba(5,7,15,.72); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.modal-sub { font-size: 13px; color: var(--dim); }
.size-list { display: flex; flex-direction: column; gap: 8px; }
.size { display: flex; justify-content: space-between; align-items: center; padding: 13px 15px; }
.size b { color: var(--accent); }
.size span { color: var(--dim); font-size: 12.5px; }
.charge-row { display: flex; gap: 8px; }
.charge-row button { flex: 1; font-size: 12.5px; }
.ghost { background: none; border: none; color: var(--dim); }
.notice-text { white-space: pre-line; text-align: center; font-size: 14.5px; line-height: 1.9; }
.av-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.av-row { text-align: left; padding: 12px 14px; border-radius: 12px; }
.av-row.active { border-color: var(--accent); }
.av-row b { font-size: 15px; }
.av-row .cat { font-size: 10.5px; color: var(--accent); border: 1px solid var(--accent); border-radius: 20px; padding: 1px 7px; margin-left: 6px; }
.av-row small { display: block; color: var(--dim); margin-top: 3px; }

/* ===== 디버그 바 ===== */
.debugbar { position: fixed; bottom: 64px; right: calc(50% - 272px); display: flex; gap: 6px; opacity: .5; z-index: 4; }
@media (max-width: 580px) { .debugbar { right: 10px; } }
.debugbar button { font-size: 11px; padding: 4px 8px; }
#mockmark { font-size: 10px; color: var(--dim); align-self: center; }
