/* VoiceType 모바일 — 모바일 우선, 다크/라이트 자동 */
:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1b2238;
  --muted: #68708c;
  --accent: #2b3a67;
  --accent-press: #1f2b55;
  --accent-soft: #e2e7f5;
  --danger: #b4344c;
  --border: #d8dcea;
  --rec-active: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1428;
    --card: #1a2140;
    --text: #e8ebf7;
    --muted: #9aa3c4;
    --accent: #5b74c4;
    --accent-press: #47609f;
    --accent-soft: #232c52;
    --danger: #e26a7f;
    --border: #2c3561;
    --rec-active: #e74c3c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.screen { min-height: 100dvh; }

/* 로그인 */
#login-screen { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 320px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; }
.login-box h1 { margin: 12px 0 4px; font-size: 24px; }
.login-desc { color: var(--muted); margin: 0 0 20px; }
#pin-input {
  width: 100%; padding: 14px; font-size: 18px; text-align: center;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); margin-bottom: 12px;
}
.login-error { color: var(--danger); min-height: 1.2em; font-size: 14px; }

/* 공용 버튼 */
.primary-btn, .secondary-btn, .danger-btn {
  padding: 14px 18px; font-size: 16px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer;
}
.primary-btn { background: var(--accent); color: #fff; width: 100%; }
.primary-btn:active { background: var(--accent-press); }
.secondary-btn { background: var(--accent-soft); color: var(--accent); }
.danger-btn { background: transparent; color: var(--danger); border: 1px solid var(--danger); width: 100%; }

/* 메인 레이아웃 */
#app-screen { display: flex; flex-direction: column; }
.tab-panel {
  flex: 1; padding: 12px 16px;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; width: 100%;
}
.app-header h1 { font-size: 20px; margin: 8px 0 12px; }
.tab-desc { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* 용도 칩 */
.hint-chips { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.chip {
  padding: 8px 16px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer;
}
.chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 상태·파형 */
.status-line { text-align: center; font-size: 16px; min-height: 1.4em; margin: 10px 0 2px; color: var(--muted); }
.status-line.active { color: var(--text); font-weight: 600; }
.level-canvas { display: block; width: min(300px, 80%); height: 56px; margin: 0 auto; }

/* 녹음 버튼 */
.rec-area { text-align: center; margin: 8px 0 16px; }
.rec-btn {
  width: 112px; height: 112px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(20, 30, 70, 0.3);
  cursor: pointer; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.rec-btn.recording { background: var(--rec-active); transform: scale(1.06); }
.rec-btn:disabled { opacity: 0.5; }
.rec-icon { width: 48px; height: 48px; pointer-events: none; }
.rec-help { color: var(--muted); font-size: 13px; margin-top: 10px; }

.notice {
  background: var(--accent-soft); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; margin: 8px 0;
}

/* 결과 카드 */
.result-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-top: 4px; }
#result-text {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; padding: 10px; resize: vertical;
}
.result-actions { display: flex; gap: 10px; margin: 10px 0; }
.result-actions .primary-btn { flex: 2; width: auto; }
.result-actions .secondary-btn { flex: 1; }
#raw-details summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.raw-text { color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

/* 목록 (기록·사전) */
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 10px;
}
.item-text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0 0 8px; }
.item-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.item-actions { display: flex; gap: 8px; }
.item-actions button {
  padding: 8px 14px; font-size: 13px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); cursor: pointer;
}
.item-actions .del { color: var(--danger); border-color: var(--danger); }
.empty-note { color: var(--muted); text-align: center; margin-top: 32px; }

/* 사전 */
.dict-add { display: flex; gap: 8px; margin-bottom: 14px; }
.dict-add input {
  flex: 1; padding: 12px; font-size: 16px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); color: var(--text);
}
.dict-add .primary-btn { width: auto; }

/* 설정 */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 10px; font-size: 16px;
}
.setting-row select, .setting-row input[type="checkbox"] { font-size: 15px; }
.setting-row select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px;
}
.setting-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }

/* 하단 탭 */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; padding: 12px 4px 10px; font-size: 13px;
  background: none; border: none; color: var(--muted); cursor: pointer;
}
.nav-btn.selected { color: var(--accent); font-weight: 700; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0.95; z-index: 10;
}
