:root {
  color-scheme: light;
  --ink: #24211e;
  --muted: #655953;
  --gold: #80614c;
  --line: #75584229;
  --cream: #fdf9f3;
  --card: #fffaf3ef;
  --shadow: 0 26px 74px #5540311a, 0 4px 16px #6150440d;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --theme-time: 1.2s;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.65;
  background: var(--cream);
}
:root[data-theme="dusk"] {
  --cream: #f8eff3;
  --card: #fff8f8ef;
  --line: #74566b34;
  --shadow: 0 26px 74px #3d294b27, 0 4px 16px #55415816;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; isolation: isolate; }
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
body::before {
  background:
    radial-gradient(ellipse at 5% 21%, #fffefa99, transparent 26%),
    radial-gradient(ellipse at 83% 35%, #fffefa90, transparent 31%),
    radial-gradient(ellipse at 0% 99%, #e8cdd266, transparent 28%),
    radial-gradient(ellipse at 99% 99%, #e5d8f377, transparent 29%),
    linear-gradient(180deg, #cfe6fa, #eef5fc 47%, #fdf9f3 85%);
}
body::after {
  background:
    radial-gradient(ellipse at 88% 8%, #f4d9dc65, transparent 34%),
    radial-gradient(ellipse at 10% 48%, #c7bce6a0, transparent 40%),
    linear-gradient(180deg, #7e8ac4, #c1acd4 44%, #efd4df 76%, #f9f0f3);
  opacity: 0;
  transition: opacity var(--theme-time) ease;
}
[data-theme="dusk"] body::after { opacity: 1; }
h1, h2, p, figure { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 700; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid #855548; outline-offset: 4px; }
.shell { width: min(100% - 36px, 1000px); margin: auto; padding-block: 26px 34px; }
.masthead {
  position: sticky;
  top: 12px;
  z-index: 5;
  padding-top: 16px;
  margin-bottom: 10px;
}
.nav-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(100% - 36px, 1120px);
  min-height: 62px;
  margin-inline: auto;
  padding: 7px 9px 7px 14px;
  border: 1px solid #fff9;
  border-radius: 999px;
  background: #fffdf5b8;
  box-shadow: 0 8px 36px #4f403716, inset 0 0 0 1px #fff4;
  backdrop-filter: blur(18px) saturate(1.15);
}
.brand, .nav-actions { display: inline-flex; align-items: center; gap: 9px; }
.brand { font: 700 1rem/1.15 var(--serif); white-space: nowrap; }
.brand img { border-radius: 10px; flex: none; }
.home-link { border-radius: 999px; padding: 9px 13px; color: var(--muted); font-size: .83rem; white-space: nowrap; }
.home-link:hover { background: #fff9; color: var(--ink); }
.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffaf2;
  color: var(--gold);
}
.icon-button:hover { background: #f8e9e1; }
.theme-toggle svg { position: absolute; width: 20px; height: 20px; transition: opacity .3s, transform .6s cubic-bezier(.22,.75,.21,1); }
.theme-toggle .moon, [data-theme="dusk"] .theme-toggle .sun { opacity: 0; transform: rotate(-55deg) scale(.7); }
[data-theme="dusk"] .theme-toggle .moon { opacity: 1; transform: none; }

.ticket, .paper {
  border: 1px solid #fff;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  transition: background-color var(--theme-time), box-shadow var(--theme-time);
}
.ticket { position: relative; }
.ticket-body { display: grid; grid-template-columns: 41% minmax(0, 1fr); }
.scene { min-width: 0; padding: 24px 22px 20px 24px; align-self: center; }
.scene-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.065;
  border: 1px solid #faf5ee;
  border-radius: 18px;
  background: linear-gradient(145deg, #ded5e9, #b5b7d2 55%, #9a808e);
  box-shadow: 0 12px 24px #3d2d3c22, 0 0 0 1px var(--line);
}
.scene-image img, .intro-frame img { width: 100%; height: 100%; object-fit: cover; }
.scene-image img { position: absolute; inset: 0; }
.scene-image img.cover-revealed { animation: cover-in .37s cubic-bezier(.22,1.28,.36,1) both; }
@keyframes cover-in { from { opacity: 0; transform: scale(1.04) translateY(4px); } to { opacity: 1; transform: none; } }
.scene-caption { display: grid; padding-top: 15px; text-align: center; }
.scene-name { font: 700 clamp(1.02rem, 2.05vw, 1.33rem)/1.42 var(--serif); letter-spacing: .08em; }
.scene-subtitle { display: block; color: var(--gold); font: italic 1rem/1.5 Georgia, serif; letter-spacing: .025em; }

.ticket-main {
  min-width: 0;
  padding: 36px clamp(24px, 4vw, 56px) 31px;
  border-inline-start: 1px dashed #a8897560;
}
.work-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  border: 1px solid #ad897338;
  border-radius: 999px;
  background: #efe4dd8f;
}
.work-tabs button {
  min-height: 36px;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: none;
  font-size: .77rem;
  text-wrap: balance;
}
.work-tabs button:hover { color: var(--ink); }
.work-tabs [aria-pressed="true"] {
  color: var(--ink);
  background: #fffcf5;
  border-color: #fff;
  box-shadow: 0 2px 6px #55403114;
}
.ticket-intro { margin-top: 23px; }
h1 { font-size: clamp(2.15rem, 3.4vw, 3rem); line-height: 1.23; letter-spacing: -.025em; text-wrap: balance; }
.ticket-intro p { margin-top: 10px; max-width: 30em; color: var(--muted); font-size: .92rem; text-wrap: pretty; }
.unlock-form { margin-top: 23px; }
.unlock-form label { display: block; padding-inline-start: 5px; margin-bottom: 6px; font-size: .81rem; font-weight: 700; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.unlock-form input {
  min-height: 49px;
  min-width: 0;
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #9b795b59;
  border-radius: 999px;
  background: #fffdf8b8;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: .02em;
}
.unlock-form input::placeholder { color: #786a60; font-size: clamp(.75rem, 1.3vw, .88rem); opacity: 1; }
.unlock-form input[aria-invalid="true"] { border-color: #a23e46; }
.field-error { margin: 7px 3px 0; color: #982f3c; font-size: .83rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}
.primary { background: #24211e; color: #fffaf3; }
.primary:hover { background: #42352d; }
.primary:disabled { cursor: wait; opacity: .68; }
.secondary { background: #fffdf6; color: var(--ink); border-color: var(--line); }
.secondary:hover { background: #f6ebe2; }
.usage { margin-top: 23px; }
.usage h2 { margin-bottom: 7px; font: 650 .8rem/1.45 var(--sans); color: var(--gold); }
.usage ol { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.usage li {
  display: grid;
  align-items: center;
  padding: 8px 8px;
  border-radius: 13px;
  background: #e9def0;
  color: #514451;
  font-size: .73rem;
  line-height: 1.42;
  text-align: center;
  text-wrap: pretty;
}
.usage li:nth-child(2) { background: #e0edf4; color: #405362; }
.usage li:nth-child(3) { background: #f5e6dd; color: #614b3f; }
.usage code { font-family: Consolas, monospace; }
.ticket-bottom { padding: 10px 18px; border-top: 1px dashed #a8897560; text-align: center; }
.ticket-bottom::before, .ticket-bottom::after {
  content: "";
  position: absolute;
  bottom: 44px;
  width: 15px;
  height: 29px;
  border: 1px solid var(--line);
  background: var(--cream);
}
.ticket-bottom::before { left: -1px; border-radius: 0 100% 100% 0 / 0 50% 50% 0; border-left: 0; }
.ticket-bottom::after { right: -1px; border-radius: 100% 0 0 100% / 50% 0 0 50%; border-right: 0; }
.share-button, .quiet-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: .82rem;
}
.share-button:hover, .quiet-button:hover { background: #f0e3d8; color: var(--ink); }
.qr-icon { width: 13px; height: 13px; border: 1px solid currentColor; border-radius: 3px; position: relative; }
.qr-icon::after { content: ""; position: absolute; inset: 2px auto auto 2px; width: 3px; height: 3px; background: currentColor; box-shadow: 4px 0 currentColor, 0 4px currentColor, 5px 5px currentColor; }
.site-footer { width: min(100% - 36px, 1000px); margin-inline: auto; padding-bottom: 15px; color: var(--muted); text-align: center; font-size: .74rem; }

.intro {
  position: fixed;
  z-index: 12;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 850px;
  background: radial-gradient(ellipse, #fff9 0%, transparent 62%);
}
.intro-object {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 13px;
  width: min(69vw, 335px);
  text-align: center;
  transform-style: preserve-3d;
  animation: scene-flight 1.4s both;
}
.intro-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1.065;
  padding: 7px;
  border: 1px solid #fff;
  border-radius: 22px;
  background: linear-gradient(145deg, #fffdf4ee, #e8d6f286 55%, #f3d8abdf);
  box-shadow: 0 0 0 3px #fdf7eb70, 0 0 0 7px #f8eac750, 0 28px 55px #56405b56, inset 0 0 22px #fff;
  transform-style: preserve-3d;
}
.intro-frame img { border-radius: 15px; }
.intro-sheen { position: absolute; overflow: hidden; inset: 0; border-radius: inherit; pointer-events: none; }
.intro-sheen::after {
  content: "";
  position: absolute;
  inset: -30% 25%;
  background: linear-gradient(100deg, transparent, #ffecbe55, #ffffe8b8, transparent 72%);
  transform: translateX(-160%);
  animation: gilded-light 1s .12s ease-out both;
}
.intro-object::before, .intro-object::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffeb;
  box-shadow: 0 0 14px 4px #f9dda5da, 39px 41px 1px #fffbddbd, -22px 57px 3px #fffbddb0;
  animation: glints .9s .25s ease-in-out both;
}
.intro-object::before { inset: 15% auto auto -7%; }
.intro-object::after { inset: 6% -3% auto auto; }
.intro-object figcaption { display: grid; color: var(--ink); text-shadow: 0 1px 12px #fff8; transform: translateZ(35px); }
.skip-intro { position: absolute; right: 16px; bottom: 15px; background: #fffcf2d9; }
.ticket.is-entering { animation: ticket-arrives .4s 1.15s cubic-bezier(.21,.72,.32,1) both; }
@keyframes scene-flight {
  0% { opacity: 0; transform: translateY(74px) scale(.66) rotateX(33deg) rotateY(-13deg); animation-timing-function: cubic-bezier(.22,1.28,.36,1); }
  14% { opacity: 1; }
  32.14% { opacity: 1; transform: translateY(0) scale(1) rotateX(-4deg) rotateY(-7deg); animation-timing-function: ease-in-out; }
  53% { opacity: 1; transform: translateY(-7px) scale(1.015) rotateX(3deg) rotateY(6deg); animation-timing-function: ease-in-out; }
  67.86% { opacity: 1; transform: translateY(-2px) scale(1) rotateX(-2deg) rotateY(-2deg); animation-timing-function: cubic-bezier(.55,.06,.68,.19); }
  100% { opacity: 0; transform: translateY(52px) scale(.92) rotateX(11deg) rotateY(2deg); }
}
@keyframes gilded-light { to { transform: translateX(160%); } }
@keyframes glints { 0%, 100% { opacity: 0; transform: translateY(9px) scale(.6); } 48% { opacity: 1; transform: translateY(-6px) scale(1); } }
@keyframes ticket-arrives { from { opacity: 0; transform: translateY(13px) scale(.988); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }

.delivery { width: min(100%, 900px); margin-inline: auto; animation: ticket-arrives .42s ease both; }
.delivery-hero { display: grid; grid-template-columns: clamp(150px, 25vw, 232px) minmax(0, 1fr); gap: clamp(18px, 4vw, 36px); align-items: center; padding: 13px 5px 24px; }
.cover-banner { position: relative; padding: 5px; border: 1px solid #fff; border-radius: 19px; background: var(--card); box-shadow: var(--shadow); }
.cover-banner img { width: 100%; height: auto; border-radius: 14px; }
.cover-banner span { position: absolute; inset: auto 12px 11px auto; padding: 3px 8px; border-radius: 999px; background: #24211eac; color: #fffaf2; font-size: .7rem; }
.delivery-heading h1 { margin: 5px 0 10px; font-size: clamp(1.75rem, 4.4vw, 3.05rem); }
.delivery-heading .share-button { margin-inline-start: -7px; }
.paper { background: #fff9ef; padding: clamp(15px, 3.5vw, 31px); }
.paper + .paper { margin-top: 17px; }
.paper-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.paper h2 { font-size: 1.38rem; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.reader { isolation: isolate; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fffdf7; }
.reader pre { position: relative; min-height: 100px; margin: 0; padding: clamp(14px, 3vw, 25px); font: .92rem/1.85 Consolas, var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.reader pre:focus-visible { outline-offset: -3px; }
.watermark { position: absolute; inset: 0; display: grid; align-content: space-around; justify-items: center; gap: 28px; padding-block: 24px; color: #88594b; opacity: .16; font-size: clamp(.7rem, 2vw, .98rem); font-weight: 700; pointer-events: none; user-select: none; }
.watermark span { width: max-content; transform: rotate(-16deg); }
.tuning h2 { margin-bottom: 12px; }
.tuning table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #fffdf6; font-size: .87rem; text-align: left; }
.tuning th, .tuning td { padding: 10px; vertical-align: top; overflow-wrap: anywhere; }
.tuning thead th { background: #f4e9ee; color: #534251; }
.tuning tbody th { min-width: 6.5em; text-align: left; }
.tuning tbody tr:nth-child(even) { background: #f7f1eb; }
.tuning tbody :is(th,td) { border-top: 1px solid #75584216; }
.tuning code { padding: 1px 4px; border-radius: 3px; background: #ede5ed; }
.celebration { position: fixed; inset: 0; z-index: 9; overflow: hidden; pointer-events: none; }
.celebration i { --x: -180px; --y: -75px; position: absolute; top: 35%; left: 50%; width: 7px; height: 10px; border-radius: 70% 30% 60% 40%; background: #e9b59c; opacity: 0; animation: petals .84s ease-out both; }
.celebration i:nth-child(2) { --x: 140px; --y: -85px; background: #d7b4db; }
.celebration i:nth-child(3) { --x: -120px; --y: -130px; background: #e6cc92; }
.celebration i:nth-child(4) { --x: 100px; --y: -145px; background: #c5d5ea; }
.celebration i:nth-child(5) { --x: 12px; --y: -177px; background: #ead5a1; }
.celebration i:nth-child(6) { --x: 175px; --y: -23px; background: #ead4e3; }
.celebration i:nth-child(7) { --x: -170px; --y: -28px; background: #b9cce9; }
.celebration i:nth-child(8) { --x: -31px; --y: -137px; background: #edc2b8; }
@keyframes petals { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: 1; } 58% { opacity: .92; transform: translate(var(--x), var(--y)) rotate(70deg); } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 45px)) rotate(135deg); } }

dialog { border: 1px solid #fff; border-radius: 24px; background: #fffaf4; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #34293963; backdrop-filter: blur(5px); }
.close-dialog { position: absolute; top: 11px; right: 11px; width: 37px; height: 37px; font-size: 1.35rem; }
.lightbox { max-width: calc(100vw - 20px); max-height: 92dvh; padding: 0; overflow: hidden; }
.lightbox img { width: auto; max-width: 100%; max-height: 91dvh; object-fit: contain; }
.qr-dialog { width: min(100% - 32px, 355px); padding: 29px 20px 20px; text-align: center; }
.qr-dialog h2 { padding-inline: 22px; font-size: 1.38rem; }
.qr-dialog p { margin-top: 6px; color: var(--muted); font-size: .86rem; }
.qr-dialog canvas { display: block; width: min(100%, 219px); height: auto; margin: 16px auto 6px; border: 1px solid var(--line); border-radius: 15px; background: #fff; image-rendering: pixelated; }
.toast { position: fixed; z-index: 15; inset: auto 12px max(15px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); margin-inline: auto; padding: 9px 16px; border-radius: 999px; background: var(--ink); color: #fffaf2; font-size: .85rem; text-align: center; }
.toast:empty { visibility: hidden; }

@media (max-width: 760px) {
  .masthead { top: 7px; padding-top: 11px; margin-bottom: 5px; }
  .nav-pill { min-height: 54px; padding: 5px 6px 5px 9px; }
  .brand { gap: 5px; font-size: .91rem; }
  .brand img { width: 25px; height: 25px; }
  .nav-actions { gap: 1px; }
  .home-link { padding: 6px 7px; font-size: .77rem; }
  .theme-toggle { width: 38px; height: 38px; }
  .shell { width: min(100% - 28px, 510px); padding-block: 17px 20px; }
  .ticket-body { grid-template-columns: minmax(0,1fr); }
  .scene { padding: 11px 11px 0; }
  .scene-image { height: clamp(132px, 43vw, 194px); aspect-ratio: auto; border-radius: 16px; }
  .scene-image img { object-position: center 57%; }
  .scene-caption { padding-top: 8px; }
  .scene-caption .scene-name { font-size: 1rem; }
  .scene-subtitle { font-size: .91rem; }
  .ticket-main { padding: 13px 14px 16px; border: 0; }
  .work-tabs { margin-inline: auto; }
  .work-tabs button { min-height: 34px; padding-inline: 8px; font-size: .7rem; }
  .ticket-intro { margin-top: 16px; text-align: center; }
  .ticket-intro h1 { font-size: clamp(1.78rem, 7.5vw, 2.15rem); }
  .ticket-intro p { margin: 7px auto 0; font-size: .82rem; }
  .unlock-form, .usage { margin-top: 14px; }
  .button { padding-inline: 13px; }
  .unlock-form input { min-height: 45px; padding-inline: 11px; }
  .usage li { font-size: .69rem; padding: 7px 4px; }
  .ticket-bottom { padding-block: 5px; }
  .ticket-bottom::before, .ticket-bottom::after { bottom: 36px; width: 11px; height: 25px; }
}
@media (max-width: 420px) {
  .delivery-hero { grid-template-columns: 100px minmax(0, 1fr); gap: 11px; }
  .delivery-heading h1 { font-size: 1.42rem; }
  .delivery-heading .share-button { font-size: .72rem; text-align: left; }
  .tuning th, .tuning td { padding: 7px 5px; font-size: .76rem; }
  .tuning tbody th { min-width: 4.3em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .intro, .celebration { display: none !important; }
}
