*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #282a36;
  --surface: #44475a;
  --text: #f8f8f2;
  --muted: #6272a4;
  --accent: #ff79c6;
  --font: Monaco, 'Cascadia Code', Consolas, 'Courier New', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.7;
  overflow: hidden;
}

/* ── Writing view ── */

.page {
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}

.page::-webkit-scrollbar { display: none; }

.column {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 24px 120px;
}

.date-label {
  font-family: var(--font);
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 48px;
  text-align: left;
  user-select: none;
  outline: none;
  cursor: default;
  transition: color 0.15s;
}

.date-label:focus {
  color: var(--text);
}

textarea#editor {
  width: 100%;
  min-height: calc(100vh - 260px);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.7;
  caret-color: var(--accent);
  padding: 0;
}

textarea#editor::selection {
  background: rgba(255, 121, 198, 0.18);
}

textarea#editor::-webkit-scrollbar { display: none; }
textarea#editor { scrollbar-width: none; }

/* ── Status bar ── */

.status-bar {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.4s;
}

.sync-dot.clean  { background: #50fa7b; opacity: 0.55; }
.sync-dot.dirty  { background: var(--accent); opacity: 1; }
.sync-dot.saving {
  background: var(--accent);
  opacity: 1;
  animation: dot-pulse 0.7s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Command palette ── */

.palette-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  background: rgba(40, 42, 54, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.palette-overlay[hidden] { display: none; }

.palette {
  width: 480px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.palette input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--muted);
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 16px 20px;
  caret-color: var(--accent);
}

.palette input::placeholder { color: var(--muted); }

.palette ul {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: none;
}

.palette ul::-webkit-scrollbar { display: none; }

.palette li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.08s;
}

.palette li.active { background: rgba(255, 121, 198, 0.14); }
.palette li:hover  { background: rgba(255, 121, 198, 0.08); }

.palette li .cmd-hint {
  color: var(--muted);
  font-size: 12px;
}

/* ── Calendar ── */

.cal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 42, 54, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.cal-overlay[hidden] { display: none; }

.cal {
  background: var(--surface);
  border-radius: 8px;
  padding: 20px 20px 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  width: 268px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.cal-header button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.1s;
}

.cal-header button:hover { color: var(--accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-name {
  font-family: var(--font);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 4px 0 6px;
  letter-spacing: 0.06em;
}

.cal-day {
  font-family: var(--font);
  font-size: 13px;
  text-align: center;
  padding: 5px 0;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.08s;
}

.cal-day:not(.empty):hover  { background: rgba(255, 121, 198, 0.1); }
.cal-day.cal-today          { color: var(--accent); }
.cal-day.cal-current        { background: rgba(255, 121, 198, 0.22); }
.cal-day.empty              { cursor: default; }

.cal-day.cal-has-entry {
  position: relative;
}

.cal-day.cal-has-entry::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ── Search overlay ── */

.search-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  background: rgba(40, 42, 54, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.search-overlay[hidden] { display: none; }

.search-box {
  width: 560px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--muted);
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 16px 20px;
  caret-color: var(--accent);
}

.search-box input::placeholder { color: var(--muted); }

.search-box ul {
  list-style: none;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: none;
}

.search-box ul::-webkit-scrollbar { display: none; }

.search-result-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.08s;
  border-bottom: 1px solid rgba(98, 114, 164, 0.15);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.active { background: rgba(255, 121, 198, 0.12); }

.search-result-date {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 3px;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-empty {
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

/* ── Timer overlay ── */

.timer-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 42, 54, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.timer-overlay[hidden] { display: none; }

.timer-dialog {
  background: var(--surface);
  border-radius: 8px;
  padding: 28px 28px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.timer-title {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timer-label {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
}

.timer-slider-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.timer-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  outline: none;
  opacity: 0.8;
}

.timer-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.timer-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.timer-value {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.timer-start-btn {
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 9px 0;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.timer-start-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.timer-indicator {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  user-select: none;
  visibility: hidden;
}

.timer-indicator.visible { visibility: visible; }

.timer-indicator.expired {
  color: var(--accent);
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

@keyframes editor-flash {
  0%, 100% { background: transparent; }
  50%       { background: rgba(255, 85, 85, 0.12); }
}

.editor-flash { animation: editor-flash 0.35s ease 2; }

@keyframes editor-warn {
  0%, 100% { background: transparent; }
  50%       { background: rgba(255, 85, 85, 0.07); }
}

.editor-warn { animation: editor-warn 0.8s ease-in-out infinite; }

.timer-indicator.warn { color: #ff5555; }

/* ── Export dialog ── */

.export-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 42, 54, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.export-overlay[hidden] { display: none; }

.export-dialog {
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.export-title {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.export-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.export-presets button {
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.1s, border-color 0.1s, color 0.1s;
}

.export-presets button:hover   { opacity: 1; }
.export-presets button.active  {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

.export-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-range input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--muted);
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 4px 0;
  caret-color: var(--accent);
  min-width: 0;
}

.export-range input::placeholder { color: var(--muted); }

.export-range-sep {
  color: var(--muted);
  font-size: 14px;
  flex-shrink: 0;
}

.export-go {
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 8px 0;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.export-go:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Auth / info pages ── */

.auth-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 300px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  opacity: 0.9;
}

.auth-appname {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--muted);
  margin-top: -10px;
}

.auth-box form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-box input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--muted);
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  padding: 6px 0;
  width: 100%;
}

.auth-box input::placeholder { color: var(--muted); }

.auth-box button {
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--accent);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  width: 100%;
}

.auth-box button:hover {
  color: var(--text);
  border-color: var(--accent);
}

.auth-box a {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.15s;
}

.auth-box a:hover { color: var(--accent); }

.landing-tagline {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.04em;
  margin-top: -8px;
}

.landing-btn {
  margin-top: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 8px 0;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  display: block;
}

.landing-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.auth-error {
  color: #ff5555;
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.04em;
  width: 100%;
}

.landing-footer {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.5;
  letter-spacing: 0.06em;
}

.auth-message {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  line-height: 1.6;
  letter-spacing: 0.02em;
}
