:root {
  --berry: #bb3e77;
  --berry-dark: #7d2450;
  --rose: #f06f9f;
  --pink: #ff9fc2;
  --pink-light: #ffd5e5;
  --blush: #fff0f7;
  --cream: #fff9fb;
  --gold: #ffd368;
  --ink: #4c2740;
  --muted: #8b657b;
  --white: #fff;
  --shadow: 0 24px 70px rgba(98, 31, 55, .18);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(255,179,214,.34), transparent 25rem),
    radial-gradient(circle at 90% 82%, rgba(240,111,159,.22), transparent 27rem),
    radial-gradient(circle at 88% 8%, rgba(255,221,128,.22), transparent 20rem),
    linear-gradient(145deg, #fff8fc 0%, #ffe4f0 52%, #fff9f4 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 15rem;
  height: 15rem;
  border: 18px solid rgba(255,255,255,.26);
  border-radius: 50%;
}

body::before { top: -7rem; right: -5rem; }
body::after { bottom: -8rem; left: -5rem; }

button { font: inherit; }

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 50% 43%, rgba(255,237,145,.43), transparent 20rem),
    linear-gradient(145deg, #7e1e51, #db4a88 62%, #ff9a8e);
  transition: opacity .55s ease, transform .55s ease, visibility .55s ease;
}

.welcome-screen[hidden] { display: none; }

.welcome-screen.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.07);
}

.welcome-sparkles {
  color: #ffe685;
  font-size: clamp(1.8rem, 8vw, 4.4rem);
  letter-spacing: .12em;
  animation: jackpot-pulse .65s ease-in-out infinite alternate;
}

.welcome-heart {
  margin: 4px 0 12px;
  font-size: clamp(4.2rem, 20vw, 8rem);
  filter: drop-shadow(0 12px 24px rgba(65,5,35,.32));
  animation: welcome-heart 1.1s ease-in-out infinite alternate;
}

.welcome-screen p {
  margin: 0;
  color: #ffe788;
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .28em;
}

.welcome-screen h2 {
  max-width: 620px;
  margin: 7px 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 10vw, 5rem);
  line-height: 1;
  text-shadow: 0 7px 0 rgba(102,18,61,.45);
}

.welcome-screen button {
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 15px 25px;
  color: var(--berry-dark);
  font-weight: 900;
  background: linear-gradient(135deg, #fffbd7, #ffd161);
  box-shadow: 0 14px 35px rgba(62,5,34,.28);
  cursor: pointer;
}

.welcome-screen button:focus-visible { outline: 4px solid #fff; outline-offset: 5px; }
.welcome-screen small { margin-top: 11px; color: rgba(255,255,255,.72); }

.decorations {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.floating-shape {
  position: absolute;
  display: grid;
  place-items: center;
  color: rgba(187,62,119,.2);
  font-family: Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 3.3rem);
  filter: drop-shadow(0 5px 8px rgba(187,62,119,.08));
  animation: floaty 5s ease-in-out infinite alternate;
}

.shape-1 { top: 9%; left: 7%; transform: rotate(-15deg); }
.shape-2 { top: 28%; right: 6%; color: rgba(240,111,159,.18); animation-delay: -1.4s; }
.shape-3 { bottom: 17%; left: 9%; font-size: 3.8rem; animation-delay: -2.2s; }
.shape-4 { top: 12%; right: 19%; color: rgba(245,185,66,.3); animation-delay: -.8s; }
.shape-5 { bottom: 8%; right: 10%; transform: rotate(15deg); animation-delay: -3s; }
.shape-6 { bottom: 34%; left: 3%; color: rgba(240,111,159,.15); animation-delay: -1.8s; }

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 18px 56px;
}

.hero {
  width: min(100%, 660px);
  text-align: center;
}

.love-note {
  display: table;
  margin: 0 auto 17px;
  padding: 8px 15px;
  border: 1px solid rgba(187,62,119,.13);
  border-radius: 999px;
  color: var(--berry);
  font-size: .85rem;
  font-weight: 750;
  background: rgba(255,255,255,.7);
  box-shadow: 0 8px 25px rgba(187,62,119,.1);
  transform: rotate(-1.5deg);
}

.love-note span { margin-right: 5px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--berry);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
}

.eyebrow::before,
.eyebrow::after {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: .45;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 9vw, 4.6rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.045em;
}

h1 span {
  color: var(--berry);
  font-style: italic;
  font-weight: 500;
}

.intro {
  max-width: 520px;
  margin: 20px auto 28px;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.6;
}

.machine {
  position: relative;
  width: min(100%, 470px);
  margin: 0 auto;
  padding: 34px 26px 27px;
  border: 5px solid #a52f68;
  border-radius: 32px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.4), transparent 28%),
    linear-gradient(145deg, #ff93bd, #dc4e89 72%, #c53d79);
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255,255,255,.28), 0 0 0 8px rgba(255,255,255,.42);
}

.machine-ribbon {
  position: absolute;
  top: -34px;
  left: 50%;
  z-index: 3;
  font-size: 3rem;
  filter: drop-shadow(0 6px 7px rgba(125,36,80,.22));
  transform: translateX(-50%) rotate(-4deg);
}

.machine-sticker {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 3px solid #fff;
  border-radius: 50%;
  font-size: 1.55rem;
  background: #ffe8f2;
  box-shadow: 0 8px 18px rgba(94,24,59,.2);
}

.secret-editor-button {
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.secret-editor-button:focus-visible { outline: 3px solid #ffd66e; outline-offset: 4px; }

.sticker-left { top: 88px; left: -26px; transform: rotate(-12deg); }
.sticker-right { right: -25px; bottom: 42px; transform: rotate(10deg); }

.machine-top {
  position: absolute;
  top: 9px;
  left: 50%;
  display: flex;
  gap: 12px;
  transform: translateX(-50%);
}

.machine-label {
  margin: 4px 0 10px;
  color: #fff;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .17em;
  text-shadow: 0 2px 5px rgba(87,20,51,.28);
}

.light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff4a9;
  box-shadow: 0 0 10px #fff4a9;
  animation: twinkle 1.2s infinite alternate;
}

.light:nth-child(even) { animation-delay: .6s; }

.reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  border: 3px solid #94285d;
  border-radius: 20px;
  background: #a92e67;
  box-shadow: inset 0 8px 18px rgba(0,0,0,.35);
}

.reel {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1.05;
  overflow: hidden;
  border: 2px solid rgba(255,231,149,.9);
  border-radius: 14px;
  background: linear-gradient(#fff, #fff2f8 48%, #f6dbe7 50%, #fff 53%);
  box-shadow: inset 0 0 16px rgba(95,23,49,.12);
}

.reel::before,
.reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24%;
  z-index: 1;
  pointer-events: none;
}

.reel::before { top: 0; background: linear-gradient(rgba(95,23,49,.17), transparent); }
.reel::after { bottom: 0; background: linear-gradient(transparent, rgba(95,23,49,.13)); }

.reel span {
  display: block;
  font-size: clamp(2.1rem, 12vw, 4.4rem);
  filter: drop-shadow(0 4px 3px rgba(92,22,49,.12));
}

.machine.is-spinning .reel span { animation: reel-bounce .12s linear infinite; }

.spin-button {
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  border: 0;
  border: 2px solid rgba(255,255,255,.82);
  border-bottom: 5px solid #a52f68;
  border-radius: 16px;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 850;
  background: linear-gradient(135deg, #f7639a, #c83978);
  box-shadow: 0 8px 16px rgba(48,8,23,.25);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}

.spin-button:hover { filter: brightness(1.05); transform: translateY(-2px); }
.spin-button:active { border-bottom-width: 2px; transform: translateY(2px); }
.spin-button:focus-visible,
.text-button:focus-visible { outline: 3px solid #ffd66e; outline-offset: 4px; }
.spin-button:disabled { cursor: wait; filter: grayscale(.2); opacity: .78; }
.button-icon { margin-right: 8px; }

.advice-card {
  position: relative;
  margin: 24px auto 0;
  padding: 27px 26px 20px;
  border: 1px solid rgba(143,41,76,.14);
  border-radius: 24px;
  text-align: left;
  background:
    radial-gradient(circle at 95% 10%, rgba(255,173,204,.2), transparent 9rem),
    rgba(255,255,255,.86);
  box-shadow: 0 18px 48px rgba(98,31,55,.12);
  backdrop-filter: blur(12px);
  animation: card-in .45s cubic-bezier(.2,.9,.2,1);
}

.advice-card::before {
  content: "💞";
  position: absolute;
  top: -16px;
  left: 22px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--pink-light);
  box-shadow: 0 6px 15px rgba(187,62,119,.14);
}

.advice-card.is-hidden { display: none; }

.quote-mark {
  position: absolute;
  top: 8px;
  right: 20px;
  color: rgba(216,95,131,.17);
  font-family: Georgia, serif;
  font-size: 5rem;
  line-height: 1;
}

.card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.read-toggle {
  border: 1px solid rgba(143,41,76,.16);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--berry-dark);
  font-size: .74rem;
  font-weight: 750;
  white-space: nowrap;
  background: rgba(255,255,255,.9);
  box-shadow: 0 4px 12px rgba(98,31,55,.08);
  cursor: pointer;
}

.read-toggle[aria-pressed="false"] { color: var(--muted); background: rgba(255,255,255,.6); }
.read-toggle:focus-visible { outline: 3px solid #ffd66e; outline-offset: 3px; }
.read-toggle[hidden], .text-button[hidden] { display: none; }

.category {
  color: var(--berry);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .14em;
}

#advice-text {
  position: relative;
  z-index: 1;
  margin: 10px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.22rem, 4vw, 1.55rem);
  line-height: 1.42;
}

.advice-number {
  display: inline;
  margin-left: .25em;
  color: rgba(125,36,80,.46);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  font-size: .62em;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: .08em;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(143,41,76,.12);
}

.text-button {
  border: 0;
  padding: 7px 2px;
  color: var(--berry);
  font-size: .88rem;
  font-weight: 750;
  background: transparent;
  cursor: pointer;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.sweet-footer {
  margin-top: 5px;
  color: rgba(125,36,80,.53);
  font-family: Georgia, serif;
  font-size: .8rem;
  font-style: italic;
}

.sweet-footer span { color: var(--rose); padding: 0 5px; }

.app-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.utility-button {
  border: 1px solid rgba(143,41,76,.16);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--berry-dark);
  font-size: .78rem;
  font-weight: 750;
  background: rgba(255,255,255,.68);
  box-shadow: 0 6px 18px rgba(98,31,55,.08);
  cursor: pointer;
}

.utility-button:focus-visible,
.jackpot-close:focus-visible { outline: 3px solid #ffd66e; outline-offset: 4px; }

.jackpot-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,236,136,.44), transparent 23rem),
    linear-gradient(145deg, rgba(121,23,78,.98), rgba(235,67,135,.97));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}

.jackpot-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.jackpot-overlay.is-mega {
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,210,.72), transparent 21rem),
    conic-gradient(from 210deg at 50% 50%, #a81f63, #f55f9d, #e9a928, #f55f9d, #a81f63);
  animation: mega-background .75s ease-in-out infinite alternate;
  overflow: hidden;
}

.jackpot-overlay.is-mega::before {
  content: "";
  position: absolute;
  inset: -70%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.34) 0 5deg, transparent 5deg 15deg);
  opacity: .35;
  animation: mega-rays 10s linear infinite;
}

.jackpot-overlay > * { position: relative; z-index: 1; }

.jackpot-overlay.is-mega .jackpot-stars {
  color: #fff5a7;
  text-shadow: 0 0 18px #fff, 0 0 45px #ffd44f;
}

.jackpot-overlay.is-mega h2 {
  color: #fffbe5;
  font-size: clamp(3.1rem, 14vw, 7.4rem);
  text-shadow: 0 7px 0 #9d3563, 0 0 42px rgba(255,228,107,.9);
}

.jackpot-overlay.is-mega .jackpot-heart {
  font-size: clamp(2.8rem, 12vw, 6rem);
  letter-spacing: -.16em;
  white-space: nowrap;
}

.jackpot-stars {
  color: #ffe17b;
  font-size: clamp(2rem, 9vw, 5rem);
  letter-spacing: .16em;
  text-shadow: 0 0 28px rgba(255,225,123,.8);
  animation: jackpot-pulse .65s ease-in-out infinite alternate;
}

.jackpot-heart {
  margin: 4px 0;
  font-size: clamp(4rem, 19vw, 9rem);
  filter: drop-shadow(0 12px 20px rgba(66,8,38,.35));
  animation: jackpot-pop .75s cubic-bezier(.2,.9,.2,1) both;
}

.jackpot-kicker {
  margin: 0;
  color: #ffe88f;
  font-size: clamp(.8rem, 3vw, 1.1rem);
  font-weight: 900;
  letter-spacing: .3em;
}

.jackpot-overlay h2 {
  margin: 2px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.8rem, 17vw, 8.5rem);
  line-height: .9;
  text-shadow: 0 8px 0 #8f294c, 0 16px 35px rgba(58,4,31,.35);
  animation: jackpot-title .75s cubic-bezier(.2,1.3,.3,1) both;
}

.jackpot-message {
  margin: 10px 0 24px;
  font-size: clamp(1.15rem, 4vw, 1.6rem);
  font-weight: 800;
}

.jackpot-close {
  min-width: 190px;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 13px 24px;
  color: var(--berry-dark);
  font-weight: 900;
  background: linear-gradient(135deg, #fff8c9, #ffd368);
  box-shadow: 0 12px 30px rgba(67,7,36,.28);
  cursor: pointer;
}

.confetti {
  position: fixed;
  z-index: 10;
  top: -20px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall 1.7s ease-in forwards;
}

.celebration-emoji {
  position: fixed;
  z-index: 120;
  left: 50vw;
  top: 50vh;
  font-size: clamp(1.4rem, 4vw, 3.2rem);
  pointer-events: none;
  filter: drop-shadow(0 5px 7px rgba(69,8,38,.28));
  animation: mega-emoji 3.8s cubic-bezier(.15,.7,.2,1) forwards;
}

.editor-panel {
  --editor-emerald: #147668;
  --editor-emerald-deep: #063d37;
  --editor-mint: #c8e6dc;
  --editor-gold: #d1b96f;
  --editor-ink: #0a3530;
  position: fixed;
  inset: 0;
  z-index: 200;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 14%, rgba(91,191,158,.2), transparent 28rem),
    radial-gradient(circle at 84% 82%, rgba(199,171,96,.17), transparent 24rem),
    linear-gradient(145deg, rgba(2,39,36,.95), rgba(5,67,59,.94));
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.editor-panel:not([hidden]) { display: grid; }

.editor-window {
  position: relative;
  width: min(100%, 650px);
  height: min(920px, calc(100dvh - 36px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid rgba(195,223,211,.6);
  border-radius: 26px;
  text-align: left;
  background:
    radial-gradient(circle at 88% 4%, rgba(215,183,100,.2), transparent 13rem),
    radial-gradient(circle at 8% 90%, rgba(77,153,161,.22), transparent 19rem),
    linear-gradient(145deg, #0c5048, #063a35 62%, #092f31);
  box-shadow: 0 32px 100px rgba(0,23,21,.62), 0 0 48px rgba(73,174,147,.13);
}

.editor-window::before {
  content: "✦";
  position: absolute;
  z-index: 4;
  top: 13px;
  right: 68px;
  color: rgba(199,165,79,.82);
  font-size: 1rem;
  text-shadow: -28px 22px 0 rgba(73,158,133,.48), 18px 34px 0 rgba(199,165,79,.42);
  pointer-events: none;
  animation: editor-magic 2.8s ease-in-out infinite alternate;
}

.editor-fixed {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 20px 24px 11px;
  border-bottom: 1px solid rgba(206,185,119,.27);
  background:
    radial-gradient(circle at 88% 0%, rgba(202,176,104,.2), transparent 12rem),
    linear-gradient(120deg, rgba(14,87,76,.98), rgba(5,58,53,.98) 58%, rgba(20,72,72,.98));
  box-shadow: 0 10px 28px rgba(0,34,31,.27);
}

.editor-fixed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(196,160,72,.8), rgba(45,163,139,.72), transparent);
}

.editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.editor-eyebrow {
  margin: 0 0 4px;
  color: #cdb66f;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.editor-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 6vw, 2.4rem);
  color: #edf9f4;
}

.editor-icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(15,112,101,.18);
  border-radius: 50%;
  color: #0b4b43;
  font-weight: 900;
  background: linear-gradient(145deg, #effbf6, #bedfd4);
  cursor: pointer;
}

.editor-progress {
  margin: 0;
  color: #d9f2e9;
  font-size: .86rem;
  font-weight: 850;
}

.editor-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.editor-archive-view {
  flex: 0 0 auto;
  border: 1px solid rgba(151,116,40,.25);
  border-radius: 999px;
  padding: 8px 12px;
  color: #6d5322;
  font-size: .76rem;
  font-weight: 850;
  background: linear-gradient(135deg, #fff9dc, #f1dfaa);
  cursor: pointer;
}

.editor-archive-view.is-active {
  color: #fff;
  background: linear-gradient(135deg, #278f7e, #07594f);
}

.editor-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--editor-ink);
  font-size: .82rem;
  font-weight: 850;
}

.editor-fixed .editor-label { color: #d8eee7; }

.editor-input,
.editor-textarea {
  width: 100%;
  border: 1px solid rgba(14,112,98,.23);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--editor-ink);
  font: inherit;
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 2px 7px rgba(8,80,70,.05);
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.editor-jump-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.editor-jump-row .editor-button { min-width: 105px; }

.editor-quick-actions {
  display: flex;
  gap: 7px;
}

.editor-scroll-hint {
  margin: 10px 0 0;
  color: rgba(217,241,232,.78);
  font-size: .73rem;
  font-weight: 760;
  text-align: center;
}

.editor-card-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 18px 24px;
  scroll-behavior: smooth;
  scroll-padding-block: 14px;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background:
    radial-gradient(circle at 12% 18%, rgba(215,190,119,.19) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 58%, rgba(100,191,174,.2) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(3,49,45,.9), rgba(8,73,65,.78));
  background-size: 54px 54px, 73px 73px;
  scrollbar-color: rgba(21,125,111,.48) transparent;
  scrollbar-width: thin;
}

.editor-card-list:focus { outline: none; }

.editor-card-page {
  position: relative;
  min-height: calc(100% - 6px);
  display: flex;
  flex-direction: column;
  margin: 0 0 14px;
  padding: 17px;
  border: 2px solid rgba(194,220,206,.32);
  border-radius: 22px;
  background:
    linear-gradient(118deg, rgba(218,240,230,.96), rgba(159,205,190,.95) 34%, rgba(225,219,179,.82) 55%, rgba(143,195,186,.95) 75%, rgba(219,238,231,.96));
  background-size: 190% 190%;
  box-shadow: 0 16px 40px rgba(0,35,31,.3), inset 0 1px 0 rgba(255,255,255,.7);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
  animation: pearl-sheen 9s ease-in-out infinite alternate;
}

.editor-card-page.is-current {
  border-color: rgba(219,195,124,.72);
  box-shadow: 0 20px 48px rgba(0,29,26,.42), 0 0 0 1px rgba(226,208,153,.34), inset 0 1px 0 rgba(255,255,255,.75);
}

.editor-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--editor-emerald-deep);
  font-size: .78rem;
  letter-spacing: .08em;
}

.editor-card-heading span {
  border-radius: 999px;
  padding: 5px 9px;
  color: #6a501d;
  font-size: .63rem;
  letter-spacing: .06em;
  background: linear-gradient(135deg, #fff8d8, #efdfa9);
}

.editor-text-label {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.editor-textarea {
  flex: 1 1 auto;
  min-height: 150px;
  resize: none;
  line-height: 1.5;
}
.editor-input:focus,
.editor-textarea:focus { outline: 3px solid rgba(35,160,139,.22); border-color: var(--editor-emerald); }

.editor-navigation,
.editor-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.editor-card-actions { margin-top: 13px; }

.editor-bottom-bar {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(207,184,115,.24);
  background: linear-gradient(120deg, rgba(7,69,62,.98), rgba(4,48,45,.98));
  box-shadow: 0 -9px 27px rgba(0,33,30,.25);
}

.editor-button {
  border: 1px solid rgba(12,105,93,.18);
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--editor-emerald-deep);
  font-size: .83rem;
  font-weight: 820;
  background: #fff;
  cursor: pointer;
}

.editor-button.primary { color: #fff; background: linear-gradient(135deg, #2f9f89, #087064); box-shadow: 0 7px 16px rgba(7,101,89,.2); }
.editor-button.secondary { color: #0a4a42; background: linear-gradient(145deg, #e8f7f1, #b9dcd1); }
.editor-button.archive { color: #6f5422; background: linear-gradient(135deg, #fff8dc, #efdda4); }
.editor-button.danger { color: #9e2946; background: #fff0f2; }
.editor-button:disabled { opacity: .42; cursor: not-allowed; }
.editor-button:focus-visible,
.editor-icon-button:focus-visible { outline: 3px solid #ffd66e; outline-offset: 3px; }

.editor-status {
  min-height: 18px;
  flex: 1 1 100%;
  margin: 0;
  color: #d8eee7;
  font-size: .82rem;
  font-weight: 750;
  text-align: center;
}

.editor-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

@keyframes editor-magic {
  from { opacity: .5; transform: translateY(1px) scale(.92) rotate(-5deg); }
  to { opacity: 1; transform: translateY(-2px) scale(1.12) rotate(5deg); filter: drop-shadow(0 0 7px rgba(211,180,95,.72)); }
}

@keyframes pearl-sheen {
  from { background-position: 0% 45%; }
  to { background-position: 100% 55%; }
}

@keyframes twinkle { to { opacity: .38; transform: scale(.78); } }
@keyframes floaty { to { translate: 0 -16px; rotate: 8deg; } }
@keyframes reel-bounce { 50% { transform: translateY(-7px) scale(.96); filter: blur(1px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); opacity: .2; } }
@keyframes jackpot-pulse { to { transform: scale(1.12); filter: brightness(1.2); } }
@keyframes jackpot-pop { from { opacity: 0; transform: scale(.2) rotate(-18deg); } }
@keyframes jackpot-title { from { opacity: 0; transform: scale(.35) translateY(30px); } }
@keyframes mega-background { to { filter: saturate(1.28) brightness(1.14); } }
@keyframes mega-rays { to { transform: rotate(360deg); } }
@keyframes mega-emoji {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.1); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--turn)) scale(1.25); }
}
@keyframes welcome-heart { to { transform: scale(1.1) rotate(3deg); } }

@media (max-width: 460px) {
  .page-shell { padding-top: 28px; }
  .machine { padding: 32px 16px 20px; border-radius: 25px; }
  .machine-sticker { width: 41px; height: 41px; font-size: 1.25rem; }
  .sticker-left { left: -14px; }
  .sticker-right { right: -14px; }
  .advice-card { padding: 24px 20px 18px; }
  .card-actions { flex-direction: column; align-items: flex-start; gap: 2px; }
  .editor-panel { padding: 0; }
  .editor-window { width: 100%; height: 100dvh; max-height: 100vh; border: 0; border-radius: 0; }
  .editor-fixed { padding: 14px 14px 9px; }
  .editor-header h2 { font-size: 1.45rem; }
  .editor-state-row { margin-top: 8px; }
  .editor-toolbar { grid-template-columns: 1fr; gap: 7px; }
  .editor-quick-actions .editor-button { flex: 1; }
  .editor-card-list { padding: 10px 12px 20px; }
  .editor-card-page { min-height: calc(100% - 4px); padding: 14px; border-radius: 18px; }
  .editor-textarea { min-height: 130px; }
  .editor-navigation .editor-button { flex: 1; }
  .editor-card-actions .editor-button { flex: 1 1 30%; padding-inline: 8px; }
  .editor-jump-row { grid-template-columns: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Lock screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  overflow: hidden auto;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.75), transparent 14rem),
    radial-gradient(circle at 85% 85%, rgba(255,214,236,.9), transparent 16rem),
    linear-gradient(160deg, #ffe3f0, #ffc6de 48%, #f7b6e0 75%, #e6c4ff);
  transition: opacity .6s ease, transform .6s ease, visibility .6s ease;
}

.is-unlocked .lock-screen { display: none; }
html:not(.is-unlocked) body { overflow: hidden; }
.lock-screen.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(1.06); }

.lock-hearts { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.lock-hearts span {
  position: absolute;
  bottom: -3rem;
  font-size: 1.6rem;
  opacity: .75;
  animation: lock-float 11s linear infinite;
}
.lock-hearts span:nth-child(1) { left: 6%; animation-delay: 0s; }
.lock-hearts span:nth-child(2) { left: 18%; animation-delay: 3s; font-size: 1.2rem; }
.lock-hearts span:nth-child(3) { left: 32%; animation-delay: 6s; }
.lock-hearts span:nth-child(4) { left: 47%; animation-delay: 1.5s; font-size: 1.1rem; }
.lock-hearts span:nth-child(5) { left: 61%; animation-delay: 4.5s; }
.lock-hearts span:nth-child(6) { left: 74%; animation-delay: 7.5s; font-size: 1.3rem; }
.lock-hearts span:nth-child(7) { left: 86%; animation-delay: 2.2s; }
.lock-hearts span:nth-child(8) { left: 94%; animation-delay: 9s; font-size: 1.15rem; }

.lock-card {
  position: relative;
  width: min(100%, 360px);
  padding: 38px 24px 26px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 34px;
  text-align: center;
  background: rgba(255,250,253,.72);
  box-shadow: 0 24px 60px rgba(187,62,119,.22), inset 0 0 0 6px rgba(255,213,229,.45);
  backdrop-filter: blur(14px);
  animation: card-in .6s cubic-bezier(.2,.9,.2,1);
}

.lock-card.is-wrong { animation: lock-shake .45s ease; }

.lock-badge {
  position: absolute;
  top: -34px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 3px solid #fff;
  border-radius: 50%;
  font-size: 2.1rem;
  background: linear-gradient(145deg, #ffd5e5, #ffb3d1);
  box-shadow: 0 10px 24px rgba(187,62,119,.25);
  transform: translateX(-50%);
  animation: welcome-heart 1.2s ease-in-out infinite alternate;
}

.lock-kicker {
  margin: 4px 0 0;
  color: var(--rose);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .26em;
}

.lock-card h2 {
  margin: 6px 0 18px;
  color: var(--berry-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 6.5vw, 1.8rem);
  line-height: 1.15;
}

.lock-dots { display: flex; justify-content: center; gap: 16px; }
.lock-dots span {
  width: 17px;
  height: 17px;
  border: 2px solid var(--rose);
  border-radius: 50%;
  background: #fff;
  transition: background .18s ease, transform .18s ease;
}
.lock-dots span.is-filled { background: linear-gradient(145deg, #ff8fbc, #e2558f); transform: scale(1.15); }
.lock-card.is-wrong .lock-dots span { border-color: #d6455f; background: #ffd0d8; }
.lock-card.is-right .lock-dots span { border-color: #e2558f; background: #ff8fbc; animation: lock-pop .5s ease; }

.lock-message {
  min-height: 1.3em;
  margin: 14px 0 16px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.lock-keypad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  justify-content: center;
  gap: 12px 18px;
}

.lock-keypad button,
.lock-key-heart {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.lock-keypad button {
  border: 2px solid #fff;
  color: var(--berry-dark);
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(160deg, #fff, #ffe1ee);
  box-shadow: 0 6px 14px rgba(187,62,119,.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background .15s ease;
}

.lock-keypad button:active { transform: scale(.92); background: linear-gradient(160deg, #ffd5e5, #ffb3d1); }
.lock-keypad button:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }
.lock-key-heart { color: var(--rose); font-size: 1.5rem; }

@keyframes lock-float {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  10% { opacity: .8; }
  100% { transform: translateY(-115vh) rotate(25deg); opacity: 0; }
}
@keyframes lock-shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}
@keyframes lock-pop { 50% { transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) {
  .lock-hearts span, .lock-badge { animation: none; }
}

.speech-hint {
  margin: -10px 0 14px;
  padding: 9px 12px;
  border-radius: 14px;
  color: var(--berry-dark);
  font-size: .8rem;
  line-height: 1.4;
  background: rgba(255,213,229,.55);
}
.speech-hint[hidden] { display: none; }
