:root {
  --bg: #0c0c10;
  --surface: #14141a;
  --surface2: #1c1c24;
  --border: #28283a;
  --text: #e8e8f2;
  --text-dim: #6a6a88;
  --accent: #8b7cf8;
  --accent-glow: rgba(139,124,248,0.15);
  --heart: #ff6b9d;
  --haogan: #a78bfa;
  --aimei: #9b5de5;
  --juli: #06d6a0;
  --xinren: #ffd166;
  --kakao: #fee500;
  --font: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', 'PingFang SC', sans-serif;
}

[data-theme="light"] {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface2: #e4e4eb;
  --border: #d1d1d6;
  --text: #1c1c1e;
  --text-dim: #8e8e93;
  --accent: #6c5ce7;
  --accent-glow: rgba(108,92,231,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 340px;
  text-align: center;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-title {
  font-size: 22px; font-weight: 700;
  letter-spacing: 2px; color: var(--accent);
}
.modal-sub { font-size: 13px; color: var(--text-dim); letter-spacing: 1px; }
.modal-hint { font-size: 13px; color: var(--text-dim); }
.modal-box input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  width: 100%;
}
.modal-box input:focus { border-color: var(--accent); }
.modal-box button {
  background: var(--accent);
  color: #fff; border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-box button:hover { opacity: 0.85; }
.modal-tip { font-size: 11px; color: var(--text-dim); }
.modal-box textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
  width: 100%;
  resize: none;
  font-family: var(--font);
  line-height: 1.6;
}
.modal-box textarea:focus { border-color: var(--accent); }

/* ── 存档选择界面 ── */
.slot-screen-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  width: 400px;
  max-width: 94vw;
  display: flex; flex-direction: column; gap: 16px;
}
.slot-screen-title {
  font-size: 20px; font-weight: 700;
  color: var(--accent); letter-spacing: 2px; text-align: center;
}
.slot-screen-sub { font-size: 13px; color: var(--text-dim); text-align: center; }

.slot-list { display: flex; flex-direction: column; gap: 10px; }

.slot-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex; align-items: center; gap: 14px;
}
.slot-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.slot-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.slot-card-info { flex: 1; }
.slot-card-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.slot-card-persona { font-size: 11px; color: var(--text-dim); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.slot-card-meta { font-size: 11px; color: var(--text-dim); }
.slot-card-meta span { color: var(--accent); }
.slot-card-del {
  background: none; border: none;
  color: var(--text-dim); font-size: 16px;
  cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
}
.slot-card-del:hover { color: #ff6b6b; }

.new-slot-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.new-slot-btn:hover { border-color: var(--accent); color: var(--accent); }

#switch-slot-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 8px;
  padding: 8px; font-size: 11px;
  cursor: pointer; font-family: var(--font);
}
#switch-slot-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Toasts ── */
.heartbeat-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(255,107,157,0.9);
  color: #fff; padding: 8px 20px;
  border-radius: 20px; font-size: 14px; font-weight: 600;
  z-index: 998; pointer-events: none;
  animation: fadeInOut 2s ease forwards;
}
.stat-toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text); padding: 6px 16px;
  border-radius: 16px; font-size: 13px;
  z-index: 997; pointer-events: none;
  animation: fadeInOut 2.5s ease forwards;
}
@keyframes fadeInOut {
  0% { opacity:0; transform: translateX(-50%) translateY(-6px); }
  15% { opacity:1; transform: translateX(-50%) translateY(0); }
  75% { opacity:1; }
  100% { opacity:0; }
}
.hidden { display: none !important; }

/* ── App Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 14px;
  overflow-y: auto;
}

.idol-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.idol-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.idol-name-kr { font-size: 13px; font-weight: 600; }
.idol-tag { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.chapter-badge {
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  display: flex; gap: 8px; align-items: center;
}
.chapter-badge span:first-child { color: var(--accent); font-weight: 600; }
.chapter-badge span:last-child { color: var(--text-dim); }

/* Stats */
.stats-panel { display: flex; flex-direction: column; gap: 10px; }
.stat-row { display: flex; align-items: center; gap: 8px; }
.stat-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.stat-body { flex: 1; }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--text-dim); }
.stat-num { font-size: 11px; font-weight: 600; color: var(--text); }
.stat-bar {
  height: 4px; background: var(--surface2);
  border-radius: 2px; overflow: hidden;
}
.stat-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.6s ease;
  width: 0%;
}
.fill-xindong { background: var(--heart); }
.fill-haogan { background: var(--haogan); opacity: 0.4; }
.fill-aimei { background: var(--aimei); }
.fill-juli { background: var(--juli); }
.fill-xinren { background: var(--xinren); }

.heartbeat-badge {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  background: none; border: none;
  color: var(--text-dim);
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }

#reset-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 8px;
  padding: 8px; font-size: 11px;
  cursor: pointer; margin-top: auto;
  font-family: var(--font);
}
#reset-btn:hover { border-color: #ff6b6b; color: #ff6b6b; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.tab {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 30px 32px;
  display: none;
}
.tab.active { display: block; }

/* ── Chat Tab ── */
#tab-chat {
  padding: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#tab-chat.active { display: flex; }

/* ── Home Tab ── */
.home-hero {
  margin-bottom: 32px;
}
.home-chapter-num {
  font-size: 13px; color: var(--accent);
  letter-spacing: 2px; margin-bottom: 8px;
}
.home-chapter-title {
  font-size: 32px; font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.home-chapter-desc {
  font-size: 15px; color: var(--text-dim);
  line-height: 1.8; max-width: 540px;
}

.chapter-timeline {
  display: flex; gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.timeline-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; flex: 1; min-width: 80px;
  position: relative; cursor: default;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 10px; left: 50%; right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.timeline-item.active:not(:last-child)::after { background: var(--accent); }
.tl-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  z-index: 1;
  transition: all 0.3s;
}
.timeline-item.active .tl-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.timeline-item.locked .tl-dot { opacity: 0.4; }
.tl-label {
  font-size: 10px; color: var(--text-dim);
  text-align: center; line-height: 1.4;
}
.timeline-item.active .tl-label { color: var(--accent); }
.timeline-item.locked .tl-label { opacity: 0.4; }

.home-hint {
  font-size: 13px; color: var(--text-dim);
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chat-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-av {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.chat-name { font-size: 14px; font-weight: 600; }
.chat-status { font-size: 11px; color: var(--text-dim); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--bg);
}

/* Chat bubbles */
.msg {
  display: flex; gap: 10px; max-width: 75%;
}
.msg.user { flex-direction: row-reverse; align-self: flex-end; }
.msg.ohyul { align-self: flex-start; }
.msg-av {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.msg-body { display: flex; flex-direction: column; gap: 4px; }
.msg-name { font-size: 11px; color: var(--text-dim); }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px; line-height: 1.6;
  max-width: 100%;
  word-break: break-word;
}
.msg.ohyul .msg-bubble {
  background: var(--surface2);
  border-radius: 4px 16px 16px 16px;
  color: var(--text);
}
.msg.user .msg-bubble {
  background: var(--kakao);
  border-radius: 16px 4px 16px 16px;
  color: #333;
}
.msg-narration {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  line-height: 1.7;
  padding: 6px 24px;
  margin: 2px auto;
  max-width: 80%;
  position: relative;
}
.msg-narration::before, .msg-narration::after {
  content: '—';
  margin: 0 6px;
  opacity: 0.4;
}
.dialogue-tr {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
  padding: 0 2px;
  line-height: 1.5;
}
.msg-time { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.msg.user .msg-time { text-align: right; }

.typing-indicator {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}
.typing-dot {
  width: 6px; height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.chat-input-row {
  display: flex; gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  font-family: var(--font);
}
#chat-input:focus { border-color: var(--accent); }
#send-btn {
  width: 40px; height: 40px;
  background: var(--accent);
  border: none; border-radius: 50%;
  color: #fff; font-size: 16px;
  cursor: pointer; flex-shrink: 0;
  transition: opacity 0.15s;
}
#send-btn:hover { opacity: 0.8; }

/* ── Forum Tab ── */
.forum-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent);
}
.forum-logo {
  font-size: 20px; font-weight: 700;
  color: var(--accent);
}
.forum-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.forum-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}
.forum-post-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.forum-post-title {
  font-size: 14px; font-weight: 600; margin-bottom: 6px;
}
.forum-post-meta {
  font-size: 11px; color: var(--text-dim);
  display: flex; gap: 12px;
}
.forum-post-body {
  padding: 14px 16px;
  font-size: 13px; line-height: 1.7;
  white-space: pre-wrap;
}
.forum-post-translation {
  font-size: 12px; color: var(--text-dim);
  font-style: italic; margin-top: 8px;
}
.forum-replies {
  background: var(--surface2);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.forum-reply {
  font-size: 12px; color: var(--text-dim);
  display: flex; gap: 8px;
}
.forum-reply-author { color: var(--accent); font-weight: 600; }

.empty-hint {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 2;
}

/* ── Twitter Tab ── */
.twitter-topbar {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tw-handle { font-size: 13px; color: var(--text-dim); }
.tw-name { font-size: 18px; font-weight: 700; }

.tweet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.tweet-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.tweet-av {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.tweet-meta { display: flex; flex-direction: column; }
.tweet-name { font-size: 13px; font-weight: 600; }
.tweet-handle { font-size: 11px; color: var(--text-dim); }
.tweet-body { font-size: 14px; line-height: 1.6; margin-bottom: 6px; }
.tweet-translation { font-size: 12px; color: var(--text-dim); font-style: italic; margin-bottom: 10px; }
.tweet-time { font-size: 11px; color: var(--text-dim); }
.tweet-stats {
  display: flex; gap: 20px; margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}

/* Fan tweet */
.tweet.fan-tweet { border-color: rgba(139,124,248,0.2); }
.tweet.fan-tweet .tweet-av {
  background: linear-gradient(135deg, #555, #888);
}

/* ── 人设预设 ── */
.persona-presets {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.preset-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px; color: var(--text-dim);
  cursor: pointer; transition: all 0.15s;
}
.preset-chip:hover, .preset-chip.selected {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 选择题 ── */
.choices-area {
  padding: 10px 16px 6px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.choices-hint {
  font-size: 11px; color: var(--text-dim);
  text-align: center; padding-bottom: 2px;
}
.choice-btns {
  display: flex; flex-direction: column; gap: 6px;
}
.choice-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px; line-height: 1.4;
  text-align: left; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  display: flex; gap: 10px; align-items: flex-start;
}
.choice-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text);
}
.choice-label {
  color: var(--accent);
  font-weight: 700; font-size: 12px;
  flex-shrink: 0; margin-top: 1px;
}
.choice-text { flex: 1; }

/* ── Game Notification ── */
.game-notif {
  position: fixed; top: 16px; right: 16px;
  background: rgba(20,20,26,0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  z-index: 996;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
  cursor: pointer;
}
@keyframes slideInRight {
  from { opacity:0; transform: translateX(20px); }
  to { opacity:1; transform: translateX(0); }
}
.notif-icon { font-size: 22px; flex-shrink: 0; }
.notif-body { display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-size: 12px; font-weight: 700; color: var(--text); }
.notif-desc { font-size: 11px; color: var(--text-dim); }

/* tab badge */
.nav-btn .nav-badge {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--heart);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Phone Tab ── */
.phone-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
  padding: 20px;
}
.phone-frame {
  width: 300px;
  background: #f0f0f5;
  border-radius: 40px;
  padding: 20px 14px 28px;
  box-shadow: 0 0 0 8px #1a1a1a, 0 0 0 10px #333, 0 20px 40px rgba(0,0,0,0.5);
  position: relative;
  min-height: 540px;
  overflow: hidden;
}
.phone-notch {
  width: 100px; height: 22px;
  background: #1a1a1a;
  border-radius: 0 0 16px 16px;
  margin: 0 auto 8px;
}
.phone-time {
  text-align: center;
  font-size: 28px; font-weight: 300;
  color: #1c1c1e; margin-bottom: 20px;
  letter-spacing: -1px;
}

/* App grid (home screen) */
.phone-home-screen { padding: 0 4px; }
.phone-app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 10px;
}
.phone-app-icon {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  cursor: pointer;
  position: relative;
}
.phone-app-icon:active .app-icon-bg { transform: scale(0.92); }
.app-icon-bg {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  transition: transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.notes-bg { background: #fff9c4; }
.kakao-bg { background: #fee500; }
.gallery-bg { background: #e8f4f8; }
.x-bg { background: #000; color: #fff; font-size: 22px; }
.app-label { font-size: 11px; color: #1c1c1e; font-weight: 500; }
.app-badge {
  position: absolute; top: -4px; right: 6px;
  background: #ff3b30;
  color: #fff; font-size: 9px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #f0f0f5;
}

/* App inner screen */
.phone-app-screen {
  position: absolute; inset: 0;
  background: #f5f5f7;
  border-radius: 40px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.phone-app-bar {
  display: flex; align-items: center;
  padding: 48px 14px 10px;
  background: #f5f5f7;
  border-bottom: 1px solid #e5e5ea;
  gap: 10px; flex-shrink: 0;
}
.phone-back-btn {
  background: none; border: none;
  color: #007aff; font-size: 15px;
  cursor: pointer; padding: 4px 6px;
  font-family: var(--font);
}
.phone-app-title {
  font-size: 15px; font-weight: 700;
  color: #1c1c1e; flex: 1; text-align: center;
  margin-right: 48px;
}
.phone-app-content {
  flex: 1; overflow-y: auto; padding: 12px;
}

/* Notes inside phone */
.phone-note {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer;
}
.phone-note-title {
  font-size: 13px; font-weight: 600;
  color: #1c1c1e; margin-bottom: 4px;
}
.phone-note-body {
  font-size: 12px; color: #3c3c43;
  line-height: 1.6; white-space: pre-wrap;
}
.phone-note-date {
  font-size: 10px; color: #8e8e93; margin-top: 6px;
}

/* KakaoTalk inside phone */
.kakao-chat-list { }
.kakao-chat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid #e5e5ea;
  cursor: pointer;
}
.kakao-chat-item:active { background: #f0f0f5; }
.kakao-av {
  width: 42px; height: 42px;
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
}
.kakao-info { flex: 1; }
.kakao-name { font-size: 13px; font-weight: 600; color: #1c1c1e; }
.kakao-preview { font-size: 11px; color: #8e8e93; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.kakao-time { font-size: 10px; color: #8e8e93; }
.kakao-unread {
  background: #fe2c55; color: #fff;
  font-size: 10px; width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* KakaoTalk chat thread */
.kakao-thread { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.kt-msg { display: flex; gap: 6px; align-items: flex-end; }
.kt-msg.me { flex-direction: row-reverse; }
.kt-av-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.kt-bubble {
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px; line-height: 1.5;
  word-break: break-word;
}
.kt-msg.other .kt-bubble { background: #fff; color: #1c1c1e; border-radius: 4px 12px 12px 12px; }
.kt-msg.me .kt-bubble { background: var(--kakao); color: #333; border-radius: 12px 4px 12px 12px; }
.kt-time { font-size: 9px; color: #8e8e93; margin-bottom: 2px; }
.kt-name-sm { font-size: 10px; color: #8e8e93; margin-bottom: 2px; }

/* Gallery inside phone */
.gallery-grid { display: flex; flex-direction: column; gap: 10px; }
.gallery-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.gallery-item-img {
  width: 100%; height: 120px;
  background: linear-gradient(135deg, #e0e0e8, #c8c8d8);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin-bottom: 8px;
}
.gallery-item-caption { font-size: 11px; color: #8e8e93; }

.phone-locked {
  text-align: center; padding: 30px 16px;
  color: #8e8e93; font-size: 12px; line-height: 2;
}
.phone-hint-text {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px; line-height: 2;
}

/* ── Light mode overrides ── */
[data-theme="light"] .game-notif {
  background: rgba(255,255,255,0.97);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .msg-scene {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .phone-frame {
  box-shadow: 0 0 0 8px #c8c8c8, 0 0 0 10px #e0e0e0, 0 20px 40px rgba(0,0,0,0.2);
}

/* ── Theme toggle button ── */
#theme-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 8px;
  padding: 8px; font-size: 13px;
  cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
#theme-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── KakaoTalk translation ── */
.kt-translation {
  font-size: 9px; color: #8e8e93;
  font-style: italic; margin-top: 2px;
  max-width: 180px; line-height: 1.4;
}
.kt-msg.me .kt-translation { text-align: right; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Mobile ── */
@media (max-width: 640px) {
  body { overflow: auto; }
  #app { flex-direction: column; height: auto; overflow: visible; }
  .sidebar {
    width: 100%; min-width: unset;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 14px 12px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-btn { flex: 1; min-width: 60px; text-align: center; font-size: 11px; padding: 7px 4px; }
  .main-content { height: 100vh; }
  .tab { padding: 16px; }
  #tab-chat { height: 100vh; }
}
