:root {
  color-scheme: light dark;
  --yellow: #ffd60a;
  --ink-blue: #22577a;
  --app-bg: #ede8e0;
  --sidebar-bg: #e5dfd6;
  --note-bg: #fefcf8;
  --note-line: rgba(0, 0, 0, 0.042);
  --text: #1c1c1e;
  --text-2: #6c6c70;
  --text-3: #76767d;
  --border: rgba(0, 0, 0, 0.08);
  --surface-muted: rgba(0, 0, 0, 0.025);
  --surface-hover: rgba(0, 0, 0, 0.045);
  --danger: #a3343f;
  --focus: rgba(34, 87, 122, 0.36);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 268px;
  --content-max: 650px;
  --pad: 44px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --yellow: #f4c430;
    --ink-blue: #8ecae6;
    --app-bg: #171819;
    --sidebar-bg: #202122;
    --note-bg: #111213;
    --note-line: rgba(255, 255, 255, 0.045);
    --text: #f4f0e8;
    --text-2: #c9c1b7;
    --text-3: #aaa298;
    --border: rgba(255, 255, 255, 0.1);
    --surface-muted: rgba(255, 255, 255, 0.045);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --danger: #ff9ca4;
    --focus: rgba(142, 202, 230, 0.45);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.app {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: var(--sidebar-w);
  height: 100vh;
  flex-shrink: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
}

.sidebar-header {
  display: flex;
  min-height: 48px;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 14px;
}

.sidebar-logo {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.local-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--text-3);
  font-size: 10px;
}

.sidebar-intro {
  padding-top: 6px;
}

.group-label {
  display: block;
  margin: 0;
  padding: 10px 14px 3px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.note-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 1px 6px;
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
}

.note-item.active {
  background: var(--yellow);
  color: #1c1c1e;
}

.note-item-title {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item-preview {
  overflow: hidden;
  color: currentColor;
  font-size: 11.5px;
  opacity: 0.68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminders {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0 18px;
}

.reminders::-webkit-scrollbar {
  width: 0;
}

.reminders-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.reminders-heading > span {
  padding: 0 14px 3px 6px;
  color: var(--text-3);
  font-size: 10.5px;
  white-space: nowrap;
}

.empty-state {
  margin: 2px 6px;
  padding: 10px;
  color: var(--text-3);
  font-size: 12px;
}

.empty-state p {
  margin: 0;
}

.reminder-list {
  display: grid;
  gap: 2px;
  margin: 2px 0 0;
  padding: 0 6px;
  list-style: none;
}

.reminder-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: center;
  border-radius: 8px;
  padding: 8px 7px 8px 10px;
  transition: background-color 120ms var(--ease-out);
}

.reminder-item:hover {
  background: var(--surface-hover);
}

.reminder-time {
  grid-column: 1;
  grid-row: 2;
  color: var(--text-3);
  font-size: 11.5px;
}

.reminder-copy {
  display: contents;
}

.reminder-copy strong {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminder-copy span {
  grid-column: 1;
  grid-row: 2;
  margin-left: 54px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-button {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.delete-button:hover {
  background: var(--surface-hover);
  color: var(--danger);
}

.sidebar-footer {
  display: flex;
  min-height: 49px;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  color: var(--text-3);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.13);
}

.note-area {
  min-height: 100vh;
  flex: 1;
  background-color: var(--note-bg);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 27px,
    var(--note-line) 27px,
    var(--note-line) 28px
  );
}

.mobile-header {
  display: none;
}

.note-content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--pad) 100px;
}

.note-section {
  border-bottom: 1px solid var(--border);
  padding: 52px 0;
}

.note-section:last-child {
  border-bottom: 0;
}

.note-title-area {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 32px;
}

.note-heading {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

h1.note-heading {
  font-size: 28px;
}

.note-meta {
  margin: 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.quiet-button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 0 10px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}

.quiet-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.quiet-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.intro-copy {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.8;
}

form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
}

.field-title input {
  min-height: 54px;
  font-size: 20px;
  font-weight: 600;
}

.field input::placeholder {
  color: var(--text-3);
  opacity: 0.58;
}

.field input:focus {
  border-bottom-color: var(--ink-blue);
  box-shadow: 0 1px 0 var(--ink-blue);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.form-error {
  min-height: 18px;
  margin: -6px 0 -4px;
  color: var(--danger);
  font-size: 12.5px;
}

.primary-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  background: var(--yellow);
  padding: 0 15px;
  color: #1c1c1e;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms var(--ease-out), transform 120ms var(--ease-out);
}

.primary-button:hover {
  filter: brightness(0.96);
}

.primary-button:active {
  transform: scale(0.995);
}

.primary-button span:last-child {
  font-size: 21px;
  font-weight: 400;
  line-height: 1;
}

.web-limit {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.web-limit p {
  margin: 0;
}

.web-limit strong {
  color: var(--text);
  font-weight: 600;
}

.note-dash {
  color: var(--text-3);
}

.how-it-works .note-heading {
  margin-bottom: 14px;
  font-size: 20px;
}

.how-it-works p {
  max-width: 520px;
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.75;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 200;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--text);
  padding: 11px 14px;
  color: var(--note-bg);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 800px) {
  :root {
    --pad: 22px;
  }

  .app {
    display: flex;
    flex-direction: column;
  }

  .note-area {
    order: 1;
    width: 100%;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--note-bg) 94%, transparent);
    padding: 0 18px;
    backdrop-filter: blur(12px);
  }

  .mobile-header a {
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
  }

  .mobile-header span {
    color: var(--text-3);
    font-size: 11px;
  }

  .note-section {
    padding: 38px 0;
  }

  h1.note-heading {
    font-size: 24px;
  }

  .sidebar {
    position: static;
    order: 2;
    width: 100%;
    height: auto;
    min-height: 280px;
    overflow: visible;
    border-top: 1px solid var(--border);
    border-right: 0;
  }

  .sidebar-header,
  .sidebar-intro {
    display: none;
  }

  .reminders {
    overflow: visible;
    padding: 18px 16px 34px;
  }

  .reminders-heading {
    max-width: 606px;
    margin: 0 auto;
  }

  .group-label {
    padding-left: 0;
  }

  .reminders-heading > span {
    padding-right: 0;
  }

  .empty-state,
  .reminder-list {
    max-width: 606px;
    margin-right: auto;
    margin-left: auto;
  }

  .reminder-list {
    padding: 0;
  }

  .reminder-item {
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 12px 4px;
  }

  .sidebar-footer {
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  :root {
    --pad: 16px;
  }

  .note-title-area {
    margin-bottom: 28px;
  }

  .time-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .primary-button {
    min-height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
