/* ----- Apple Notes-inspired aesthetic ----- */
:root {
  --bg: #fbf7ea;
  --paper: #fffdf3;
  --line: #f0e9d2;
  --ink: #1c1c1e;
  --ink-soft: #6c6a62;
  --ink-faint: #b7b3a3;
  --accent: #f5c518;
  --accent-soft: #fde9a0;
  --danger: #d9534f;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  outline: 0;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ----- Auth screen ----- */
#auth-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  max-width: 360px;
  width: 100%;
  text-align: center;
  background: var(--paper);
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
}

.auth-title {
  font-family: var(--serif);
  font-size: 38px;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.auth-sub {
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 24px;
  padding: 11px 22px;
  font-weight: 500;
  font-size: 15px;
}

.google-btn:hover {
  background: #f7f8f9;
}

.auth-note {
  color: var(--ink-faint);
  font-size: 13px;
  margin: 22px 0 0;
}

/* ----- Top bar (day strip) ----- */
.top-bar {
  display: flex;
  align-items: center;
  padding: max(env(safe-area-inset-top), 12px) 12px 8px;
  gap: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--ink);
}

.week-strip {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0 8px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.day-pill:hover {
  background: rgba(0,0,0,0.03);
}

.day-pill .num {
  font-size: 18px;
  font-weight: 600;
  margin-top: 2px;
  color: var(--ink);
}

.day-pill.is-today .num {
  background: var(--accent);
  color: var(--ink);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.day-pill.is-active {
  background: var(--accent-soft);
}

.day-pill.is-active.is-today {
  background: var(--accent-soft);
}

/* ----- Page (the day's list) ----- */
.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.page-inner {
  max-width: 640px;
  margin: 20px auto 40px;
  padding: 28px 28px 30vh;
  min-height: calc(100% - 60px);
  background: var(--paper);
  border-radius: 10px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 8px 24px rgba(60, 50, 20, 0.10),
    0 18px 48px rgba(60, 50, 20, 0.06);
}

.day-title {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -0.5px;
  margin: 0 0 2px;
  font-weight: 700;
}

.day-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 18px;
}

/* ----- Task list ----- */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  min-height: 32px;
  position: relative;
}

.task.dragging {
  background: rgba(0, 0, 0, 0.035);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  color: var(--ink-faint);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  flex-shrink: 0;
  margin-left: 4px;
  margin-top: 2px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.task:hover .drag-handle {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
  opacity: 1;
}

.checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  background: transparent;
  flex-shrink: 0;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checkbox:hover {
  border-color: var(--ink-soft);
}

.task.done .checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.task.done .checkbox::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.task-text {
  flex: 1;
  padding: 5px 0;
  min-height: 22px;
  word-break: break-word;
  white-space: pre-wrap;
  outline: 0;
  cursor: text;
}

.task.done .task-text {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.task.recurring .task-text::after {
  content: "↻";
  display: inline-block;
  margin-left: 8px;
  color: var(--ink-faint);
  font-size: 13px;
  vertical-align: middle;
}

/* ----- Overdue section ----- */
.section-header {
  list-style: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--ink-soft);
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.section-header.overdue-header {
  color: #b87324;
}

.task.overdue .task-text {
  color: var(--ink);
}

.src-date {
  display: inline-block;
  margin-left: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #b87324;
  background: rgba(184, 115, 36, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.task-actions {
  display: none;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}

.task:hover .task-actions {
  display: inline-flex;
}

.task-actions button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--ink-faint);
}

.task-actions button:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ink-soft);
}

.task-actions .delete:hover {
  color: var(--danger);
}

.add-tap-zone {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--ink-faint);
  padding: 10px 0 60px;
  font-size: 15px;
  margin-top: 4px;
}

.add-tap-zone:hover {
  color: var(--ink-soft);
}

/* ----- Recurring prompt modal ----- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 22px 22px 16px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.modal-q {
  margin: 0 0 18px;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions.vert {
  flex-direction: column;
  gap: 8px;
}

.day-chips {
  display: inline-flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.day-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.day-chip:hover {
  border-color: var(--ink-soft);
}

.day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.modal-hint {
  margin: 14px 0 2px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.modal-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
}

.modal-btn.primary {
  background: var(--accent);
  color: var(--ink);
}

.modal-btn.primary:hover {
  background: #e8b800;
}

.modal-btn.secondary {
  background: rgba(0,0,0,0.06);
  color: var(--ink);
}

.modal-btn.secondary:hover {
  background: rgba(0,0,0,0.1);
}

/* ----- Settings panel ----- */
.settings-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.settings-inner {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 0 22px 40vh;
  flex: 1;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(env(safe-area-inset-top), 12px) 0 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin: 0 -22px 18px;
  padding-left: 12px;
  padding-right: 12px;
}

.settings-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}

.settings-note {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 14px;
}

/* ----- Day transition ----- */
.page.swiping-left .page-inner {
  transform: translateX(-30px);
  opacity: 0;
  transition: all 0.2s;
}

.page.swiping-right .page-inner {
  transform: translateX(30px);
  opacity: 0;
  transition: all 0.2s;
}

.page-inner {
  transition: transform 0.2s, opacity 0.2s;
}

/* ----- Wider screens ----- */
@media (min-width: 760px) {
  .day-title {
    font-size: 36px;
  }
  .top-bar {
    padding: 18px 18px 12px;
  }
}
