:root {
  --bg: #ffffff;
  --panel: #f4f4f5;
  --border: #d8d8dc;
  --border-strong: #b9bac0;
  --text: #1e1f22;
  --muted: #6b6d74;
  --accent: #5865f2;
}

:root[data-theme="dark"] {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --border: #3f4147;
  --border-strong: #53565e;
  --text: #e3e5e8;
  --muted: #9a9ca3;
  --accent: #5865f2;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: "맑은 고딕", "Malgun Gothic", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background-color: var(--border);
  background-clip: padding-box;
  border: 2px solid var(--bg);
  border-radius: 6px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-gate.hidden { display: none; }

.auth-box {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.auth-box h2 {
  font-size: 16px;
  margin: 0 0 6px;
}

.auth-error {
  color: #e0435c;
  font-size: 12px;
  margin: 0 0 12px;
  display: none;
}

.auth-error.show { display: block; }

.auth-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  text-align: center;
}

.auth-box button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 50px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.topbar button.accent {
  background: var(--accent);
  color: white;
  border: none;
  margin-left: auto;
}

.sync-status {
  font-size: 12px;
  color: var(--muted);
}

.sync-status.dirty {
  color: #e0435c;
  font-weight: 600;
}

main#notepad {
  position: absolute;
  top: 50px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: auto;
  padding: 16px 18px 60px;
  line-height: 1.7;
  font-size: 15px;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
  -webkit-user-select: text;
}

/* ---------- 고정 메모 ---------- */
.pinned-block { padding-bottom: 6px; }

/* ---------- 날짜 묶음박스 ---------- */
.day-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 28px 0 0;
}

.day-divider .line {
  height: 1px;
  background: var(--border-strong);
}

.day-title {
  font-family: "Consolas", "SF Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 13px;
  outline: none;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.day-title:focus { background: var(--accent); color: #fff; }

/* day-delete ships in the shared content HTML, but isn't a phone feature */
.day-delete { display: none; }

.section-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.section-top::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-label {
  flex: 0 0 auto;
  outline: none;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.section-label:focus { background: var(--accent); color: #fff; }

.section-body {
  outline: none;
  padding: 6px 2px 4px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.6em;
}

.day-divider + .section-body {
  padding-top: 12px;
}

main#notepad img { max-width: 100%; border-radius: 4px; }

main#notepad table {
  border-collapse: collapse;
  margin: 8px 0;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

main#notepad table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  min-width: 50px;
}
