:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  max-width: 640px; margin: 0 auto; padding: 0 16px 96px; background: #fbfaf7; color: #1d1b17;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 8px; position: sticky; top: 0; background: #fbfaf7; z-index: 5;
}
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.crumb { background: none; border: none; font-size: 15px; font-weight: 600; cursor: pointer; padding: 4px 2px; color: #1d1b17; }
.crumb:last-child { color: #c9711f; }
.crumb-sep { color: #a3a091; font-size: 13px; }
.header-actions { display: flex; gap: 6px; }
.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px; }

.hint { font-size: 12px; color: #a3a091; margin: 0 0 12px; }

.browser-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.empty-hint { color: #a3a091; font-size: 14px; padding: 24px 0; text-align: center; }

.row-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid #e9e3d6; border-radius: 12px; background: #ffffff;
  cursor: pointer; position: relative;
}
.row-item:hover { border-color: #c9711f; }
.row-icon { font-size: 20px; flex: none; }
.row-title { flex: 1; font-weight: 600; font-size: 14.5px; display: flex; flex-direction: column; gap: 2px; }
.row-preview { font-weight: 400; font-size: 12px; color: #a3a091; }
.row-chevron { color: #a3a091; }
.row-action { background: none; border: none; font-size: 14px; opacity: 0.4; cursor: pointer; padding: 4px; }
.row-action:hover { opacity: 1; }

.account-badge { font-size: 12px; color: #a3a091; margin-right: 4px; align-self: center; }
.sync-status { min-height: 14px; }

/* ── 닉네임 화면 ─────────────────────────────────────────────────────── */
#screen-nickname { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.linklike { background: none; border: none; padding: 0; font-size: 12px; color: #c9711f; text-decoration: underline; cursor: pointer; font-family: inherit; }
.search-bar { margin-bottom: 8px; }
.search-bar input {
  width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 10px; border: 1px solid #e9e3d6;
  font-family: inherit; background: #ffffff; color: inherit;
}
.search-result-snippet { font-weight: 400; font-size: 12px; color: #a3a091; }
.search-result-path { font-weight: 400; font-size: 11px; color: #c9711f; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { text-align: center; margin: 0 0 4px; }
.login-card label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.login-card input {
  width: 100%; padding: 12px; font-size: 16px; border-radius: 10px; border: 1px solid #e9e3d6; font-family: inherit;
}
.full-width { width: 100%; margin-top: 8px; }
.hint.error { color: #c0392b; }
.hint.faint { font-size: 11px; opacity: 0.75; margin-top: 12px; }

/* ── 읽기 전용 화면 — 전체화면, 편안한 폰트로 읽기 위한 별도 화면 ───────── */
.fullscreen-modal {
  position: fixed; inset: 0; background: #fbfaf7; z-index: 30; display: flex; flex-direction: column;
}
.read-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #e9e3d6;
  position: sticky; top: 0; background: #fbfaf7;
}
.font-size-controls { display: flex; gap: 4px; margin-left: auto; }
.font-size-controls .icon-btn { font-size: 13px; font-weight: 700; border: 1px solid #e9e3d6; border-radius: 8px; padding: 4px 8px; }
.read-body { flex: 1; overflow-y: auto; padding: 20px 20px 60px; max-width: 640px; margin: 0 auto; width: 100%; }
.read-body h2 { margin: 0 0 16px; font-size: 20px; }
.read-content { white-space: pre-wrap; word-break: break-word; line-height: 1.8; font-size: 17px; }

.backups-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.backup-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 10px 12px; border: 1px solid #e9e3d6; border-radius: 8px; background: #ffffff;
  cursor: pointer; font-family: inherit; text-align: left;
}
.backup-row:hover { border-color: #c9711f; }
.backup-date { font-weight: 700; font-size: 14px; }
.backup-meta { font-size: 12px; color: #a3a091; }

@media (prefers-color-scheme: dark) {
  .backup-row { background: #221d15; border-color: #3a3327; }
  .login-card input { background: #17140f; border-color: #3a3327; color: #f2ede1; }
  .fullscreen-modal { background: #17140f; }
  .read-header { background: #17140f; border-color: #3a3327; }
  .font-size-controls .icon-btn { border-color: #3a3327; }
  .search-bar input { background: #221d15; border-color: #3a3327; color: #f2ede1; }
}

.fab-row { position: fixed; bottom: 24px; right: 24px; display: flex; gap: 10px; }
.fab {
  border: none; border-radius: 999px; padding: 14px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.fab.primary { background: #c9711f; color: white; }
.fab.secondary { background: #ffffff; border: 1px solid #e9e3d6; color: #1d1b17; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex;
  align-items: center; justify-content: center; z-index: 20; padding: 16px;
}
.modal-card {
  background: #ffffff; border-radius: 16px; padding: 20px; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 10px; max-height: 90vh;
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-card input, .modal-card textarea {
  width: 100%; padding: 10px; font-size: 15px; border-radius: 8px; border: 1px solid #e9e3d6;
  font-family: inherit;
}
.modal-card textarea { min-height: 240px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.primary-btn { background: #c9711f; color: white; border: none; padding: 10px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.secondary-btn { background: none; border: 1px solid #e9e3d6; padding: 10px 18px; border-radius: 8px; cursor: pointer; }

@media (prefers-color-scheme: dark) {
  body { background: #17140f; color: #f2ede1; }
  header { background: #17140f; }
  .row-item { background: #221d15; border-color: #3a3327; }
  .fab.secondary { background: #221d15; border-color: #3a3327; color: #f2ede1; }
  .modal-card { background: #221d15; }
  .modal-card input, .modal-card textarea { background: #17140f; border-color: #3a3327; color: #f2ede1; }
  .secondary-btn { border-color: #3a3327; color: #f2ede1; }
}
