/* ============================================================
   NOTEPAD — game-UI notepad
   Palette: deep purple / rich gold / near-black
   ============================================================ */

:root {
  --bg-0: #0a0712;
  --bg-1: #140b22;

  --purple-deep: #552583;
  --purple: #8b5cf6;
  --purple-dim: #6d43b8;
  --purple-soft: #b9a8e0;

  --gold: #fdb927;
  --gold-soft: #ffd977;
  --gold-deep: #d99e0b;

  --ink: #f4effc;
  --ink-dim: #b6a7d6;
  --ink-faint: #9484b3;
  --ink-on-gold: #221302;

  --danger: #ff5c7a;

  --glass: rgba(103, 58, 183, 0.10);
  --glass-strong: rgba(103, 58, 183, 0.16);
  --glass-brd: rgba(163, 122, 255, 0.20);
  --glass-brd-hi: rgba(178, 140, 255, 0.42);

  --shadow-card: 0 8px 28px rgba(20, 8, 40, 0.55);
  --glow-purple: 0 0 0 1px var(--glass-brd-hi), 0 10px 34px rgba(85, 37, 131, 0.5), 0 0 22px rgba(139, 92, 246, 0.22);
  --glow-gold: 0 6px 22px rgba(253, 185, 39, 0.28), 0 0 14px rgba(253, 185, 39, 0.20);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --tr-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr: 260ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-ui: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-display: "Chakra Petch", "Outfit", "Segoe UI", sans-serif;
  --font-script: "Caveat", "Segoe Script", cursive;
}

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

html { scrollbar-color: var(--purple-dim) var(--bg-0); }

body {
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(253, 185, 39, 0.85); color: #221302; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
}
/* mouse focus keeps the styled borders; keyboard focus still gets an outline */
input:focus:not(:focus-visible), textarea:focus:not(:focus-visible) { outline: none; }

body.modal-locked { overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- ambient background ---------- */

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: -2;
}
.bg-glow-purple {
  width: 62vw; height: 62vw;
  max-width: 900px; max-height: 900px;
  top: -22vw; left: -18vw;
  background: radial-gradient(circle, rgba(85, 37, 131, 0.55), transparent 65%);
}
.bg-glow-violet {
  width: 55vw; height: 55vw;
  max-width: 820px; max-height: 820px;
  bottom: -24vw; right: -16vw;
  background: radial-gradient(circle, rgba(109, 67, 184, 0.34), transparent 65%);
}
.bg-glow-gold {
  width: 26vw; height: 26vw;
  max-width: 380px; max-height: 380px;
  top: -8vw; right: 12vw;
  background: radial-gradient(circle, rgba(253, 185, 39, 0.10), transparent 70%);
}
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 28px 80px;
}

/* ---------- header ---------- */

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  letter-spacing: 0.14em;
  line-height: 1.05;
  background: linear-gradient(115deg, #ffffff 30%, var(--purple-soft) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 34px rgba(139, 92, 246, 0.35);
}

.brand-sub {
  font-family: var(--font-script);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--gold);
  transform: rotate(-1.6deg);
  transform-origin: left center;
  margin-top: 2px;
  text-shadow: 0 0 18px rgba(253, 185, 39, 0.35);
}

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

/* icon buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  color: var(--ink-dim);
  transition: color var(--tr-fast), background var(--tr-fast), border-color var(--tr-fast),
              box-shadow var(--tr-fast), transform var(--tr-fast);
}
.tool-btn {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tool-btn:hover {
  color: var(--ink);
  border-color: var(--glass-brd-hi);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}

/* search */
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.search-wrap .tool-btn {
  background: none;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.search-wrap .tool-btn:hover { box-shadow: none; transform: none; }
.search-wrap.open {
  border-color: var(--glass-brd-hi);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}
.search-input {
  width: 0;
  opacity: 0;
  font-size: 0.95rem;
  color: var(--ink);
  transition: width var(--tr), opacity var(--tr), padding var(--tr);
}
.search-input::placeholder { color: var(--ink-faint); }
.search-wrap.open .search-input {
  width: 200px;
  opacity: 1;
  padding-right: 14px;
}
.search-input::-webkit-search-cancel-button { display: none; }

/* gold button */
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.92rem;
  color: var(--ink-on-gold);
  background: linear-gradient(160deg, var(--gold-soft) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: 0 4px 16px rgba(253, 185, 39, 0.22);
  transition: transform var(--tr-fast), box-shadow var(--tr-fast), filter var(--tr-fast);
}
.btn-gold:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--glow-gold);
  filter: brightness(1.06);
}
.btn-gold:active {
  transform: translateY(0) scale(0.99);
  filter: brightness(0.97);
}
.btn-new { height: 42px; padding: 0 18px; }
.btn-new .icon { width: 17px; height: 17px; stroke-width: 2.6; }

/* settings popover */
.settings-wrap { position: relative; }
.settings-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 218px;
  padding: 14px;
  background: rgba(24, 13, 42, 0.92);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  z-index: 40;
  animation: pop-in 200ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.settings-title {
  display: block;
  font-family: var(--font-script);
  font-size: 1.25rem;
  color: var(--gold);
  margin-bottom: 8px;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--ink-dim);
  transition: background var(--tr-fast), color var(--tr-fast);
}
.settings-item:hover { background: var(--glass-strong); color: var(--ink); }
.settings-item .icon { width: 17px; height: 17px; }
.settings-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-brd);
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ---------- filters ---------- */

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 30px 0 24px;
}
.chip {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
  padding: 8px 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast),
              background var(--tr-fast), transform var(--tr-fast);
}
.chip:hover {
  color: var(--ink);
  border-color: var(--glass-brd-hi);
  transform: translateY(-1px);
}
.chip.is-active {
  color: var(--gold);
  border-color: rgba(253, 185, 39, 0.55);
  background: rgba(253, 185, 39, 0.07);
  box-shadow: 0 0 14px rgba(253, 185, 39, 0.18);
}

/* ---------- notes grid ---------- */

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 18px;
}

.note-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 14px;
  background: linear-gradient(165deg, rgba(122, 72, 200, 0.14), rgba(52, 27, 92, 0.10));
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  animation: card-in 280ms cubic-bezier(0.25, 0.7, 0.3, 1) both;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
}
.note-card:hover, .note-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--glass-brd-hi);
  box-shadow: var(--glow-purple);
}
.note-card.leaving {
  transform: scale(0.9);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: none;
}
.note-card.is-pinned {
  border-top: 1px solid rgba(253, 185, 39, 0.45);
  background:
    linear-gradient(180deg, rgba(253, 185, 39, 0.05), transparent 34%),
    linear-gradient(165deg, rgba(122, 72, 200, 0.14), rgba(52, 27, 92, 0.10));
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-title {
  font-family: var(--font-script);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title.untitled { color: var(--ink-faint); }

.pin-btn {
  width: 34px;
  height: 34px;
  margin: -4px -6px 0 0;
  color: var(--ink-faint);
}
.pin-btn:hover {
  color: var(--purple-soft);
  background: var(--glass-strong);
}
.note-card.is-pinned .pin-btn { color: var(--gold); }
.note-card.is-pinned .pin-btn .icon { fill: var(--gold); }
.note-card.is-pinned .pin-btn:hover { color: var(--gold-soft); }

.card-preview {
  font-size: 0.92rem;
  font-weight: 300;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.card-preview:empty { display: none; }

.card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-progress[hidden] { display: none; }
.progress-track {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.16);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--purple-dim), var(--purple));
  transition: width 360ms cubic-bezier(0.4, 0, 0.2, 1), background var(--tr);
}
.progress-text {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: color var(--tr);
}
.note-card.is-complete .progress-fill {
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  box-shadow: 0 0 10px rgba(253, 185, 39, 0.45);
}
.note-card.is-complete .progress-text {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(253, 185, 39, 0.4);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.card-time {
  font-size: 0.76rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.card-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--tr-fast), transform var(--tr-fast);
}
.note-card:hover .card-actions,
.note-card:focus-within .card-actions {
  opacity: 1;
  transform: none;
}
.card-actions .icon-btn {
  width: 32px;
  height: 32px;
  color: var(--ink-faint);
}
.card-actions .icon-btn .icon { width: 17px; height: 17px; }
.archive-btn:hover { color: var(--purple-soft); background: var(--glass-strong); }
.delete-btn:hover { color: var(--danger); background: rgba(255, 92, 122, 0.08); }

.delete-btn .confirm-label {
  display: none;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.delete-btn.confirm {
  width: auto;
  padding: 0 12px;
  color: var(--danger);
  background: rgba(255, 92, 122, 0.1);
  box-shadow: 0 0 12px rgba(255, 92, 122, 0.25);
}
.delete-btn.confirm .icon-trash { display: none; }
.delete-btn.confirm .confirm-label { display: inline; }

/* ---------- empty state ---------- */

.empty-state {
  padding: 90px 20px;
  text-align: center;
}
.empty-script {
  font-family: var(--font-script);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 500;
  color: var(--ink-faint);
  transform: rotate(-1.2deg);
}
.empty-script b {
  color: var(--gold);
  font-weight: 600;
  text-shadow: 0 0 16px rgba(253, 185, 39, 0.35);
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 4, 14, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 220ms ease both;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: min(86vh, 780px);
  max-height: min(86dvh, 780px);
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px 28px 24px;
  background: linear-gradient(170deg, rgba(38, 20, 68, 0.92), rgba(18, 10, 34, 0.94));
  border: 1px solid var(--glass-brd-hi);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(85, 37, 131, 0.35);
  overflow-y: auto;
  animation: modal-in 260ms cubic-bezier(0.3, 1.25, 0.5, 1) both;
}
.modal.shake { animation: shake 340ms ease; }

.modal-tag {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.6deg);
  font-family: var(--font-script);
  font-size: 1.15rem;
  color: var(--purple-soft);
  opacity: 0.85;
  pointer-events: none;
}

.modal-close {
  /* sticky, not absolute — must stay reachable while the modal scrolls */
  position: sticky;
  top: 8px;
  align-self: flex-end;
  margin: -14px -14px -38px 0;
  z-index: 6;
  width: 38px;
  height: 38px;
  color: var(--ink-faint);
  background: rgba(28, 16, 50, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-close:hover {
  color: var(--ink);
  background: var(--glass-strong);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.35);
}

.note-title {
  font-family: var(--font-script);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.2;
  color: var(--ink);
  padding: 14px 4px 6px;
  border-bottom: 1px solid var(--glass-brd);
  transition: border-color var(--tr-fast);
}
.note-title:focus { border-color: rgba(253, 185, 39, 0.5); }
.note-title::placeholder { color: var(--ink-faint); opacity: 0.8; }

.note-body {
  font-size: 0.98rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--ink);
  background: rgba(10, 6, 20, 0.35);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  resize: vertical;
  min-height: 110px;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.note-body:focus {
  border-color: var(--glass-brd-hi);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.18);
}
.note-body::placeholder { color: var(--ink-faint); }

.section-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--purple-soft);
  margin-bottom: 10px;
}

.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--tr-fast);
}
.check-item:hover { background: rgba(139, 92, 246, 0.07); }

/* animated strike-through line across the text */
.check-item::after {
  content: "";
  position: absolute;
  left: 40px;   /* item padding 6 + checkbox 22 + gap 12 */
  right: 48px;  /* remove btn 30 + gap 12 + padding 6 */
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: rgba(253, 185, 39, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.check-item.done::after { transform: scaleX(1); }

.check-box {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--purple-dim);
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.check-box:hover { border-color: var(--purple); box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
.check-box::after {
  content: "";
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23221302' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transform: scale(0);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.check-box:checked {
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(253, 185, 39, 0.4);
  animation: check-pop 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.check-box:checked::after { transform: scale(1); }

.check-text {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 2px 0;
  transition: color var(--tr);
}
/* these fields carry their own visible focus styles, so skip the global outline */
.note-title:focus-visible, .note-body:focus-visible,
.check-add-input:focus-visible, .search-input:focus-visible,
.check-text:focus-visible { outline: none; }
.check-text:focus { box-shadow: 0 2px 0 -1px var(--glass-brd-hi); }
.check-text:focus-visible { box-shadow: 0 2px 0 -1px var(--gold); }
.check-item.done .check-text { color: var(--ink-faint); }

.item-remove {
  width: 30px;
  height: 30px;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity var(--tr-fast), color var(--tr-fast), background var(--tr-fast);
}
.check-item:hover .item-remove,
.check-item:focus-within .item-remove { opacity: 1; }
.item-remove:hover { color: var(--danger); background: rgba(255, 92, 122, 0.08); }
.item-remove .icon { width: 15px; height: 15px; }

.check-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.check-add-input {
  flex: 1;
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(10, 6, 20, 0.35);
  border: 1px dashed var(--glass-brd);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color var(--tr-fast);
}
.check-add-input:focus { border-color: var(--glass-brd-hi); border-style: solid; }
.check-add-input::placeholder { color: var(--ink-faint); }
.check-add-btn {
  width: 38px;
  height: 38px;
  color: var(--purple-soft);
  background: var(--glass);
  border: 1px solid var(--glass-brd);
}
.check-add-btn:hover {
  color: var(--gold);
  border-color: rgba(253, 185, 39, 0.5);
  box-shadow: 0 0 12px rgba(253, 185, 39, 0.2);
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 4px;
}
.discard-hint {
  font-family: var(--font-script);
  font-size: 1.05rem;
  color: var(--gold);
  animation: fade-in 200ms ease both;
}
.btn-accept {
  font-size: 1rem;
  padding: 13px 34px;
  letter-spacing: 0.12em;
}

/* ---------- saved pill + toasts ---------- */

.saved-pill {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: rgba(24, 13, 42, 0.9);
  border: 1px solid rgba(253, 185, 39, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 18px rgba(253, 185, 39, 0.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--tr-fast), transform var(--tr-fast);
}
.saved-pill.show { opacity: 1; transform: none; }
.saved-pill .icon { width: 14px; height: 14px; stroke-width: 3; }

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  max-width: min(92vw, 520px);
  font-size: 0.92rem;
  color: var(--ink);
  overflow-wrap: anywhere;
  background: rgba(24, 13, 42, 0.94);
  border: 1px solid var(--glass-brd-hi);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  animation: toast-in 240ms cubic-bezier(0.3, 1.25, 0.5, 1) both;
}
.toast.error { border-color: rgba(255, 92, 122, 0.5); }
.toast-action {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--tr-fast), text-shadow var(--tr-fast);
}
.toast-action:hover {
  background: rgba(253, 185, 39, 0.1);
  text-shadow: 0 0 12px rgba(253, 185, 39, 0.6);
}
.toast.hide { opacity: 0; transform: translateY(8px); transition: opacity 220ms ease, transform 220ms ease; }

/* ---------- animations ---------- */

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
}
@keyframes check-pop {
  0% { transform: scale(0.9); }
  55% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .page { padding: 26px 18px 70px; }
  .app-header { flex-direction: column; }
  .toolbar { width: 100%; padding-top: 2px; }
  .search-wrap.open { flex: 1; }
  .search-wrap.open .search-input { width: 100%; flex: 1; }
  .btn-new { margin-left: auto; }
  /* anchor the popover to the gear's left edge so it can't clip off-screen */
  .settings-pop { left: 0; right: auto; }
}

@media (max-width: 640px) {
  .notes-grid { grid-template-columns: 1fr; gap: 14px; }
  .filters { margin: 22px 0 18px; }
  .chip { padding: 8px 13px; font-size: 0.75rem; }
  .toolbar { flex-wrap: wrap; }
  .search-wrap.open { flex: 1 1 100%; order: -1; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal {
    max-height: 92vh;
    max-height: 92dvh;
    padding: 28px 18px 18px;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
  }
  .btn-accept { flex: 1; justify-content: center; }
  .card-actions { opacity: 1; transform: none; }
  .item-remove { opacity: 1; }
  .saved-pill { right: 14px; bottom: 14px; }
  /* keep toasts clear of the saved pill and give them the full width */
  .toast-region { left: 16px; right: 16px; bottom: 64px; transform: none; }
  .toast { width: 100%; max-width: none; justify-content: space-between; }
  /* 16px inputs so iOS Safari doesn't auto-zoom on focus */
  .search-input, .check-text, .check-add-input, .note-body { font-size: 1rem; }
}

/* touch devices: keep actions visible, skip hover lift */
@media (hover: none) {
  .card-actions { opacity: 1; transform: none; }
  .item-remove { opacity: 1; }
  .note-card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
