.jar-page {
  color-scheme: only light;
  margin: 0;
  background: #f8f4ed;
  color: #303c33;
  font: 1rem/1.5 "Nunito", system-ui, sans-serif;
}
.jar-page * { box-sizing: border-box; }
.jar-page [hidden] { display: none !important; }
.jar-page h1, .jar-page h2, .jar-home-feature h2 {
  margin: 0;
  font: 500 clamp(1.55rem, 4vw, 2.2rem)/1.15 "Playfair Display", Georgia, serif;
  overflow-wrap: anywhere;
}
.jar-page h1 { font-size: clamp(2.3rem, 6vw, 4rem); }
.jar-page a { color: inherit; }
.jar-page :focus-visible { outline: 2px solid #874a62; outline-offset: 3px; }
.jar-shell { width: min(100% - 32px, 1110px); margin: 35px auto 56px; }
.jar-intro { margin-bottom: 24px; }
.jar-intro p { margin: 8px 0 0; color: #565c53; }
.jar-collection { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 20px; }
.jar-tile, .jar-home-feature, .jar-editor-section, .jar-reveal {
  border: 1px solid #dcd2c5;
  border-radius: 12px;
  background: #fffbf4;
}
.jar-tile { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.jar-tile-body { display: flex; flex-direction: column; align-items: flex-start; padding: 18px; }
.jar-tile-body h2 { font-size: 1.55rem; }
.jar-tile-body p { margin: 10px 0 14px; }
.jar-tile-body a { margin-top: auto; }
.jar-art {
  --jar-ink: #7b344b;
  --jar-tint: #eed4da;
  position: relative;
  min-width: 0;
  width: 100%;
  min-height: 210px;
  aspect-ratio: 350 / 335;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 38% 28%, #fffbf1 5%, #fffbf100 72%),
    linear-gradient(155deg, var(--jar-tint), #e8d9cb);
}
.jar-art::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url("./jar-paper-grain.svg");
  opacity: .11;
  mix-blend-mode: multiply;
}
.jar-glass {
  position: absolute;
  left: 23%; right: 23%; top: 27%; bottom: 13%;
  border: 1px solid #718a828a;
  border-radius: 23% 23% 15% 15% / 18% 18% 12% 12%;
  background:
    linear-gradient(90deg, #5c726b50, #fff9 4%, #a2b8ad27 9%, transparent 24% 73%, #bed2c544 85%, #fff8 95%, #4d73634f),
    linear-gradient(173deg, #ecf4ec55, #fffbef12 70%, #8db2a14f);
  box-shadow: 0 19px 21px -17px #533d3cb8, 10px 24px 28px -23px #533d3cad,
    inset 0 -8px 0 -5px #faffebad, inset 0 -19px 25px -20px #274a41;
}
.jar-rim {
  position: absolute;
  z-index: 2;
  top: -4%;
  left: 9%; right: 9%; height: 11%;
  border-radius: 50%;
  border: 2px solid #869b8d9c;
  background: linear-gradient(180deg, #59665a51, #e5f1e375 62%, #fff9);
  box-shadow: 0 2px 0 #fff8, inset 0 2px 2px #fafff3ca;
  pointer-events: none;
}
.jar-glass::after {
  content: "";
  position: absolute;
  inset: 9% 5% 5%;
  z-index: 2;
  pointer-events: none;
  border-radius: 18% 20% 13% 14%;
  background: linear-gradient(96deg, #fff0 3%, #fff9 6%, #fffb 8%, #fff2 13%, transparent 19% 76%,
    #e9fff21c 80%, #fff9 89%, transparent 92%);
  border-bottom: 2px solid #fffff5bd;
  box-shadow: inset -3px -2px 5px #ccf8e049;
}
.jar-pieces { position: absolute; inset: 5% 4% 5%; overflow: hidden; border-radius: inherit; }
.jar-pieces svg {
  width: var(--heart-size);
  position: absolute;
  left: var(--heart-x);
  bottom: var(--heart-y);
  transform: rotate(var(--heart-turn));
  filter: drop-shadow(2px 4px 2px #47313d57);
}
.jar-open.jar-selectable .jar-pieces svg { cursor: pointer; }
.jar-open.jar-selectable .jar-pieces svg:hover,
.jar-pieces svg[data-selected] { filter: brightness(1.13) drop-shadow(0 0 6px #fff2d0); }
.jar-drop { animation: jar-drop 680ms cubic-bezier(.22,.7,.3,1) both; }
.jar-label {
  position: absolute; z-index: 3; left: 17%; right: 17%; top: 44%;
  display: grid; justify-items: center; gap: 3px;
  padding: 4% 5%; text-align: center; overflow-wrap: anywhere;
  color: var(--jar-ink); background: linear-gradient(110deg,#fffbf1,#f6ede2);
  border: 1px solid #af9289; border-radius: 5px;
  box-shadow: inset 0 0 0 3px #fff8, 1px 2px 4px #61493c33;
}
.jar-label strong {
  font: 500 clamp(.85rem, 2.2vw, 1.2rem)/1.13 "Playfair Display", Georgia, serif;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.jar-label span { font-size: .8rem; }
.jar-lid {
  position: absolute; z-index: 4; left: 24%; right: 24%; top: 20%; height: 10%;
  border-radius: 45% 45% 24% 24% / 22% 22% 19% 19%;
  border: 1px solid #89755a;
  background: radial-gradient(ellipse at 50% 8%, #e3caa3, transparent 60%),
    repeating-linear-gradient(105deg,#b2865940 0 1px,transparent 1px 4px),
    linear-gradient(#d9bd92,#bb946a 75%,#a98662);
  box-shadow: inset 0 2px 3px #fff9deba, inset 0 -4px 7px #6d4c344f, 0 5px 6px #583c354a;
  transform-origin: 75% 70%;
}
.jar-lid::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 30%;
  border-radius: 50%;
  border-bottom: 1px solid #8b664f80;
  background: radial-gradient(ellipse at 35% 30%, #eed7af, #c4a47e 72%);
}
.jar-open .jar-lid { transform: translate(32%, -96%) rotate(14deg); }
.jar-opening .jar-lid { animation: jar-lift 3.3s cubic-bezier(.23,.73,.29,1) both; }
.jar-opening .jar-pieces { animation: jar-settle 3.4s ease-out both; }
@keyframes jar-lift {
  0% { transform: none; }
  20% { transform: translateY(-17%) rotate(-3deg); }
  72%, 100% { transform: translate(32%,-96%) rotate(14deg); }
}
@keyframes jar-settle {
  0%, 20%, 100% { transform: none; }
  43% { transform: translateY(-4%) rotate(2deg); }
  68% { transform: translateY(1%) rotate(-1deg); }
}
@keyframes jar-drop {
  from { opacity: .2; transform: translateY(-145px) rotate(calc(var(--heart-turn) - 35deg)); }
  to { opacity: 1; transform: rotate(var(--heart-turn)); }
}
.jar-home-feature { margin-top: 30px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); align-items: center; overflow: hidden; }
.jar-home-feature .jar-art { aspect-ratio: 1.65; min-height: 230px; }
.jar-home-feature .jar-glass { left: 32%; right: 32%; }
.jar-home-feature .jar-lid { left: 33%; right: 33%; }
.jar-home-content { padding: clamp(18px, 4vw, 44px); }
.jar-home-content p { max-width: 39ch; margin-bottom: 18px; }
.jar-button, .jar-small, .jar-choice {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: 7px 13px; color: #354333; background: #fffaf2;
  border: 1px solid #b8ad9e; border-radius: 6px; font: 800 .94rem/1.2 "Nunito", system-ui, sans-serif;
  text-decoration: none; cursor: pointer;
}
.jar-button.primary { background: #304c3e; color: white; border-color: #304c3e; }
.jar-button:hover, .jar-small:hover { box-shadow: inset 0 0 0 1px currentColor; }
.jar-small { padding: 5px 8px; font-size: .85rem; }
.jar-small:disabled { opacity: .42; cursor: default; }
.jar-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 8px; }
.jar-studio-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.jar-live { position: sticky; top: 18px; overflow: hidden; border: 1px solid #dcd2c5; border-radius: 10px; background: #fffbf4; }
.jar-live p { margin: 12px; text-align: center; }
.jar-editor-section { padding: clamp(14px, 3vw, 24px); margin-bottom: 14px; }
.jar-editor-section h2 { margin-bottom: 12px; }
.jar-fields { display: grid; gap: 8px 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.jar-editor label { display: block; font-weight: 800; }
.jar-editor small { color: #565c53; font-weight: 400; }
.jar-editor input, .jar-editor textarea {
  display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 10px;
  border: 1px solid #aa9c89; border-radius: 5px; background: #fffdfa; color: #303c33; font: inherit;
}
.jar-editor textarea { resize: vertical; }
.jar-actions, .jar-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.jar-share-actions { margin-top: 10px; }
.jar-heart-list { overflow-wrap: anywhere; padding-inline-start: 23px; }
.jar-heart-list li { border-top: 1px solid #e6dbcf; margin-block: 12px; padding: 5px 0 0 3px; }
.jar-heart-list li p { white-space: pre-wrap; margin: 4px 0 9px; }
#heartCount, .jar-storage { color: #555b52; font-size: .9rem; }
#heartError { color: #943d56; }
#heartError:empty, #shareStatus:empty, .jar-storage:empty { margin: 0; }
.jar-recipient-header { max-width: 920px; width: calc(100% - 32px); margin: 8px auto; border-bottom: 1px solid #dcd2c5; }
.jar-recipient { max-width: 860px; }
.jar-recipient h1 { text-align: center; font-size: clamp(1.75rem,5vw,3rem); margin-bottom: 20px; }
.jar-reveal { display: grid; overflow: hidden; }
.jar-reveal-intro, .jar-reveal-controls { text-align: center; padding: 18px; min-width: 0; }
.jar-reveal-intro p, .jar-signature, .jar-note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.jar-dedication { font-weight: 800; color: var(--jar-ink); margin: 10px 0 0; }
.jar-greeting { margin: 9px 0 0; }
.jar-signature { font: italic 1.1rem "Playfair Display", Georgia, serif; margin: 16px 0 0; }
.jar-reveal .jar-art { width: min(100%, 425px); margin-inline: auto; border-radius: 10px; }
.jar-replay { margin-top: 12px; }
.jar-progress, .jar-complete { margin: 0 0 10px; }
.jar-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 6px; }
.jar-choice { position: relative; min-width: 44px; padding: 3px; background: #fffdf7; }
.jar-choice svg { width: 32px; height: 31px; }
.jar-choice span { position: absolute; font-weight: 800; font-size: .8rem; }
.jar-choice[data-seen="true"] { border-color: #735f68; background: #f4eee8; }
.jar-page dialog { width: min(100% - 20px, 760px); max-height: calc(100dvh - 20px); color: inherit; background: #f8f4ed; border: 1px solid #c6b6a3; border-radius: 10px; padding: 10px; }
.jar-page dialog::backdrop { background: #2c3c36aa; }
.jar-page .jar-note {
  width: min(100% - 28px, 28rem);
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}
.jar-page .jar-note::backdrop { background: #30242458; }
.jar-paper {
  position: relative;
  isolation: isolate;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  overscroll-behavior: contain;
  text-align: start;
  padding: clamp(18px, 5vw, 36px);
  color: #38312a;
  background: linear-gradient(178deg, #fff8ed, #fffdf6 37%, #fbf2e6);
  border: 1px solid #d4bbaa;
  border-radius: 4px 8px 6px 5px;
  box-shadow: 2px 18px 26px -8px #37232f65, inset 0 0 0 5px #fff6;
}
.jar-paper::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .18;
  background: url("./jar-paper-grain.svg");
  mix-blend-mode: multiply;
  pointer-events: none;
}
.jar-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(177deg, transparent 47%, #a46d5415 49.6%, #fff6 50%, transparent 53%);
  pointer-events: none;
}
.jar-in-flight .jar-paper { opacity: 0; pointer-events: none; }
.jar-flight { position: fixed; top: 0; left: 0; aspect-ratio: 1; z-index: 1; pointer-events: none; }
.jar-flight svg { width: 100%; height: auto; filter: drop-shadow(4px 6px 3px #44223864); }
.jar-full-motion .jar-flight::after {
  content: "✧";
  position: absolute;
  right: -3px;
  top: 2px;
  color: #fff2c8;
  font-size: 10px;
  text-shadow: 0 0 6px #ffe3a4;
  animation: jar-glint 630ms ease both;
}
@keyframes jar-glint { 0%, 22%, 100% { opacity: 0; } 56% { opacity: 1; } }
.jar-paper-mark { color: var(--jar-ink); font-size: .9rem; margin-block-end: 12px; }
.jar-note h3 { margin: 0; font: 500 1.45rem "Playfair Display", Georgia, serif; color: var(--jar-ink); }
.jar-note p { margin: 12px 0 24px; font-size: 1.07rem; line-height: 1.65; }
.jar-note .jar-actions { justify-content: flex-end; }
#previewGift { margin-top: 10px; }
.jar-noscript { text-align: center; }
@media (min-width: 900px) {
  .jar-collection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 720px) {
  .jar-reveal { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); align-items: center; }
  .jar-reveal-intro { grid-column: 1 / -1; }
  .jar-reveal .jar-art { margin-left: 12px; width: calc(100% - 12px); }
}
@media (max-width: 650px) {
  .jar-studio-layout, .jar-home-feature { grid-template-columns: minmax(0,1fr); }
  .jar-live { position: static; }
  .jar-live .jar-art { max-height: 280px; }
}
@media (max-width: 400px) {
  .jar-fields { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .jar-opening .jar-lid, .jar-opening .jar-pieces, .jar-drop, .jar-flight::after { animation: none; }
  .jar-replay { display: none; }
}

.jar-return { text-align: center; font-size: .875rem; margin: 20px 0 0; }
.jar-return a { display: inline-flex; align-items: center; gap: .35em; min-height: 44px; text-underline-offset: 5px; }
.jar-idea-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dcd2c5;
  border-radius: 8px;
  background: #f8f3eb;
}
.jar-idea-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jar-idea-heading h3 { margin: 0; font: 500 1.15rem "Playfair Display", Georgia, serif; }
.jar-idea-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.jar-idea-option {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #cdbfb0;
  border-radius: 6px;
  color: #303c33;
  background: #fffbf4;
  text-align: start;
  font: inherit;
  cursor: pointer;
}
.jar-idea-option:hover { border-color: #874a62; }
.jar-idea-confirm { margin: 8px 0; border-top: 1px solid #dcd2c5; padding-top: 8px; }
.jar-idea-confirm p { margin: 0 0 8px; }
.jar-idea-status { font-size: .9rem; }
.jar-idea-status:empty { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .jar-idea-option { transition: border-color 150ms ease; }
}
