/* Same values as the desktop app, read from Evernote's stylesheets. */
:root {
  --green: #00a82d;
  --green-d: #00811e;
  --on-green: #ffffff;
  --bg: #f6f5f4;
  --card: #ffffff;
  --text: #141414;
  --muted: #696564;
  --line: #e7e6e5;
  --accent: #4d64ff;
  --danger: #c0392b;
  --chip: #eeedec;
  --search-bg: #e7e6e5;
  --shadow: 0 4px 12px -8px #0000150f, 0 6px 6px -3px #0000150a, 0 0 0 1px #0000150f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262626; --card: #141414; --text: #ffffff; --muted: #b3b2b1;
    --line: #343332; --green: #4dc869; --green-d: #99e3a8; --on-green: #141414; --accent: #7f90ff;
    --chip: #343332; --search-bg: #343332;
    --shadow: 0 4px 12px -8px #0000150f, 0 6px 6px -3px #0000150a, 0 0 0 1px #ffffff0a;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--text); overscroll-behavior-y: none;
}
#app { height: 100%; max-width: 820px; margin: 0 auto; position: relative; }

.view { display: none; flex-direction: column; height: 100dvh; }
.view.active { display: flex; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; gap: 8px;
  background: var(--green); color: #fff; position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 8px;
  width: 38px; height: 38px; font-size: 20px; line-height: 1; cursor: pointer;
}
.ed-actions { display: flex; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c9d4cf; display: inline-block; }
.dot.ok { background: #7CFFB2; } .dot.sync { background: #ffd24a; } .dot.err { background: #ff7a7a; }

.subbar { display: flex; gap: 8px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.nb-select, .search {
  font-size: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
}
.nb-select { flex: 0 0 auto; max-width: 42%; }
.search { flex: 1; }

.notelist { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px 90px; }
.note-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer;
}
.note-card:active { transform: scale(.995); }
.nc-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.nc-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-date { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.nc-snip { color: var(--muted); font-size: 13.5px; margin-top: 4px; max-height: 40px; overflow: hidden; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; }

.fab {
  position: absolute; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--green);
  color: #fff; font-size: 30px; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; z-index: 6;
}

.ed-title { font-size: 21px; font-weight: 700; border: 0; padding: 14px 16px 6px; background: transparent; color: var(--text); outline: none; }
.toolbar { display: flex; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; background: var(--card); position: sticky; top: 58px; z-index: 4; }
.toolbar button { flex: 0 0 auto; min-width: 40px; height: 36px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; font-size: 15px; cursor: pointer; }
.ed-meta { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; overflow-x: auto; flex: 0 0 auto; }
.ed-meta .nb-select { flex: 0 0 auto; max-width: 45%; padding: 6px 8px; font-size: 13px; }
.ed-tags { display: flex; gap: 6px; flex: 0 0 auto; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px 8px; font-size: 13px; white-space: nowrap; }
.tag-chip button { border: 0; background: none; color: var(--muted); font-size: 15px; padding: 0 0 0 2px; cursor: pointer; }
.ed-tag-add { flex: 1 0 90px; min-width: 90px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); padding: 5px 2px; font-size: 14px; outline: none; }
.ed-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.ed-body { min-height: 45vh; padding: 14px 16px; font-size: 16px; line-height: 1.6; outline: none; }
.ed-body img { max-width: 100%; border-radius: 8px; }
.ed-body:empty::before { content: "내용을 입력하세요…"; color: var(--muted); }
.ed-body blockquote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.ed-body pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 14px; }
.ed-section { padding: 8px 16px; border-top: 1px solid var(--line); }
.ed-section:empty { display: none; }
.ed-section-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.mini { border: 1px solid var(--line); background: var(--card); color: var(--accent); border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; }
.mini.danger { color: var(--danger); }
.file-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }
.file-row a { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task-row input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 auto; }
.task-row.done .task-label { text-decoration: line-through; color: var(--muted); }
.task-label { flex: 1; min-width: 0; font-size: 15px; }
.task-meta { color: var(--muted); font-size: 12px; flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; margin-bottom: 10px; }
.list-section { color: var(--muted); font-size: 13px; margin: 12px 2px 6px; }
.nc-actions { display: flex; gap: 8px; margin-top: 8px; }
.ed-saved { padding: 8px 16px; color: var(--muted); font-size: 12px; }

.settings { padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.settings label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.settings input { font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.primary { background: var(--green); color: #fff; border: 0; border-radius: 10px; padding: 13px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px; cursor: pointer; }
.cfg-email { font-size: 16px; }
.settings-info { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.device { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.device-name { color: var(--text); font-size: 15px; }
.device-seen { font-size: 12.5px; }
.device-revoke { flex: 0 0 auto; padding: 8px 10px; font-size: 13.5px; }
.install-hint { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px);
  background: #333; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px;
  opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

[hidden] { display: none !important; }
.history-list { padding-bottom: 10px; overflow: visible; }
.history-preview { padding: 0 16px; }
.history-preview .primary { width: 100%; }
.ed-body a { color: var(--accent); }
.ed-body hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

/* ---- search ---- */
mark { background: #ffe58a; color: #1d2125; border-radius: 2px; }
.subbar { position: relative; align-items: center; }
.filter-btn { position: relative; flex: none; }
.filter-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.filter-count[hidden], .search-suggest[hidden] { display: none; }
.search-suggest { margin: 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.suggest-item { display: flex; align-items: center; gap: 6px; padding: 10px; border-radius: 8px; font-size: 14px; }
.suggest-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-remove { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 6px; }
.filter-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; overflow: auto; flex: 1; }
.filter-body > label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.filter-body select, .filter-body input[type=date] { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font-size: 15px; }
.filter-query { padding: 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 13px; word-break: break-all; }
.filter-dates { display: flex; gap: 6px; align-items: center; }
.filter-dates input { flex: 1; min-width: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chips:empty { display: none; }
.filter-chip { border: 0; border-radius: 12px; padding: 5px 10px; background: var(--line); color: var(--text); font-size: 13px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 6px; }
.filter-check { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.filter-actions { display: flex; gap: 8px; margin-top: 8px; }
.filter-actions button { flex: 1; }
.saved-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.saved-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.did-you-mean { margin-top: 10px; }
.did-you-mean a { color: var(--accent); }
.search-new { display: block; margin: 14px auto 0; }

/* ---- Evernote look ---- */
.topbar { background: var(--bg); color: var(--text); padding: calc(env(safe-area-inset-top) + 8px) 12px 6px; }
.brand { font-size: 22px; line-height: 28px; font-weight: 600; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text); border-radius: 8px; width: 38px; height: 38px; font-size: 20px; }
.icon-btn:active { background: var(--line); }
.dot.ok { background: var(--green); } .dot { background: #cdcccb; } .dot.sync { background: #f9b300; } .dot.err { background: #e5484d; }
.subbar { background: var(--bg); border-bottom: 0; padding: 4px 12px 8px; }
.nb-select, .search { border: 0; border-radius: 8px; background: var(--search-bg); font-size: 14px; }
.search { min-width: 0; width: 0; }
.nb-select { max-width: 38%; min-width: 0; }
#app, .view { overflow-x: hidden; }
.notelist { padding: 2px 10px 90px; }
.note-card { border: 0; border-radius: 8px; padding: 12px 14px; margin-bottom: 6px; }
.nc-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; font-size: 14px; line-height: 20px; }
.nc-fav { color: #f9b300; }
.nc-date { display: block; margin-top: 8px; }
.nc-snip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; max-height: none; font-size: 13px; line-height: 20px; }
.nc-top { display: block; }
.nc-snip { margin-top: 4px; }
.fab { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; color: var(--on-green); box-shadow: 0 8px 24px -8px #0000151f, 0 14px 40px -8px #0000150a, 0 0 0 1px #00001514; }
.ed-title { font-size: 24px; line-height: 32px; font-weight: 600; background: var(--card); }
#view-editor { background: var(--card); }
#view-editor .topbar { background: var(--card); }
.toolbar { gap: 2px; padding: 4px 8px; }
.toolbar button { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; border: 0; background: transparent; border-radius: 6px; font-size: 14px; }
.toolbar button:active { background: var(--line); }
.ed-meta .nb-select { background: transparent; color: var(--muted); }
.tag-chip { background: var(--chip); border: 0; border-radius: 8px; }
.mini { border: 0; background: var(--chip); color: var(--text); border-radius: 6px; }
.mini.danger { background: #fde8e8; }
.task-card { border: 0; border-radius: 8px; box-shadow: var(--shadow); }
.primary { color: var(--on-green); border-radius: 48px; }
.ghost { color: var(--text); border-color: #dad9d8; border-radius: 8px; }
.settings input, .filter-body select, .filter-body input[type=date] { border-radius: 8px; }
.search-suggest { border: 0; border-radius: 8px; box-shadow: 0 8px 24px -8px #0000151f, 0 0 0 1px #00001514; }
.filter-chip { background: var(--chip); border-radius: 8px; }
.toast { background: #212121; border-radius: 8px; }

/* blocks made on the desktop */
.ed-body table { border-collapse: collapse; margin: 8px 0; }
.ed-body td, .ed-body th { border: 1px solid #dad9d8; padding: 6px 8px; min-width: 48px; }
.note-callout { margin: 8px 0; padding: 10px 14px; border-radius: 8px; background: #e8ebff; }
.ed-body details { margin: 6px 0; padding: 4px 8px; border-radius: 6px; background: var(--chip); }
.ed-body summary { font-weight: 600; }
.note-toc { margin: 8px 0; padding: 10px 14px; border-radius: 8px; background: var(--chip); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note-callout { background: #262c52; } }

/* Tables and code blocks made on the desktop */
.ed-body th { border: 1px solid #dad9d8; padding: 6px 8px; background: var(--chip); font-weight: 600; text-align: left; }
.ed-body table[data-rn-freeze] tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); }
.ed-body tr[data-rnx-hide] { display: none; }
.ed-body pre { tab-size: 4; white-space: pre; font-family: Consolas, Menlo, monospace; }
.ed-body table { max-width: 100%; }
.ed-body { overflow-x: auto; }
.ed-body code { padding: 1px 4px; border-radius: 4px; background: var(--chip); font-family: Consolas, Menlo, monospace; font-size: .92em; }
.ed-body .note-callout { margin: 8px 0; padding: 10px 14px; border-radius: 8px; background: var(--chip); }
.ed-body .note-callout[data-icon]::before { content: attr(data-icon); float: left; margin-right: 8px; }
.ed-body .note-page-break { height: 0; margin: 14px 0; border-top: 1px dashed var(--line); }
.ed-body .link-card { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ed-body .link-card a { display: flex; gap: 10px; color: inherit; text-decoration: none; }
.ed-body .link-card .lc-img { width: 96px; height: 72px; object-fit: cover; border-radius: 0; }
.ed-body .link-card .lc-text { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; min-width: 0; font-size: 13px; }
.ed-body .link-card .lc-desc, .ed-body .link-card .lc-host { font-size: 12px; color: var(--muted); }
.ed-body .note-math { display: block; margin: 8px 0; text-align: center; font-family: Menlo, monospace; color: var(--muted); }
.ed-body .note-math:empty::before { content: "∑ " attr(data-tex); }
.ed-body en-crypt { display: inline-block; padding: 0 8px; border-radius: 12px; background: var(--chip); font-size: 0; }
.ed-body en-crypt::before { content: "🔒 암호화된 내용 (눌러서 열기)"; font-size: 13px; }
.ed-body .event-card { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; padding: 8px 10px; border-left: 3px solid #4d64ff; border-radius: 6px; background: var(--chip); }
.ed-body .event-card span { font-size: 12px; color: var(--muted); }

/* ---- phone parity: sheets, agenda, files ---- */
.sheet-back { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: rgb(0 0 0 / 35%); }
.sheet { width: 100%; max-height: 88vh; overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--bg); box-shadow: 0 -4px 20px rgb(0 0 0 / 20%); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 10px; font-size: 16px; }
.sheet-body { display: flex; flex-direction: column; gap: 10px; }
.sheet-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.sheet-body label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.sheet-body input, .sheet-body select, .sheet-body textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 15px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.primary-btn { padding: 9px 18px; border: 0; border-radius: 8px; background: var(--green); color: #fff; font-size: 15px; font-weight: 600; }
.ghost.danger { color: #c0392b; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); font-size: 13px; }
.agenda-actions { display: flex; justify-content: flex-end; padding: 8px 12px 0; }
.agenda-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; }
.agenda-row:last-child { border-bottom: 0; }
.agenda-time { flex: none; min-width: 64px; font-size: 12px; color: var(--muted); }
.agenda-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.agenda-row.done { opacity: .5; }
.agenda-row.overdue .agenda-time { color: #c0392b; }
.list-section.today { color: var(--green); }
.empty.small { padding: 8px 16px; font-size: 13px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; padding: 10px 12px; }
.file-tile { display: flex; flex-direction: column; gap: 3px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.file-tile img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.file-ico { height: 80px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--chip); font-weight: 700; color: var(--muted); }
.file-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.rec-on { color: #e5484d; animation: rec-pulse 1.2s infinite; }
@keyframes rec-pulse { 50% { opacity: .4; } }
.crypt-view { padding: 10px; border-radius: 8px; background: var(--chip); }
.task-label { cursor: pointer; }

/* ---- phone redesign: tabs, Home, menu, swipe, read mode ---- */
:root { --tabbar-h: 58px; --kb: 0px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--muted); font-size: 11px; padding: 6px 0; cursor: pointer; }
.tabbar .tab.on { color: var(--green); font-weight: 600; }
.tab-create { flex: 0 0 auto; width: 52px; height: 52px; margin: -18px 6px 0; border: 0; border-radius: 50%; background: var(--green); color: var(--on-green); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px -6px #00000059; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tab-create:active { transform: scale(.94); }
.notelist, .home-body, .menu-body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
.home-body, .menu-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-left: 12px; padding-right: 12px; }
.list-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count { color: var(--muted); font-size: 12px; margin: 4px 4px 8px; }
.list-more { height: 1px; }
.toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); display: flex; align-items: center; gap: 14px; }
.toast.actionable { pointer-events: auto; }
.toast-action { border: 0; background: none; color: #8fe3a4; font-weight: 700; font-size: 14px; padding: 0; cursor: pointer; }

/* Home */
.home-date { color: var(--muted); font-size: 13px; margin: 2px 4px 10px; }
.quick-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.quick, .create-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border: 0; border-radius: 10px; background: var(--card); color: var(--text); font-size: 12px; box-shadow: var(--shadow); cursor: pointer; }
.quick svg, .create-item svg { color: var(--green); }
.widget { background: var(--card); border-radius: 12px; padding: 10px 12px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.w-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 15px; }
.w-go { border: 0; background: none; color: var(--accent); font-size: 13px; cursor: pointer; }
.w-note { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.w-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.widget .task-card { box-shadow: none; padding: 0; margin: 0; }
.widget .empty.small { padding: 6px 2px; text-align: left; }
.scratch-ed { min-height: 84px; max-height: 40vh; overflow-y: auto; padding: 10px; border-radius: 8px; background: #fff8c5; color: #141414; font-size: 15px; line-height: 1.5; outline: none; }
.scratch-ed:empty::before { content: attr(data-ph); color: #8a8466; }
.scratch-ed img { max-width: 100%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scratch-ed { background: #3a3620; color: #fff; } }
.mini-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.mini-card { flex: 0 0 140px; height: 150px; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); text-align: left; overflow: hidden; scroll-snap-align: start; cursor: pointer; font: inherit; }
.mini-card img { width: 100%; height: 64px; object-fit: cover; border-radius: 6px; }
.mini-card b { font-size: 13.5px; line-height: 18px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.mini-card span { font-size: 12px; color: var(--muted); line-height: 17px; flex: 1; overflow: hidden; }
.mini-card i { font-style: normal; font-size: 11px; color: var(--muted); margin-top: auto; }
.sc-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.sc { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: var(--chip); color: var(--text); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.pinned-note { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.pinned-body { max-height: 180px; overflow: hidden; font-size: 14px; line-height: 1.5; color: var(--muted); -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.pinned-body img { max-width: 100%; }
.home-customize { display: block; margin: 6px auto 0; }
.cust-row { display: flex; align-items: center; gap: 6px; }
.cust-row .check { flex: 1; }

/* Menu */
.menu-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 16px 4px 6px; }
.menu-group { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; margin-top: 8px; }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; }
.menu-row:last-child { border-bottom: 0; }
.menu-row.sub { padding-left: 34px; }
.menu-row:active { background: var(--line); }
.m-ico { flex: 0 0 22px; text-align: center; }
.m-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-meta { color: var(--muted); font-size: 13px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

/* Note rows: thumbnails, small rows, swipe and select */
.nc-wrap { position: relative; margin-bottom: 6px; border-radius: 8px; overflow: hidden; }
.nc-wrap .note-card { position: relative; margin: 0; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.nc-under { position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between; padding: 0 18px; color: #fff; font-weight: 600; font-size: 14px; }
.nc-wrap[data-swipe] .nc-under { display: flex; }
.nc-wrap[data-swipe="left"] .nc-under { background: #9aa0a6; justify-content: flex-end; }
.nc-wrap[data-swipe="right"] .nc-under { background: #9aa0a6; justify-content: flex-start; }
.nc-wrap.armed[data-act="trash"] .nc-under { background: #e5484d; }
.nc-wrap.armed[data-act="star"] .nc-under { background: #f9b300; }
.nc-wrap.armed[data-act="move"] .nc-under { background: #2f6fed; }
.nc-wrap.armed[data-act="pin"] .nc-under { background: #8e4ec6; }
.nc-wrap[data-swipe="left"] .u-right, .nc-wrap[data-swipe="right"] .u-left { display: none; }
.note-card.has-thumb { display: flex; gap: 12px; align-items: flex-start; }
.nc-main { flex: 1; min-width: 0; }
.nc-thumb { flex: 0 0 72px; width: 72px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--chip); }
.note-card.small { padding: 10px 14px; }
.note-card.small .nc-title { -webkit-line-clamp: 1; }
.note-card.small .nc-date { margin-top: 2px; }
body.selecting .note-card { padding-left: 44px; }
body.selecting .note-card::before { content: ""; position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }
body.selecting .note-card.selected { background: color-mix(in srgb, var(--green) 10%, var(--card)); }
body.selecting .note-card.selected::before { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px var(--card); }
.selbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.selbar button { border: 0; background: var(--chip); color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 13.5px; cursor: pointer; }
.selbar button:disabled { opacity: .4; }
.selbar button.danger { color: #c0392b; }
.sel-count { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }

/* Sheets */
.create-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.create-item { background: var(--card); padding: 14px 2px; }
.pick-list { display: flex; flex-direction: column; }
.pick { display: flex; align-items: center; gap: 10px; padding: 13px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick.on { color: var(--green); font-weight: 600; }
.pick.danger { color: #c0392b; }
.chip.on { border-color: var(--green); color: var(--green); font-weight: 600; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.info-grid span { color: var(--muted); }

/* Editor: read mode and the bar above the keyboard */
#btn-rec:not(.rec-on) { display: none; }
#view-editor.reading .ed-body { cursor: text; }
.kbar { position: fixed; top: auto; left: 0; right: 0; bottom: var(--kb); align-items: center; z-index: 35; max-width: 820px; margin: 0 auto; display: none; border-top: 1px solid var(--line); border-bottom: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
.kbar.show { display: flex; }
.kb-done { font-weight: 700; color: var(--green) !important; padding: 0 10px; }
#view-editor .ed-scroll { padding-bottom: calc(env(safe-area-inset-bottom) + 72px); }

/* ---- phone app, part two ---- */
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.swatch { display: inline-flex; align-items: center; gap: 6px; }
.chip.swatch i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.search-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 12px 8px; flex-wrap: nowrap; scrollbar-width: none; }
.search-chips .chip { flex: 0 0 auto; }
.kb-aa { font-weight: 700; font-family: Georgia, serif; }
.netbanner { position: sticky; top: 0; z-index: 40; padding: 8px 14px; padding-top: calc(env(safe-area-inset-top) + 8px); background: #fff4d6; color: #5c4400; font-size: 13px; cursor: pointer; }
@media (prefers-color-scheme: dark) { .netbanner { background: #3d3214; color: #ffe59e; } }
.ptr { position: fixed; top: calc(env(safe-area-inset-top) + 6px); left: 50%; transform: translate(-50%, -60px); z-index: 45; padding: 6px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 2px 8px rgb(0 0 0 / 15%); font-size: 13px; color: var(--text); opacity: 0; transition: opacity .15s; pointer-events: none; }
.ptr.show { opacity: 1; }
.pick .task-meta { display: block; margin-top: 2px; }
.img-preview { max-width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; background: #fff; }
.mini.ink-save { background: var(--accent); color: #fff; border-color: var(--accent); }

/* handwriting and drawing on pictures */
.ink { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #2b2b2b; }
.ink-bar { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: var(--card); }
.ink-title { flex: 1; text-align: center; color: var(--text); }
.ink-tools { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 0 10px 8px; background: var(--card); scrollbar-width: none; }
.ink-c { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.ink-c.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--card) inset; }
.ink-t { flex: 0 0 auto; min-width: 34px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; }
.ink-t.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ink-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.ink-stage canvas { position: absolute; touch-action: none; }
.ink-base { background: #fff; }

/* tablets: the list stays beside the open note */
body.split #app { max-width: none; display: grid; grid-template-columns: minmax(320px, 380px) 1fr; }
body.split #view-list.side { display: flex; grid-column: 1; grid-row: 1; border-right: 1px solid var(--line); }
body.split #view-editor.active { grid-column: 2; grid-row: 1; }
body.split #netbanner, body.split #ptr { grid-column: 1 / -1; }
body.split .kbar { left: 380px; }

/* Android app: locked until the fingerprint or screen lock says otherwise */
.app-lock { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--bg); color: var(--text); }
.app-lock b { font-size: 22px; display: block; margin-bottom: 6px; }
.app-lock p { color: var(--muted); margin: 0 0 18px; }
#view-offline .empty .primary { margin-top: 14px; padding: 12px 24px; }

/* Notes tab: 노트 / 노트북 / 태그 */
.seg { display: flex; gap: 4px; margin: 0 12px 8px; padding: 3px; border-radius: 10px; background: var(--chip); }
.seg-btn { flex: 1; padding: 8px 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14.5px; font-weight: 600; }
.seg-btn.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.lib-search { padding: 2px 12px 6px; }
.lib-search input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font-size: 15px; }
.lib-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 12px 8px; flex-wrap: wrap; }
.lib-bar .chips { display: flex; gap: 4px; }
.lib-bar .chip { padding: 4px 10px; font-size: 12.5px; }
.nb-row { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; min-height: 52px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); color: var(--text); text-align: left; font-size: 15.5px; }
.nb-row:active { background: var(--chip); }
.nb-row.sub { padding-left: 44px; }
.nb-row.stack { font-weight: 700; }
.nb-row.all { font-weight: 600; }
.nb-ico { flex: 0 0 auto; width: 22px; text-align: center; }
.nb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-meta { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.nb-count { flex: 0 0 auto; min-width: 34px; padding: 2px 8px; border-radius: 10px; background: var(--chip); font-size: 12.5px; text-align: center; color: var(--muted); font-weight: 600; }
.nb-fold { flex: 0 0 auto; width: 24px; border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 0; }
.lib-add { margin: 14px 12px; width: calc(100% - 24px); }
.list-title.pickable { cursor: pointer; }
.list-title.pickable::after { content: ' ▾'; font-size: .7em; color: var(--muted); }
.nbp-list { max-height: 60vh; overflow-y: auto; }
