/* ============================================================
   Notes v3 — minimal fullscreen textarea.
   Inspired by https://github.com/antonmedv/textarea
   Design goals:
     - The textarea IS the page. No chrome, no buttons, no sidebar.
     - Tiny status bars at top + bottom, auto-hide when typing.
     - Command palette (Ctrl+P) is the only modal surface.
     - Markdown preview mode swaps textarea for rendered HTML.
     - Theme-aware: all colors come from CSS custom properties.
   ============================================================ */

.notes-app {
  --note-bg: var(--bg, #1a0d1a);
  --note-fg: var(--fg, #ffd6e7);
  --note-fg-dim: var(--fg-dim, #b08a9c);
  --note-accent: var(--hot-pink, #ff77c8);
  --note-accent-2: var(--cyan, #7af0ff);
  --note-accent-3: var(--amber, #ffc857);
  --note-border: var(--border, #4a2c3f);
  --note-danger: #ff5577;
  --note-success: var(--cyan, #7af0ff);
  --note-mono: var(--font-mono, "VT323", "Press Start 2P", monospace);
  --note-display: var(--font-display, "Press Start 2P", monospace);
  --note-body: var(--font-body, "Source Serif 4", Georgia, serif);
  --note-textarea-bg: transparent;
  --note-textarea-fg: var(--fg, #ffd6e7);
  --note-textarea-caret: var(--hot-pink, #ff77c8);
  --note-bar-bg: rgba(0, 0, 0, 0.55);
  --note-bar-bg-solid: var(--bg, #1a0d1a);
  --note-bar-fg: var(--fg-dim, #b08a9c);
  --note-bar-fg-strong: var(--fg, #ffd6e7);
  --note-palette-overlay: rgba(0, 0, 0, 0.7);
  --note-palette-bg: var(--bg, #1a0d1a);
  --note-palette-border: var(--hot-pink, #ff77c8);
  --note-palette-selected: rgba(255, 119, 200, 0.15);

  /* container fills the whole page */
  display: block;
  position: relative;
  width: 100%;
  min-height: calc(100vh - 120px); /* leave room for boot + footer chrome */
  background: var(--note-bg);
  color: var(--note-fg);
  font-family: var(--note-mono);
  transition: background 0.25s, color 0.25s;
}

/* ============================================================
   Status / help bars — auto-hide.
   ============================================================ */
.notes-bar {
  position: sticky;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px;
  background: var(--note-bar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--note-border);
  color: var(--note-bar-fg);
  font-family: var(--note-mono);
  font-size: 16px;
  user-select: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
}
.notes-bar--top {
  top: 0;
  border-bottom: 1px solid var(--note-border);
  border-top: none;
}
.notes-bar--bottom {
  bottom: 0;
  top: auto;
  border-top: 1px solid var(--note-border);
  border-bottom: none;
  font-size: 15px;
}

/* When user is actively typing, bars shrink to a hairline */
.notes-app.is-typing .notes-bar--top,
.notes-app.is-typing .notes-bar--bottom {
  opacity: 0;
  pointer-events: none;
}
.notes-app.is-typing .notes-bar--top {
  transform: translateY(-100%);
}
.notes-app.is-typing .notes-bar--bottom {
  transform: translateY(100%);
}
.notes-app.is-idle .notes-bar--top {
  transform: translateY(0);
  opacity: 1;
}
.notes-app.is-idle .notes-bar--bottom {
  transform: translateY(0);
  opacity: 0.85;
}
.notes-app:not(.is-typing):not(.is-idle) .notes-bar--top {
  transform: translateY(0);
  opacity: 1;
}
.notes-app:not(.is-typing):not(.is-idle) .notes-bar--bottom {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}
/* When palette is open, keep bars visible & opaque */
.notes-app.is-palette-open .notes-bar { transform: none; opacity: 1; }

/* On the notes page, hide the site-wide footer AND boot sequence
   so the page is JUST a textarea. Also break the notes app out
   of the .shell width constraint so it goes edge-to-edge. */
body[data-page="notes"] .shell {
  max-width: 100%;
  padding: 0;
  margin: 0;
}
body[data-page="notes"] .boot { display: none !important; }
body[data-page="notes"] footer { display: none !important; }

/* Pull the notes app up to fill the space */
body[data-page="notes"] .notes-app {
  min-height: 100vh;
  margin: 0;
  border-top: 1px solid var(--note-border);
}

.notes-bar__group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.notes-bar__group--right { justify-content: flex-end; }
.notes-bar__sep { color: var(--note-border); }
.notes-bar__brand {
  color: var(--note-accent);
  font-family: var(--note-display);
  font-size: 12px;
  text-shadow: 0 0 6px var(--note-accent);
  letter-spacing: 1px;
}
.notes-bar__title {
  color: var(--note-bar-fg-strong);
  font-family: var(--note-mono);
  font-size: 17px;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-bar__stat { color: var(--note-bar-fg); }
.notes-bar__stat--saved { color: var(--note-success); }
.notes-bar__stat--saved[data-state="saving"] { color: var(--note-accent-3); }
.notes-bar__stat--saved[data-state="dirty"]  { color: var(--note-danger); }

.notes-bar .kbd {
  display: inline-block;
  padding: 0 4px;
  margin: 0 1px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--note-border);
  border-radius: 2px;
  font-family: var(--note-mono);
  font-size: 12px;
  color: var(--note-bar-fg-strong);
  line-height: 1.4;
}

/* ============================================================
   The textarea — owns the page.
   ============================================================ */
.notes-textarea {
  display: block;
  width: 100%;
  min-height: 100vh;
  height: 100%;
  background: var(--note-textarea-bg);
  color: var(--note-textarea-fg);
  border: none;
  outline: none;
  padding: 60px 8vw 120px;
  font-family: var(--note-mono);
  font-size: 19px;
  line-height: 1.55;
  caret-color: var(--note-textarea-caret);
  resize: none;
  tab-size: 2;
  scrollbar-width: thin;
  scrollbar-color: var(--note-border) transparent;
  transition: color 0.25s, background 0.25s;
}
.notes-textarea::-webkit-scrollbar { width: 10px; }
.notes-textarea::-webkit-scrollbar-track { background: transparent; }
.notes-textarea::-webkit-scrollbar-thumb {
  background: var(--note-border);
  border-radius: 0;
}
.notes-textarea::-webkit-scrollbar-thumb:hover { background: var(--note-accent); }
.notes-textarea::placeholder {
  color: var(--note-fg-dim);
  white-space: pre-wrap;
  opacity: 0.7;
}

/* When preview mode is on, hide the textarea */
.notes-app[data-mode="preview"] .notes-textarea { display: none; }

/* ============================================================
   Markdown preview pane
   ============================================================ */
.notes-preview {
  display: none;
  padding: 60px 8vw 120px;
  min-height: 100vh;
  font-family: var(--note-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--note-fg);
  max-width: 100%;
  overflow-y: auto;
}
.notes-app[data-mode="preview"] .notes-preview { display: block; }

.notes-preview > *:first-child { margin-top: 0; }
.notes-preview h1, .notes-preview h2, .notes-preview h3,
.notes-preview h4, .notes-preview h5, .notes-preview h6 {
  font-family: var(--note-display);
  color: var(--note-accent);
  margin: 1.6em 0 0.6em;
  line-height: 1.3;
  text-shadow: 0 0 6px var(--note-accent);
}
.notes-preview h1 { font-size: 22px; border-bottom: 1px dashed var(--note-border); padding-bottom: 6px; }
.notes-preview h2 { font-size: 18px; color: var(--note-accent-2); text-shadow: 0 0 6px var(--note-accent-2); }
.notes-preview h3 { font-size: 15px; color: var(--note-accent-3); text-shadow: 0 0 6px var(--note-accent-3); }
.notes-preview h4, .notes-preview h5, .notes-preview h6 { font-size: 13px; }

.notes-preview p { margin: 0 0 1em; }
.notes-preview a {
  color: var(--note-accent-2);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}
.notes-preview a:hover { color: var(--note-accent); }

.notes-preview strong { color: var(--note-accent-3); }
.notes-preview em { color: var(--note-accent-2); font-style: italic; }

.notes-preview code {
  font-family: var(--note-mono);
  font-size: 0.92em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--note-border);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--note-accent-2);
}
.notes-preview pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--note-border);
  border-left: 3px solid var(--note-accent);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 1.2em 0;
  font-family: var(--note-mono);
  font-size: 16px;
  line-height: 1.5;
}
.notes-preview pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--note-fg);
}

.notes-preview blockquote {
  margin: 1.2em 0;
  padding: 8px 16px;
  border-left: 3px solid var(--note-accent);
  background: rgba(255, 119, 200, 0.06);
  color: var(--note-fg-dim);
  font-style: italic;
}
.notes-preview blockquote > *:first-child { margin-top: 0; }
.notes-preview blockquote > *:last-child  { margin-bottom: 0; }

.notes-preview ul, .notes-preview ol {
  margin: 0.8em 0;
  padding-left: 1.6em;
}
.notes-preview li { margin: 0.2em 0; }
.notes-preview li::marker { color: var(--note-accent); }

.notes-preview hr {
  border: none;
  border-top: 1px dashed var(--note-border);
  margin: 2em 0;
}

.notes-preview table {
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
  font-family: var(--note-mono);
  font-size: 15px;
}
.notes-preview th, .notes-preview td {
  border: 1px solid var(--note-border);
  padding: 6px 10px;
  text-align: left;
}
.notes-preview th { background: rgba(255, 119, 200, 0.08); color: var(--note-accent); }

.notes-preview img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--note-border);
}

.notes-preview .dropcap {
  float: left;
  font-family: var(--note-display);
  font-size: 2.6em;
  line-height: 0.9;
  margin: 4px 8px 0 0;
  color: var(--note-accent);
  text-shadow: 0 0 8px var(--note-accent);
}

/* Empty preview state */
.notes-preview.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--note-fg-dim);
  font-family: var(--note-mono);
  font-size: 17px;
  font-style: italic;
  min-height: 300px;
}

/* ============================================================
   Command palette
   ============================================================ */
.notes-palette {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}
.notes-palette[hidden] { display: none; }
.notes-palette__backdrop {
  position: absolute;
  inset: 0;
  background: var(--note-palette-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: np-fade 0.15s ease-out;
}
.notes-palette__panel {
  position: relative;
  width: min(640px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--note-palette-bg);
  border: 2px solid var(--note-palette-border);
  box-shadow: 0 0 0 1px var(--note-border), 0 30px 80px rgba(0, 0, 0, 0.6),
              0 0 60px rgba(255, 119, 200, 0.15);
  animation: np-slide 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.notes-palette__input {
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--note-border);
  outline: none;
  color: var(--note-fg);
  font-family: var(--note-mono);
  font-size: 22px;
  caret-color: var(--note-accent);
}
.notes-palette__input::placeholder { color: var(--note-fg-dim); }

.notes-palette__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--note-border) transparent;
}
.notes-palette__list::-webkit-scrollbar { width: 8px; }
.notes-palette__list::-webkit-scrollbar-thumb { background: var(--note-border); }

.notes-palette__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.08s, border-color 0.08s;
  font-family: var(--note-mono);
  font-size: 17px;
  color: var(--note-fg);
}
.notes-palette__item:hover { background: rgba(255, 255, 255, 0.03); }
.notes-palette__item.is-selected {
  background: var(--note-palette-selected);
  border-left-color: var(--note-accent);
}
.notes-palette__icon {
  display: inline-block;
  width: 22px;
  text-align: center;
  color: var(--note-accent);
  font-weight: bold;
}
.notes-palette__main { flex: 1; min-width: 0; }
.notes-palette__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-palette__sub {
  font-size: 13px;
  color: var(--note-fg-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-palette__hint {
  display: flex;
  gap: 14px;
  padding: 8px 18px;
  border-top: 1px solid var(--note-border);
  font-family: var(--note-mono);
  font-size: 12px;
  color: var(--note-fg-dim);
  background: rgba(0, 0, 0, 0.2);
}
.notes-palette__hint .kbd {
  display: inline-block;
  padding: 0 4px;
  margin-right: 4px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--note-border);
  border-radius: 2px;
  color: var(--note-fg);
}

.notes-palette__section {
  padding: 8px 18px 2px;
  font-family: var(--note-display);
  font-size: 10px;
  color: var(--note-fg-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-top: 1px dashed var(--note-border);
}
.notes-palette__section:first-child { border-top: none; }

.notes-palette__item mark {
  background: var(--note-accent-3);
  color: var(--note-bg);
  padding: 0 1px;
}

.notes-palette__empty {
  padding: 20px 18px;
  color: var(--note-fg-dim);
  font-style: italic;
  text-align: center;
  font-family: var(--note-mono);
  font-size: 15px;
}

@keyframes np-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes np-slide {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ============================================================
   Confirm dialog (delete)
   ============================================================ */
.notes-confirm {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  animation: nc-slide-up 0.2s ease-out;
}
.notes-confirm[hidden] { display: none; }
.notes-confirm__box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--note-palette-bg);
  border: 2px solid var(--note-danger);
  padding: 12px 16px;
  font-family: var(--note-mono);
  font-size: 16px;
  box-shadow: 0 0 0 1px var(--note-border), 0 10px 40px rgba(255, 85, 119, 0.25);
}
.notes-confirm__title { color: var(--note-danger); font-weight: bold; }
.notes-confirm__body  { color: var(--note-fg); }
.notes-confirm__actions { display: flex; align-items: center; gap: 8px; }
.notes-confirm__hint { color: var(--note-fg-dim); font-size: 13px; }
.notes-confirm__hint .kbd {
  display: inline-block;
  padding: 0 4px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--note-border);
  border-radius: 2px;
  color: var(--note-fg);
  margin: 0 1px;
}
.notes-btn {
  display: inline-block;
  padding: 4px 12px;
  background: transparent;
  color: var(--note-fg);
  border: 1px solid var(--note-border);
  font-family: var(--note-mono);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.12s;
}
.notes-btn:hover { border-color: var(--note-accent); color: var(--note-accent); }
.notes-btn--danger { border-color: var(--note-danger); color: var(--note-danger); }
.notes-btn--danger:hover { background: var(--note-danger); color: var(--note-bg); }
@keyframes nc-slide-up {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ============================================================
   Toast — ephemeral top-center
   ============================================================ */
.notes-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: var(--note-palette-bg);
  border: 1px solid var(--note-accent);
  color: var(--note-fg);
  padding: 8px 18px;
  font-family: var(--note-mono);
  font-size: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: nt-fade 0.2s ease-out;
  pointer-events: none;
}
.notes-toast[hidden] { display: none; }
.notes-toast.is-error { border-color: var(--note-danger); color: var(--note-danger); }
@keyframes nt-fade {
  from { transform: translateX(-50%) translateY(-8px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ============================================================
   Responsive — mobile & touch
   Goal: works on a 360px Android in portrait just as well as
         on a 27" monitor. Touch targets ≥ 44px, safe-area-inset
         for notched devices, dynamic viewport height for iOS,
         command palette becomes a bottom sheet on touch.
   ============================================================ */

/* ------- Tablet + phone (≤ 768px) ------- */
@media (max-width: 768px) {
  /* iOS Safari 100vh bug — use dynamic viewport height with fallback */
  .notes-app      { min-height: 100vh; min-height: 100dvh; }
  .notes-textarea { min-height: 100vh; min-height: 100dvh; }
  .notes-preview  { min-height: 100vh; min-height: 100dvh; }

  /* Tighter padding, smaller font, no iOS zoom (16px+) */
  .notes-textarea, .notes-preview {
    padding: 32px 5vw 96px;
    font-size: 17px;
    line-height: 1.6;
  }
  .notes-textarea { -webkit-text-size-adjust: 100%; }

  /* Bars — slightly bigger, respect safe areas */
  .notes-bar { padding: 8px 14px; font-size: 14px; gap: 8px; }
  .notes-bar--bottom { font-size: 13px; padding: 8px 14px; gap: 6px; }
  .notes-bar__title { max-width: 200px; }
  .notes-bar__sep--desktop { display: none; }

  /* iOS safe-area — respect notch + home indicator */
  .notes-bar--top    { padding-top:    max(8px, env(safe-area-inset-top)); }
  .notes-bar--bottom { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .notes-toast       { top: max(60px, calc(env(safe-area-inset-top) + 60px)); }

  /* Command palette — larger touch targets, larger input */
  .notes-palette { padding-top: 6vh; }
  .notes-palette__panel {
    width: 96vw;
    max-height: 82vh;
    max-height: 82dvh;
  }
  .notes-palette__input { font-size: 18px; padding: 16px; }
  .notes-palette__item {
    font-size: 16px;
    padding: 14px 18px;
    gap: 14px;
  }
  .notes-palette__icon { width: 28px; font-size: 20px; }

  /* Confirm — full-width, big buttons, bottom sheet style */
  .notes-confirm {
    left: 12px; right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: none;
  }
  .notes-confirm__box {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .notes-confirm__actions { justify-content: stretch; gap: 10px; }
  .notes-confirm__title { font-size: 17px; }
  .notes-confirm__body  { font-size: 15px; }

  /* Buttons — 44px minimum touch target */
  .notes-btn {
    padding: 12px 18px;
    font-size: 16px;
    min-height: 44px;
  }
}

/* ------- Phone only (≤ 480px) ------- */
@media (max-width: 480px) {
  .notes-textarea, .notes-preview { padding: 24px 4vw 110px; font-size: 16px; }
  .notes-bar { padding: 6px 10px; font-size: 13px; }
  .notes-bar--bottom { font-size: 12px; padding: 6px 10px; }
  .notes-bar__title { max-width: 140px; }
  .notes-bar__brand { font-size: 11px; padding: 4px 0; }
  .notes-palette__input { font-size: 17px; padding: 14px; }
  .notes-palette__item { font-size: 15px; padding: 12px 14px; }
}

/* ------- Touch device (independent of screen size) ------- */
@media (pointer: coarse) {
  /* No tap highlight flash, no 300ms tap delay */
  .notes-btn, .notes-palette__item, .notes-palette__panel,
  .notes-bar__brand--btn, .notes-bar__title {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  /* Allow vertical pan on textarea, but not horizontal (we handle swipes in JS) */
  .notes-textarea { touch-action: pan-y; }

  /* Prevent pull-to-refresh inside notes app */
  .notes-app, .notes-palette { overscroll-behavior: contain; }

  /* Bigger tap targets everywhere */
  .notes-btn { min-height: 44px; }
  .notes-palette__item { min-height: 48px; }

  /* Hide keyboard-shortcut hints on touch (no Ctrl key) */
  .notes-bar--bottom .kbd,
  .notes-bar--bottom .notes-bar__sep { display: none; }
  .notes-bar--bottom .notes-bar__kbd-hint { display: none; }
  .notes-bar--bottom .notes-bar__touch-hint { display: inline; }

  /* Palette hints: arrow keys / esc not applicable on touch */
  .notes-palette__hint { display: none; }

  /* Brand button gets a subtle pressed state */
  .notes-bar__brand--btn { cursor: pointer; }
  .notes-bar__brand--btn:active {
    color: var(--note-accent-2);
    text-shadow: 0 0 8px var(--note-accent-2);
  }
  .notes-bar__title { cursor: pointer; }
  .notes-bar__title:active {
    color: var(--note-accent);
  }

  /* Buttons get visible active feedback (no :hover on touch) */
  .notes-btn:active:not(:disabled) {
    background: var(--note-accent);
    color: var(--note-bg);
    border-color: var(--note-accent);
  }
  .notes-btn--danger:active:not(:disabled) {
    background: var(--note-danger);
    color: var(--note-bg);
  }
}

/* ------- No hover (touch + pen) ------- */
@media (hover: none) {
  .notes-palette__item:hover { background: transparent; }
  .notes-btn:hover { border-color: var(--note-border); color: var(--note-fg); }
  .notes-btn--danger:hover { background: transparent; color: var(--note-danger); }
}

/* ------- Mobile bottom sheet for the palette ------- */
.notes-app.is-touch .notes-palette {
  align-items: flex-end;
  padding-top: 0;
}
.notes-app.is-touch .notes-palette__panel {
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  width: 100vw;
  max-width: 100vw;
  max-height: 92vh;
  max-height: 92dvh;
  padding-bottom: env(safe-area-inset-bottom);
  animation: np-slide-mobile 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* Drag handle — purely visual affordance */
.notes-app.is-touch .notes-palette__panel::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  background: var(--note-border);
  border-radius: 2px;
  margin: 10px auto 4px;
  pointer-events: none;
}
.notes-app.is-touch .notes-palette__backdrop {
  background: rgba(0, 0, 0, 0.55);
}
@keyframes np-slide-mobile {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ------- Swipe gesture visual feedback ------- */
.notes-app.is-swiping .notes-textarea {
  transition: transform 0.12s ease-out;
  will-change: transform;
  opacity: 0.85;
}
.notes-app.is-swipe-prev .notes-textarea { transform: translateX(14px); }
.notes-app.is-swipe-next .notes-textarea { transform: translateX(-14px); }
.notes-app.is-swipe-down .notes-palette__panel { transform: translateY(40%); }

/* ------- Virtual keyboard open — hide top bar ------- */
.notes-app.is-keyboard-open .notes-bar--top {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* ------- Welcome toast (first mobile visit) ------- */
.notes-welcome-touch {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: nt-fade 0.25s ease-out;
}
.notes-welcome-touch[hidden] { display: none; }
.notes-welcome-touch__box {
  max-width: 320px;
  background: var(--note-palette-bg);
  border: 2px solid var(--note-accent);
  padding: 20px;
  font-family: var(--note-mono);
  color: var(--note-fg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.notes-welcome-touch__title {
  font-family: var(--note-display);
  font-size: 14px;
  color: var(--note-accent);
  text-shadow: 0 0 8px var(--note-accent);
  margin-bottom: 10px;
}
.notes-welcome-touch__body {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
  color: var(--note-fg);
}
.notes-welcome-touch__body strong { color: var(--note-accent-2); }
.notes-welcome-touch__body em { color: var(--note-accent-3); font-style: normal; }
.notes-welcome-touch__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ------- Reduced motion ------- */
@media (prefers-reduced-motion: reduce) {
  .notes-bar, .notes-textarea, .notes-app, .notes-palette__backdrop,
  .notes-palette__panel, .notes-confirm, .notes-toast,
  .notes-palette__item, .notes-btn, .notes-welcome-touch {
    animation: none !important;
    transition: none !important;
  }
  /* Swipe feedback still works but instantly */
  .notes-app.is-swipe-prev .notes-textarea,
  .notes-app.is-swipe-next .notes-textarea { transform: none; }
}
