:root {
  color-scheme: light;
  --ink: #2e3c59;
  --muted: #586581;
  --paper: #fbf8f0;
  --rule: #d8d4d4;
  --serif: Georgia, "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --body: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Courier New", "Microsoft YaHei", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--ink);
  font: 1rem/1.65 var(--body);
  background:
    radial-gradient(ellipse at 0 56%, #d6e4f088, transparent 27%),
    radial-gradient(ellipse at 100% 72%, #e8dfed99, transparent 27%),
    radial-gradient(ellipse at 64% 0, #f0e6ed9c, transparent 40%),
    radial-gradient(ellipse at 50% 58%, #fffdf8, transparent 66%),
    #faf7ee;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid #455899; outline-offset: 5px; }
button:enabled { cursor: pointer; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.site-frame {
  position: fixed;
  inset: 15px;
  z-index: 5;
  border: 1px solid #929cba82;
  border-radius: 27px 24px 28px 23px;
  box-shadow: 0 0 0 5px #fef9f398, inset 0 0 0 4px #fcf9f58f;
  pointer-events: none;
}
.site-frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid #a1a7bd50;
  border-radius: 21px;
}
.corner {
  position: absolute;
  width: 60px;
  height: 60px;
  background: radial-gradient(ellipse at 8% 10%, #aabbe13d, transparent 56%);
  --flip-x: 1;
  --flip-y: 1;
  transform: scale(var(--flip-x), var(--flip-y));
}
.corner::before, .corner::after {
  content: "";
  position: absolute;
  clip-path: polygon(50% 0, 60% 38%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 38%);
  background: #8191ba;
}
.corner::before { width: 19px; height: 19px; top: 6px; left: 7px; }
.corner::after { width: 9px; height: 9px; top: 25px; left: 26px; background: #c79863; }
.top-left { top: 0; left: 0; }
.top-right { top: 0; right: 0; --flip-x: -1; }
.bottom-left { bottom: 0; left: 0; --flip-y: -1; }
.bottom-right { bottom: 0; right: 0; --flip-x: -1; --flip-y: -1; }
.site-header {
  max-width: 1550px;
  margin: auto;
  padding: 32px clamp(2.25rem, 4.5vw, 4.75rem) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font: bold italic 1.7rem/1 var(--serif);
  letter-spacing: -.055em;
}
.brand-period { color: #8b739f; }
.brand-mark {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border: 1px solid #a5adc3;
  border-radius: 50% 47% 50% 45%;
  background: #e1e9f3;
  transform: rotate(-9deg);
}
.spark {
  display: inline-block;
  width: 1em;
  height: 1em;
  background: currentColor;
  clip-path: polygon(50% 0, 60% 38%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 38%);
}
.brand-mark .spark { width: 17px; height: 17px; color: #5f709b; }
.outline {
  appearance: none;
  border: 1px solid #a0a9be;
  border-radius: 999px;
  background: #fffdfa88;
  padding: 7px 17px;
  font-size: .875rem;
  transition: background-color .2s ease, border-color .2s ease;
}
.outline:hover { background-color: #e9edf6; border-color: #7484a5; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions button { white-space: nowrap; }
.new-journal { background: #e9e3f1; border-color: #a598b6; }
.new-journal:hover { background: #e0d6ed; border-color: #85769c; }
.new-journal:disabled { opacity: .64; }
.index-toggle { display: inline-flex; align-items: center; gap: 9px; }
.pages-icon {
  position: relative;
  width: 15px;
  height: 13px;
  border: 1px solid #657496;
  border-radius: 2px 3px 3px 2px;
  transform: rotate(-9deg);
}
.pages-icon::after {
  content: "";
  position: absolute;
  inset: 2px 2px 2px 5px;
  border-top: 1px solid #8793af;
  border-bottom: 1px solid #8793af;
}
.intro { text-align: center; padding: 44px 24px 0; }
.eyebrow { color: #586783; font-size: .875rem; letter-spacing: .29em; }
h1 {
  position: relative;
  display: inline-block;
  margin: 5px 0 0;
  color: #2a3958;
  font: 500 clamp(3.6rem, 7.35vw, 7.25rem)/1.02 var(--serif);
  letter-spacing: -.077em;
}
h1 em { font-weight: inherit; }
.heading-spark {
  position: absolute;
  right: -.55em;
  top: .04em;
  height: .34em;
  width: .34em;
  color: #cfa557;
  transform: rotate(12deg);
}
.intro > p { margin: 14px auto 0; color: var(--muted); font-size: 1rem; letter-spacing: .06em; }

.stack-home { padding: 27px 30px 0; }
.stack-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 250px));
  justify-content: center;
  gap: 32px 36px;
  width: min(100%, 1120px);
  margin: 0 auto;
}
.stack-card {
  display: grid;
  gap: 4px;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  min-width: 0;
}
.stack-card strong { margin-top: 9px; font: bold 1.25rem/1.35 var(--serif); overflow-wrap: anywhere; }
.stack-count { color: var(--muted); font-size: .875rem; }
.stack-art {
  position: relative;
  display: block;
  isolation: isolate;
  width: 76%;
  max-width: 228px;
  margin: 0 auto;
  aspect-ratio: 4 / 5;
}
.stack-art .card-mat, .stack-back { position: absolute; inset: 0; transition: transform .38s cubic-bezier(.2,.76,.25,1); }
.stack-art .card-mat { z-index: 2; --paper: #e7dfed; }
.stack-back {
  background: url("assets/ornate-frame.webp") center / 100% 100% no-repeat;
  filter: grayscale(.25) drop-shadow(0 6px 6px #45425d35);
  transform: translate(13%, 3%) rotate(11deg);
}
.stack-back:first-child {
  filter: grayscale(.28) hue-rotate(-24deg) drop-shadow(0 6px 6px #45425d44);
  transform: translate(-12%, 7%) rotate(-12deg);
}
.stack-card:hover .stack-art .card-mat { transform: translateY(-7px); }
.stack-card:hover .stack-back { transform: translate(15%, 4%) rotate(13deg); }
.stack-card:hover .stack-back:first-child { transform: translate(-14%, 7%) rotate(-14deg); }
.group-nav { display: flex; justify-content: center; margin-top: 12px; }
.group-nav a { color: var(--ink); text-decoration: none; }
.empty-group { text-align: center; margin: 22px auto; padding: 15px 24px 28px; }
.empty-group p { color: var(--muted); margin: 0 0 11px; }
.gallery { text-align: center; }
.stage {
  --card-w: clamp(175px, 18.2vw, 270px);
  --near: clamp(148px, 16.6vw, 253px);
  --far: clamp(284px, 31.1vw, 475px);
  position: relative;
  max-width: 1520px;
  height: clamp(300px, 30vw, 428px);
  margin: 3px auto 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
.stage-decoration, .deck { position: absolute; inset: 0; pointer-events: none; }
.orbit {
  position: absolute;
  left: 50%;
  top: 55%;
  width: min(92%, 1280px);
  height: 44%;
  transform: translate(-50%, -50%) rotate(-6deg);
  border: 1px dashed #909ebf63;
  border-radius: 50%;
}
.scenery { position: absolute; font-size: 16px; color: #8fa2cb; }
.s-one { top: 15%; left: 11%; transform: rotate(-12deg); font-size: 24px; }
.s-two { top: 18%; right: 11%; color: #c39c55; font-size: 27px; transform: rotate(13deg); }
.s-three { bottom: 12%; left: 17%; font-size: 12px; color: #c69cc0; }
.s-four { bottom: 20%; right: 14%; color: #a79dc6; }
.s-five { top: 5%; left: 42%; color: #b3a6c9; font-size: 11px; }
.paper-scrap {
  position: absolute;
  display: block;
  width: 105px;
  height: 28px;
  opacity: .65;
  clip-path: polygon(2% 9%, 16% 6%, 23% 13%, 39% 2%, 60% 8%, 77% 1%, 89% 10%, 99% 6%, 96% 32%, 100% 47%, 94% 69%, 98% 96%, 82% 95%, 73% 91%, 51% 100%, 34% 94%, 20% 98%, 12% 91%, 1% 97%, 4% 73%, 0 53%, 3% 35%);
}
.scrap-one { left: 5%; bottom: 22%; background: #d8e2d0; transform: rotate(-22deg); }
.scrap-two { right: 6%; bottom: 16%; background: #eaddea; transform: rotate(15deg); }

.postcard {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-w);
  display: flex;
  flex-direction: column;
  padding: 0;
  pointer-events: auto;
  --x: 0px;
  --y: 0px;
  --angle: 0deg;
  --scale: 1;
  transform: translate3d(calc(-50% + var(--x)), calc(-50% + var(--y)), 0) rotate(var(--angle)) scale(var(--scale));
  border: 0;
  border-radius: 11px;
  background: transparent;
  transition: transform .64s cubic-bezier(.2,.76,.25,1), opacity .38s ease, visibility .38s;
  will-change: transform;
}
.postcard[data-slot="-1"] { --x: calc(-1 * var(--near)); --y: 11px; --angle: -10deg; --scale: .82; z-index: 2; }
.postcard[data-slot="1"] { --x: var(--near); --y: 10px; --angle: 9deg; --scale: .82; z-index: 2; }
.postcard[data-slot="-2"] { --x: calc(-1 * var(--far)); --y: 38px; --angle: -15deg; --scale: .67; z-index: 1; }
.postcard[data-slot="2"] { --x: var(--far); --y: 37px; --angle: 15deg; --scale: .67; z-index: 1; }
.postcard[data-slot="-3"], .postcard[data-slot="3"] { --y: 90px; --scale: .55; opacity: 0; pointer-events: none; visibility: hidden; z-index: 0; }
.postcard[data-slot="-3"] { --x: calc(-1.22 * var(--far)); --angle: -17deg; }
.postcard[data-slot="3"] { --x: calc(1.22 * var(--far)); --angle: 17deg; }
.postcard[data-slot="0"] { --y: -7px; z-index: 3; }
.card-mat {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
}
.card-mat::after {
  position: absolute;
  inset: 0;
  content: "";
  background: url("assets/ornate-frame.webp") center / 100% 100% no-repeat;
  filter: brightness(var(--frame-lightness, 1)) drop-shadow(0 8px 7px #4c466b48);
  pointer-events: none;
  transition: filter .3s ease;
}
.postcard[data-slot="0"]:hover .card-mat::after {
  filter: brightness(var(--frame-lightness, 1)) drop-shadow(0 11px 9px #4c466b65);
}
.frame-wash {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: var(--frame-color);
  mask: url("assets/ornate-frame.webp") center / 100% 100% no-repeat;
  mix-blend-mode: color;
  opacity: .55;
  pointer-events: none;
}
.custom-frame .frame-wash { opacity: .98; }
.cutout {
  position: absolute;
  inset: 17.3% 17.8% 17.9%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 52% 51%, #fffaf2, transparent 80%),
    color-mix(in srgb, var(--paper), #fff 63%);
  box-shadow: inset 0 0 17px #554d633d;
}
.cutout img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; pointer-events: none; }
.card-label { display: flex; flex-direction: column; margin-top: 8px; line-height: 1.1; }
.card-title { font: bold .875rem/1.22 var(--serif); letter-spacing: .12em; }
.card-title, .card-place { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-place { margin-top: 3px; font: italic .8rem/1.18 var(--serif); color: #4b576e; }
.card-place:empty { display: none; }

.gallery-caption { padding: 1px 22px 0; }
.arrival { display: inline; color: #566481; font: .82rem var(--mono); letter-spacing: .14em; text-transform: uppercase; }

.gallery-caption h2 { margin: 2px 0 1px; font: bold clamp(1.65rem, 2.7vw, 2.4rem)/1.25 var(--serif); letter-spacing: .12em; }
.gallery-caption .controls { margin-top: 13px; }
.controls { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 24px); }
.turn { padding: 6px 13px; white-space: nowrap; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.dot { display: grid; width: 20px; height: 31px; place-items: center; padding: 0; border: 0; background: transparent; }
.dot::before { content: ""; width: 6px; height: 6px; background: #8b97b4; border-radius: 50%; transition: transform .25s, background-color .25s; }
.dot:hover::before { background: #415886; transform: scale(1.35); }
.dot[aria-pressed="true"]::before { background: #415886; width: 12px; height: 12px; border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 1550px;
  margin: 36px auto 0;
  padding: 0 clamp(2.25rem, 4.5vw, 4.75rem) 36px;
  color: #586581;
  font: .78rem/1.4 var(--mono);
  letter-spacing: .095em;
}

body:has(dialog[open]) { overflow: hidden; }
dialog { color: var(--ink); border: 0; background: transparent; padding: 0; max-width: calc(100% - 28px); max-height: calc(100% - 28px); }
dialog::backdrop { background: #2e3a60ad; backdrop-filter: blur(7px); }
.journal { width: min(1030px, calc((100dvh - 118px) * 1.58)); overflow: auto; }
.dialog-sheet { position: relative; }
.book-sheet {
  isolation: isolate;
  display: grid;
  align-content: center;
  aspect-ratio: 1.58;
  padding: 7.2% 7.5% 8.3%;
  background: url("assets/open-book-worn.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 19px 17px #1b243a77);
}
.book-sheet::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 45%;
  right: 45%;
  top: 8%;
  bottom: 10%;
  border-radius: 48% / 4%;
  background: linear-gradient(90deg, transparent, #675a7633 40%, #4d405033 49%, #5b4c6140 51%, #fff5d959 63%, transparent);
  pointer-events: none;
}
.journal.opening { animation: book-open .56s cubic-bezier(.2,.75,.25,1) both; transform-origin: center; }
@keyframes book-open {
  from { opacity: 0; transform: perspective(1000px) rotateY(-13deg) scale(.91) translateY(20px); }
  to { opacity: 1; transform: perspective(1000px) rotateY(0deg) scale(1) translateY(0); }
}
.close { position: absolute; z-index: 2; top: 10px; right: 12px; padding: 5px 14px; }
.journal-toolbar { display: flex; justify-content: flex-end; gap: 7px; padding: 4px 16px 0; }
.journal-toolbar button, .journal-controls button { background: #fefbf1; }
.journal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9%; align-items: center; }
.journal-figure { min-width: 0; margin: 0; text-align: center; }
.media-frame {
  --media-limit: min(33vw, 38dvh, 360px);
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 7px;
  background: color-mix(in srgb, var(--paper), #fffaf0 62%);
  border: 1px solid #8b7d892e;
  box-shadow: 1px 4px 10px #493b4930, inset 0 0 0 2px #fff7;
  vertical-align: top;
}
.media-frame:empty { width: min(90%, 300px); height: var(--media-limit); }
.media-frame::before {
  position: absolute;
  z-index: 1;
  content: "";
  width: 28%;
  height: 13px;
  top: -6px;
  left: 35%;
  border-radius: 1px;
  transform: rotate(-5deg);
  background: #d0a4beac;
  pointer-events: none;
}
.media-frame :is(img, video) {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--media-limit);
  object-fit: contain;
}
figcaption { position: relative; display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
figcaption .outline, .recording-actions .outline { padding: 4px 10px; }
.upload-control { position: relative; display: inline-block; cursor: pointer; background: #fffaf1; }
.upload-control:focus-within { outline: 2px solid #455899; outline-offset: 2px; }
.upload-control input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-control:has(input:disabled) { opacity: .58; }
.inline-status { margin: 4px 0 0; color: #544865; font-size: .8rem; line-height: 1.4; }
.inline-status:empty { display: none; }
#work-status { flex-basis: 100%; }
.journal-copy { min-width: 0; }
.journal-place { margin: 0 0 7px; color: #5c6682; font: .86rem/1.35 var(--mono); letter-spacing: .09em; }
.journal-copy h2, .index-sheet h2 { margin: 0 0 11px; font: bold clamp(1.5rem, 3.15vw, 2.6rem)/1.2 var(--serif); letter-spacing: .06em; }
.journal-body { line-height: 1.7; max-height: clamp(105px, 18vw, 220px); overflow: auto; scrollbar-width: thin; scrollbar-color: #a998a3 transparent; }
.journal-body p { margin: 0 0 9px; white-space: pre-line; overflow-wrap: anywhere; }
.recording { margin-top: 11px; padding-top: 10px; border-top: 1px dashed #a79baa; }
.recording-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.assigned-music { margin: 0 0 5px; color: #554865; font-size: .86rem; overflow-wrap: anywhere; }
.recording audio { display: block; width: 100%; height: 38px; margin-bottom: 7px; }
.journal-controls { display: flex; justify-content: center; gap: 8px; padding: 0 0 8px; }
.journal-controls .outline { padding: 5px 11px; }
.trip-index { width: min(620px, 100%); border-radius: 13px; box-shadow: 0 16px 50px #23294555; background: #faf6ed; }
.index-sheet { padding: 27px; }
.index-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.index-item { display: grid; justify-items: start; gap: 3px; padding: 6px 6px 8px; border: 1px solid #c6c4ce; border-radius: 6px; background: #fffaf4; text-align: left; }
.index-item:hover { background: #e6ecf5; }
.index-preview { display: block; width: 100%; aspect-ratio: 1; border: 1px solid #b9aabf; border-radius: 6px; background: color-mix(in srgb, var(--paper), #fff 42%); box-shadow: inset 0 0 0 4px #fff8; overflow: hidden; }
.index-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.index-item strong { padding-left: 3px; font-size: .94rem; }
.frame-editor { width: min(660px, 100%); border-radius: 15px; background: #fcf7ec; box-shadow: 0 18px 45px #25233a62; }
.frame-editor::backdrop { background: #30304b91; backdrop-filter: blur(4px); }
.frame-editor-sheet { padding: 22px 26px 27px; }
.frame-editor h2 { margin: 0 0 16px; font: bold clamp(1.6rem, 3.5vw, 2rem)/1.2 var(--serif); }
.frame-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 23px; align-items: center; }
.editor-preview { width: min(100%, 248px); margin: auto; }
.editor-preview .cutout { touch-action: none; cursor: grab; }
.editor-preview .cutout:active { cursor: grabbing; }
#crop-preview { display: block; width: 100%; height: 100%; }
.color-field { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.color-field input { width: 54px; height: 32px; border-radius: 5px; border: 1px solid #a999af; padding: 2px; background: #fff9f5; cursor: pointer; }
#crop-controls { min-width: 0; margin: 0; border: 1px solid #bfb0be; border-radius: 7px; padding: 8px 10px 11px; }
#crop-controls:disabled { opacity: .52; }
#crop-controls legend { padding: 0 4px; }
#crop-controls p { margin: 0 0 7px; color: var(--muted); font-size: .84rem; }
#crop-controls label { display: block; margin-top: 5px; font-size: .9rem; }
#crop-controls input { display: block; width: 100%; accent-color: #796c9d; }
#crop-time-label { float: right; color: var(--muted); }
.editor-actions { display: flex; justify-content: space-between; gap: 6px; margin-top: 13px; }
.editor-actions .outline { flex: 1 1 auto; padding: 5px 8px; }
.editor-actions .save-frame { background: #e5e0f1; border-color: #9888ae; }
.editor-actions .save-frame:disabled { opacity: .55; }
.journal-editor { width: min(654px, 100%); border-radius: 15px; background: #fcf7ec; box-shadow: 0 18px 45px #25233a62; }
.journal-editor-sheet { padding: 24px 27px 23px; }
.journal-editor h2 { margin: 0 0 16px; font: bold clamp(1.55rem, 3.5vw, 2rem)/1.2 var(--serif); }
#journal-form, #group-form { display: grid; gap: 12px; }
.journal-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#journal-form label { display: block; min-width: 0; }
#journal-form :is(input, textarea), #group-form input {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid #b9acbd;
  border-radius: 6px;
  background: #fffdf7;
  color: var(--ink);
  font: inherit;
}
#journal-form textarea { resize: vertical; min-height: 108px; }
#journal-form :is(input, textarea):focus-visible, #group-form input:focus-visible { outline: 2px solid #8274a2; outline-offset: 1px; }
#journal-form input[type="file"] { font-size: .875rem; }
#journal-form input::file-selector-button {
  margin-right: 7px;
  border: 1px solid #bbadc8;
  border-radius: 4px;
  padding: 3px 6px;
  color: var(--ink);
  background: #f1ebf8;
  cursor: pointer;
}
.optional-field { color: var(--muted); font-size: .82rem; }
.journal-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .84rem; color: var(--muted); }
.journal-editor-actions .save-entry { background: #e9e3f1; border-color: #a598b6; color: var(--ink); }
.save-entry:disabled { opacity: .6; }
.gallery-caption h2, .journal-copy h2, .index-item strong { overflow-wrap: anywhere; }

.music-library { width: min(780px, 100%); border-radius: 15px; background: #fcf7ec; box-shadow: 0 18px 45px #25233a62; }
.music-library-sheet { padding: 24px 27px; }
.music-library h2 { margin: 0 0 17px; font: bold clamp(1.55rem, 3.5vw, 2rem)/1.2 var(--serif); }
.music-library-grid { display: grid; grid-template-columns: minmax(165px, .8fr) minmax(0, 1.45fr); gap: 18px; }
.track-shelf { display: grid; align-content: start; gap: 8px; }
.track-import { justify-self: start; }
.track-list { display: grid; gap: 6px; max-height: 290px; overflow: auto; scrollbar-width: thin; }
.track-item { min-width: 0; padding: 8px 10px; border: 1px solid #c9bdd1; border-radius: 7px; background: #fffaf6; text-align: left; }
.track-item:hover, .track-item[aria-pressed="true"] { background: #eae2f2; border-color: #a296b6; }
.track-item :is(strong, span) { display: block; }
.track-item strong { overflow-wrap: anywhere; }
.track-item span { color: var(--muted); font-size: .82rem; }
.track-details { min-width: 0; }
#music-empty { margin: 4px 0; color: var(--muted); }
#music-form { display: grid; gap: 8px; }
#music-name {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #b9acbd;
  border-radius: 6px;
  background: #fffdf7;
  color: var(--ink);
  font: inherit;
}
#music-preview { width: 100%; height: 42px; }
.music-assignments { min-width: 0; margin: 0; padding: 6px 10px 10px; border: 1px solid #bfb0be; border-radius: 7px; }
.music-assignments legend { padding: 0 4px; }
.music-assignments p { margin: 0 0 7px; color: var(--muted); font-size: .84rem; }
.music-journals { max-height: min(37dvh, 250px); overflow: auto; scrollbar-width: thin; scrollbar-color: #b0a4bf transparent; }
.music-journals label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 4px;
  font-size: .88rem;
  cursor: pointer;
}
.music-journals label:hover { background: #efe8f5; }
.music-journals input { accent-color: #786998; }
.music-journals span { overflow-wrap: anywhere; }
.music-journals small { color: var(--muted); font-size: .75rem; text-align: right; }
.music-actions { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.music-actions > span { color: var(--muted); font-size: .84rem; }
.music-actions .save-entry, #music-picker-form .save-entry { background: #e9e3f1; border-color: #a598b6; }
.music-picker, .group-editor { width: min(460px, 100%); }
#music-picker-form { display: grid; gap: 11px; }
#music-picker-form .save-entry { justify-self: end; }

@media (max-width: 850px) {
  .intro { padding-top: 48px; }
  .stage { --near: clamp(125px, 20vw, 175px); --far: clamp(225px, 36vw, 315px); }
  .journal { width: min(760px, 100%); }
  .book-sheet { padding-top: 10%; }
  .media-frame { --media-limit: min(31vw, 32dvh, 280px); }
  .journal-body { font-size: .95rem; }
}
@media (max-width: 600px) {
  .site-frame { inset: 8px; border-radius: 18px; }
  .site-frame::before { inset: 3px; border-radius: 14px; }
  .corner { width: 35px; height: 35px; }
  .corner::before { width: 13px; height: 13px; }
  .corner::after { width: 6px; height: 6px; left: 20px; top: 19px; }
  .site-header { padding: 22px 27px 0; }
  .intro { padding: 47px 17px 0; }
  h1 { font-size: clamp(2.1rem, 8.35vw, 3.6rem); letter-spacing: -.066em; }
  .eyebrow { font-size: .8rem; }
  .intro > p { margin-top: 10px; font-size: .91rem; }
  .stage { --card-w: clamp(155px, 48vw, 215px); --near: clamp(121px, 38vw, 170px); --far: 85vw; height: clamp(253px, 75vw, 335px); margin-top: 5px; }
  .postcard[data-slot="-1"], .postcard[data-slot="1"] { --scale: .76; }
  .scenery { font-size: 13px; }
  .s-one { left: 9%; }
  .s-two { right: 9%; }
  .site-footer { padding: 0 24px 27px; margin-top: 27px; font-size: .71rem; }
  .pagination { max-width: 176px; }
  .dot { width: 18px; height: 25px; }
  .index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 480px) and (max-width: 700px) {
  .book-sheet { aspect-ratio: 1.30; padding: 10% 9% 11%; }

  .journal-grid { gap: 9%; }
  .media-frame { --media-limit: min(36vw, 255px); padding: 5px; }
  .journal-copy { padding-top: 9px; }
  .journal-place { margin-bottom: 3px; font-size: .74rem; }
  .journal-copy h2 { font-size: 1.5rem; margin-bottom: 6px; }
  .journal-body { line-height: 1.55; max-height: clamp(158px, 36vw, 218px); }
  .journal-copy:has(audio:not([hidden])) .journal-body { max-height: clamp(120px, 29vw, 172px); }
  .journal-body p { margin-bottom: 6px; }

  .journal-controls .outline { padding: 2px 8px; }
}
@media (max-width: 479px) {
  .journal { max-width: calc(100% - 22px); }
  .journal-toolbar { padding-right: 5px; }
  .book-sheet { aspect-ratio: 1.35; padding: 10% 10% 11%; }
  .journal-grid { gap: 9%; }
  .media-frame { --media-limit: clamp(75px, 28vw, 130px); padding: 4px; }
  .upload-control { padding: 3px 8px; }
  figcaption { margin-top: 5px; }
  .book-sheet:has(#journal-title:not(.visually-hidden)) {
    aspect-ratio: auto;
    display: block;
    padding: 20px;
    border: 4px double #8a86a7;
    border-radius: 10px 8px 12px 11px;
    background: linear-gradient(90deg, #e7dedb, #fffaf0 5%, #fcf6e9 94%, #dfd5d6);
  }
  .book-sheet:has(#journal-title:not(.visually-hidden))::before { display: none; }
  .journal-grid:has(#journal-title:not(.visually-hidden)) { display: block; }
  .journal-grid:has(#journal-title:not(.visually-hidden)) .media-frame { --media-limit: min(48dvh, 320px); }
  .journal-copy:has(#journal-title:not(.visually-hidden)) { padding-top: 16px; margin-top: 18px; border-top: 1px solid #b6afbd; }
  .journal-body { max-height: none; }
  .frame-editor-sheet { padding: 16px 17px 20px; }
  .frame-editor-grid { grid-template-columns: 1fr; gap: 12px; }
  .editor-preview { width: min(45vw, 155px); }
}
@media (max-width: 479px) {
  .site-header { padding-inline: 23px; gap: 5px; }
  .header-actions { gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .music-library-sheet { padding: 20px 16px; }
  .music-library-grid { grid-template-columns: 1fr; gap: 12px; }
  .track-list { max-height: 125px; }
  .music-journals small { display: none; }
  .header-actions .outline { padding: 6px 9px; }
  .stack-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 155px)); column-gap: 15px; }
  .stack-card strong { font-size: 1rem; }
  .header-actions .pages-icon { display: none; }
  .journal-editor-sheet { padding: 20px 17px; }
  .journal-attachments { grid-template-columns: 1fr; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
