:root {
  --ink: #171512;
  --muted: #746f66;
  --paper: #f4f0e8;
  --browser-overlay: #726f6b;
  --paper-deep: #e7e0d4;
  --white: #fffdf9;
  --coral: #ff624a;
  --yellow: #f3d64e;
  --violet: #9d82ff;
  --line: rgba(23, 21, 18, 0.14);
  --focus: #85817b;
  --shadow: 0 22px 60px rgba(39, 29, 17, 0.12);
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--paper); overscroll-behavior-y: none; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-width: 320px;
  overscroll-behavior-y: none;
  color: var(--ink);
  background:
    linear-gradient(to bottom, var(--paper) 0, var(--paper) var(--safe-area-top), transparent calc(var(--safe-area-top) + 160px)),
    radial-gradient(circle at 14% 0%, rgba(243, 214, 78, 0.28), transparent 28rem),
    var(--paper);
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Keep the notch edge the same paper color even after the page scrolls.
   Native dialog backdrops/panels remain above this non-interactive strip. */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-area-top);
  background: var(--paper);
  z-index: 20;
  pointer-events: none;
}

button, input, textarea { font: inherit; }
input::placeholder, textarea::placeholder { color: #a6a198; opacity: 1; }
button { color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: var(--safe-area-top) max(22px, var(--safe-area-right)) calc(120px + var(--safe-area-bottom)) max(22px, var(--safe-area-left));
}

body:not(.has-records) .app-shell { display: flex; flex-direction: column; padding-bottom: calc(32px + var(--safe-area-bottom)); }
body:not(.has-records) main { flex: 1; display: grid; align-items: center; }

.topbar {
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mypage-button { flex-shrink: 0; padding: 0; color: var(--ink); }
.mypage-symbol { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Kakao's official symbol and prescribed container/label colors. */
.kakao-login-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 12px; background: #fee500; color: rgba(0,0,0,.85); font-family: system-ui, -apple-system, sans-serif; font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.kakao-symbol { display: block; width: 15px; height: 14px; flex: none; fill: #000; }
.kakao-login-button[hidden], .kakao-symbol[hidden] { display: none; }
.kakao-login-button:disabled { cursor: wait; }

.brand {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-wordmark {
  display: block;
  width: 2.64em;
  height: 1.2em;
  overflow: visible;
  flex-shrink: 0;
  fill: currentColor;
}
.brand-wordmark .brand-initial { fill: currentColor; }

.brand-mark {
  width: 31px;
  height: 22px;
  position: relative;
  display: inline-block;
  border: 2px solid var(--coral);
  border-radius: 5px;
  transform: rotate(-4deg);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  top: 5px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--coral);
}
.brand-mark::before { left: -6px; }
.brand-mark::after { right: -6px; }
.brand-mark i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--coral); top: 8px; }
.brand-mark i:first-child { left: 8px; }
.brand-mark i:last-child { right: 8px; }

.round-button,
.close-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.round-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 800;
}

.intro {
  width: 100%;
  min-width: 0;
  padding: clamp(40px, 8vh, 80px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.eyebrow,
.step-label {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.intro h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(34px, 9.5vw, 68px);
  line-height: 1.18;
  letter-spacing: -0.065em;
  word-break: keep-all;
  font-weight: 950;
}

.intro h1 em {
  color: var(--coral);
  font-style: normal;
  position: relative;
  z-index: 1;
}

.intro h1 em::after {
  content: "";
  height: 12px;
  left: -3px;
  right: -5px;
  bottom: 3px;
  position: absolute;
  border-radius: 100%;
  background: var(--yellow);
  transform: rotate(-1deg);
  z-index: -1;
}

.intro-copy {
  max-width: 100%;
  margin: 24px 0 30px;
  color: var(--muted);
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.65;
  letter-spacing: -0.02em;
}

.primary-cta,
.generate-button {
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 0 #b9ae9f;
  cursor: pointer;
  font-weight: 850;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.primary-cta {
  padding: 15px 19px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  max-width: 100%;
}

.primary-cta span { font-size: 21px; line-height: 0; }
.primary-cta:active, .generate-button:active { transform: translateY(5px); box-shadow: 0 3px 0 #b9ae9f; }

.collection { padding-top: 34px; }
.records-status { margin: 22px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.5); font-size: 13px; line-height: 1.6; }
body.records-loading #emptyIntro { display: none; }

body:not(.has-records) #collectionHome,
body:not(.has-records) .floating-add { display: none; }

body.records-loading #collectionHome { display: block; }
body.records-loading main, body.records-loading .app-shell { display: block; }
body.records-loading .topbar { height: 64px; }
body.records-loading .collection { padding-top: 16px; }
body.records-loading #ticketResults,
body.records-loading #emptyState,
body.records-loading .collection-filters,
body.records-loading #ticketCount { display: none; }
body.records-loading .records-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.ticket-loading-list[hidden] { display: none; }
.ticket-loading-list .ticket { cursor: default; pointer-events: none; box-shadow: 0 10px 24px rgba(31, 25, 18, .08); }

body.has-records #emptyIntro { display: none; }
body.has-records .topbar { height: 64px; }
body.has-records .collection { padding-top: 16px; }
body.has-records .section-heading { align-items: center; margin-bottom: 16px; }
body.has-records .section-heading h2 {
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(30px, 8vw, 40px);
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.04em;
  text-shadow: 2px 2px 0 rgba(207, 139, 113, .38);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading h2 { margin: 0; font-size: 30px; letter-spacing: -0.055em; }
.section-heading .eyebrow { color: var(--coral); margin-bottom: 8px; }

.count-pill {
  flex-shrink: 0;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: rgba(255,255,255,0.48);
}

.year-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
}
.year-tabs::-webkit-scrollbar { display: none; }
.year-tab {
  flex: none;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.year-tab.active { background: var(--ink); color: white; border-color: var(--ink); }

.ticket-list { display: grid; gap: 18px; }
.ticket-more { display: block; min-height: 44px; margin: 24px auto 0; padding: 10px 20px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; }
.ticket-more[hidden] { display: none; }

.ticket {
  width: 100%;
  aspect-ratio: 2.18 / 1;
  min-height: 150px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28%;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  text-align: left;
  color: white;
  box-shadow: 0 15px 40px rgba(31, 25, 18, 0.19);
  cursor: pointer;
  position: relative;
  isolation: isolate;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
/* Compact collection cards; detail tickets and exported albums keep their shape. */
.ticket-list .ticket { aspect-ratio: 2.6 / 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
/* Full ticket placeholder, including its stub, perforation and edge notches. */
.ticket-skeleton { position: absolute; inset: -1px; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) 28%; border-radius: 0; overflow: hidden; pointer-events: none; background: #ebe5db; }
.ticket-skeleton::before, .ticket-skeleton::after { content: ""; position: absolute; z-index: 1; left: calc(72% - 7.5px); width: 15px; height: 15px; border-radius: 50%; background: var(--paper); }
.ticket-skeleton::before { top: -8px; }
.ticket-skeleton::after { bottom: -8px; }
.ticket-skeleton-main { display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding: 8%; background: linear-gradient(135deg, #eee9e0, #e2dbcf); }
.ticket-skeleton i { display: block; flex: 0 0 auto; border-radius: 5px; background: #cdc4b5; }
.ticket-skeleton-title { width: 72%; height: 12px; }
.ticket-skeleton-venue { width: 43%; height: 7px; opacity: .7; }
.ticket-skeleton-stub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-left: 1px dashed #b9af9f; background: #ddd4c5; padding: 12px 8px; }
.ticket-skeleton-label { width: 30%; height: 5px; }
.ticket-skeleton-date { width: 52%; height: 28px; }
.ticket-skeleton-stub .ticket-skeleton-barcode { width: 64%; max-width: 52px; height: 13px; margin-top: 3px; border-radius: 0; background: repeating-linear-gradient(90deg, #bdb2a1 0 2px, transparent 2px 4px); }
.ticket-skeleton-number { width: 35%; height: 5px; }
.ticket:has(.ticket-skeleton) .ticket-generation { z-index: 3; }
@media (hover: hover) and (pointer: fine) {
  .ticket:hover { transform: translateY(-3px) rotate(-0.25deg); box-shadow: 0 20px 48px rgba(31, 25, 18, 0.24); }
}

.ticket-main { position: relative; min-width: 0; overflow: hidden; background: #29221f; }
.ticket-art { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.02); }
.ticket-shine { position: absolute; inset: 0; background: linear-gradient(105deg, rgba(0,0,0,.62) 1%, rgba(0,0,0,.1) 62%, rgba(255,255,255,.12)); }
.ticket-copy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px 16px; text-shadow: 0 1px 12px rgba(0,0,0,.44); }
.ticket-title { display: block; font-size: clamp(18px, 5vw, 31px); line-height: 1; letter-spacing: -.055em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { margin-top: 7px; font-size: clamp(9px, 2.3vw, 12px); font-weight: 650; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket.is-generating .ticket-art { opacity: .78; }
.ticket-generation {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(23,21,18,.8);
  color: var(--white);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  text-shadow: none;
  pointer-events: none;
}
.ticket-generation[hidden] { display: none; }
.generation-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.generation-spinner { display: inline-block; flex: none; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; vertical-align: -1px; }
/* Both queued and generating records carry this class. */
.ticket.is-generating .generation-spinner { animation: generation-spin 1s linear infinite; }
@keyframes generation-spin { to { transform: rotate(360deg); } }
.ticket.has-generation-error .ticket-generation { background: rgba(255,246,239,.95); border-color: rgba(151,64,45,.2); color: #8c3b2c; }
.ticket.has-generation-error .generation-spinner { display: none; }

.ticket-stub {
  min-width: 0;
  position: relative;
  padding: 18px 10px 11px;
  border-left: 1px dashed rgba(255,255,255,.54);
  background: #ff604b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ticket-stub small { font-size: 8px; font-weight: 900; letter-spacing: .18em; opacity: .72; transform: translateY(-4px); }
.ticket-stub b { margin-top: 5px; font-size: clamp(13px, 4vw, 21px); line-height: 1.05; letter-spacing: -.04em; }
.ticket-stub .stub-date { position: relative; transform: translateY(-4px); }
.ticket-stub .stub-time { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-size: 10px; line-height: 1; font-weight: 700; letter-spacing: .02em; white-space: nowrap; opacity: .85; }
.ticket-stub .stub-date.is-countdown { display: flex; align-items: center; justify-content: center; min-height: 2.1em; max-width: 100%; white-space: nowrap; }
.ticket-stub .stub-date.is-countdown-long { font-size: clamp(10px, 2.8vw, 13px); min-height: 34px; }
.ticket-stub em { margin-top: 7px; font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .1em; opacity: .7; }
.stub-hole { position: absolute; left: -8px; width: 15px; height: 15px; border-radius: 50%; background: var(--paper); }
.stub-hole.top { top: -8px; }
.stub-hole.bottom { bottom: -8px; }
.barcode { width: 68%; max-width: 52px; height: 14px; margin-top: 18px; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px, currentColor 3px 5px, transparent 5px 7px); opacity: .9; }

.ticket.style-paper { color: #201b17; }
/* Keep the artwork's ink visible; reserve the cream wash for the black captions. */
.ticket.style-paper .ticket-shine { background: linear-gradient(180deg, rgba(250,243,225,.04) 0%, rgba(250,243,225,.08) 28%, rgba(250,243,225,.76) 64%, rgba(250,243,225,.94) 100%); }
.ticket.style-paper .ticket-copy { text-shadow: none; }
.ticket.style-paper .ticket-stub { background: #efd36a; }
.ticket.style-paper .stub-hole { background: var(--paper); }
.ticket.style-pop .ticket-stub { color: #171512; background: #c5ff56; }
.ticket.style-pop .ticket-shine { background: linear-gradient(110deg, rgba(80,20,120,.6), transparent 70%); }
.ticket.style-plain .ticket-art { transform: none; }
.ticket.style-plain .ticket-shine { background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.08) 50%, rgba(0,0,0,.68)); }
.ticket.style-plain .ticket-stub { color: var(--ink); background: #e7e0d4; }

.floating-add {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(22px + var(--safe-area-bottom));
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 14px 21px 14px 15px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 12px 28px rgba(23,21,18,.32);
  cursor: pointer;
}
.floating-add span { width: 30px; height: 30px; border-radius: 50%; background: var(--coral); display: grid; place-items: center; font-size: 20px; }
.floating-add b { font-size: 14px; }

.empty-state { text-align: center; padding: 28px 12px 50px; }
.empty-ticket { width: 230px; aspect-ratio: 2.2/1; border: 2px dashed #b8afa2; border-radius: 15px; margin: 4px auto 24px; display: grid; place-items: center; transform: rotate(-3deg); color: #aaa194; font-size: 20px; line-height: 1; font-weight: 950; letter-spacing: -.04em; }
.empty-state h3 { margin: 0; font-size: 20px; }
.empty-state p { margin: 8px 0 15px; color: var(--muted); font-size: 14px; }
.text-button { border: 0; background: none; text-decoration: underline; text-underline-offset: 4px; font-weight: 800; cursor: pointer; }

dialog { border: 0; padding: 0; background: transparent; max-width: none; }
dialog::backdrop { background: rgba(20,18,16,.58); backdrop-filter: blur(7px); }

/* Scrolling stays inside each card/body, never on the animated dialog shell. */
.sheet { inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; margin: 0; overflow: clip; overscroll-behavior-y: none; }
.sheet[open] { display: grid; align-items: end; }
.sheet[open] .sheet-card { will-change: transform; }
.sheet[open].is-opening .sheet-card { animation: sheet-in 380ms cubic-bezier(.25,.7,.35,1) both; }
.sheet[open]::backdrop { animation: backdrop-in 300ms ease-out both; }
.sheet.is-closing::backdrop { animation: backdrop-out 240ms ease-in both; }
.sheet.is-closing .sheet-card { animation: sheet-out 240ms cubic-bezier(.4,0,1,1) both; pointer-events: none; }
.sheet-card {
  width: min(100%, 700px);
  min-width: 0;
  max-height: 94vh;
  max-height: calc(100dvh - var(--safe-area-top) - 12px);
  margin: auto auto 0;
  padding: 10px max(22px, var(--safe-area-right)) calc(28px + var(--safe-area-bottom)) max(22px, var(--safe-area-left));
  overflow-y: auto;
  overscroll-behavior-y: none;
  scroll-padding-block: 20px;
  border-radius: 26px 26px 0 0;
  background: var(--white);
  box-shadow: var(--shadow);
}
@keyframes sheet-in { from { transform: var(--sheet-open-start, translateY(100%)); } to { transform: translateY(0); } }
@keyframes sheet-out { from { transform: var(--sheet-close-start, translateY(0)); } to { transform: translateY(100%); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
/* Transitions.dev — Modal open / close. Applied to the home ticket results, not the folder sheet. */
:root {
  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-scale: 0.96;
  --modal-scale-close: 0.96;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.t-modal {
  transform-origin: center;
  transform: scale(var(--modal-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-open-dur) var(--modal-ease),
    opacity   var(--modal-open-dur) var(--modal-ease);
  will-change: transform, opacity;
}
.t-modal.is-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}
.t-modal.is-closing {
  transform: scale(var(--modal-scale-close));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-close-dur) var(--modal-ease),
    opacity   var(--modal-close-dur) var(--modal-ease);
}
@media (prefers-reduced-motion: reduce) {
  .t-modal { transition: none !important; }
}
.ticket-results.t-modal { --modal-open-dur: 140ms; --modal-close-dur: 70ms; transform-origin: center top; }
#addDialog[open] { align-items: end; }
/* Safari can pan the form above its layout viewport when the keyboard opens.
   Continue the sheet's white surface below its footer instead of showing tickets. */
#addDialog::backdrop {
  bottom: -100vh;
  bottom: -100lvh;
  background: linear-gradient(to bottom,
    rgba(20,18,16,.58) 0 var(--record-sheet-bottom, 100%),
    var(--white, #fffdf9) var(--record-sheet-bottom, 100%) 100%);
}
#addDialog .sheet-card {
  display: flex;
  flex-direction: column;
  width: min(100%, 600px);
  min-height: 0;
  margin: auto auto 0;
  max-height: calc(100dvh - max(64px, 10svh, var(--safe-area-top)));
  padding: 10px max(22px, var(--safe-area-right)) calc(22px + var(--safe-area-bottom)) max(22px, var(--safe-area-left));
  overflow: hidden;
  border-radius: 26px 26px 0 0;
}
#addDialog .sheet-card > .sheet-handle,
#addDialog .sheet-card > .sheet-header,
#addDialog .sheet-card > .generate-button { flex-shrink: 0; }
.record-form-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin-inline: -4px;
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: none;
  scroll-padding-block: 12px;
}
#addDialog .sheet-handle { display: block; margin: 2px auto 10px; }
#addDialog .sheet-header { margin-bottom: 14px; }
#addDialog .sheet-header h2 { font-size: 25px; }
#addDialog .step-label { font-size: 10px; }
#addDialog .form-grid { gap: 10px; }
#addDialog .field { gap: 5px; }
#addDialog .field input, #addDialog .field textarea { padding: 10px 8px; min-height: 44px; }
#addDialog .field input { height: 44px; }
#addDialog .field textarea { min-height: 48px; max-height: none; overflow: hidden; resize: none; line-height: 1.5; }
#addDialog .folder-form-button { min-height: 44px; margin-top: 8px; padding-block: 8px; }
#addDialog .style-picker { margin-top: 12px; }
#addDialog .style-picker legend { margin-bottom: 6px; }
#addDialog .style-swatch { height: 40px; }
#addDialog .style-option > b { margin-top: 5px; }
#addDialog .photo-drop { min-height: 68px; margin-top: 12px; padding: 10px; }
#addDialog .generate-button { min-height: 48px; margin-top: 12px; padding: 13px; }
.sheet-handle { width: 48px; height: 5px; margin: 2px auto 20px; border-radius: 999px; background: #d2ccc4; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.sheet-header h2 { margin: 0; font-size: 27px; letter-spacing: -.055em; }
.sheet-header.compact { margin-bottom: 8px; align-items: center; }
.detail-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.edit-record-button svg { width: 20px; height: 20px; }
.edit-record-button:disabled { opacity: .4; cursor: default; }
#recordForm .style-picker[hidden], #photoDrop[hidden] { display: none; }
.step-label { color: var(--coral); margin-bottom: 7px; }
.close-button { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 23px; line-height: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span, .style-picker legend { font-size: 12px; font-weight: 850; }
.field b { margin-left: 4px; color: var(--coral); font-size: 9px; }
.field small { margin-left: 4px; color: var(--muted); font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 12px;
  outline: 0;
  background: #f8f5ef;
  font-size: 16px;
  resize: vertical;
}
/* Keep Safari's native date/time controls inside their grid columns. */
.field input[type="date"], .field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-inline-size: 0;
  max-inline-size: 100%;
  color: var(--ink);
  text-align: left;
}
.field input[type="date"]::-webkit-date-and-time-value, .field input[type="time"]::-webkit-date-and-time-value { min-height: 1.5em; text-align: left; }
.field input[type="date"]::-webkit-datetime-edit, .field input[type="time"]::-webkit-datetime-edit { min-width: 0; padding: 0; }
.field textarea { overscroll-behavior-y: none; }
.field input:focus, .field textarea:focus { border-color: var(--focus); box-shadow: none; }

.style-picker { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.style-picker legend { margin-bottom: 9px; }
.style-options { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.style-option { --style-selection: #686158; position: relative; min-width: 0; border-radius: 10px; cursor: pointer; }
.style-option:has(input:checked) { color: var(--paper); background: var(--style-selection); box-shadow: 0 0 0 4px var(--style-selection); }
.style-option input { position: absolute; opacity: 0; pointer-events: none; }
.style-option > b { display: block; margin-top: 7px; font-size: 11px; text-align: center; }
.style-swatch { height: 55px; border: 2px solid transparent; border-radius: 10px; display: block; box-shadow: inset 0 0 0 1px rgba(23,21,18,.1); }
.style-option input:checked + .style-swatch { border-color: var(--style-selection); }
.style-option input:focus-visible + .style-swatch { outline: 1px solid var(--focus); outline-offset: 3px; }
.style-spotlight { background: radial-gradient(circle at 70% 20%, #ffbd69, transparent 19%), linear-gradient(135deg,#141213 30%,#e24a38); }
.style-paper { background: repeating-linear-gradient(-15deg, rgba(45,34,20,.05) 0 2px, transparent 2px 5px), #efd36a; }
.style-pop { background: radial-gradient(circle at 70% 20%,#c5ff56 0 13%,transparent 14%),linear-gradient(135deg,#753ce8,#ff4c93); }
.style-swatch.style-plain { display: grid; place-items: center; color: #716b62; background: #e7e0d4; }
.style-swatch.style-plain svg { width: 24px; height: 24px; }

.photo-drop {
  min-height: 82px;
  margin-top: 21px;
  padding: 12px;
  display: grid;
  grid-template-columns: 45px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px dashed #afa79c;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: #f8f5ef;
}
.photo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-drop:focus-within { outline: 1px solid var(--focus); outline-offset: 3px; }
.photo-icon { width: 45px; height: 45px; border-radius: 9px; background: var(--paper-deep); display: grid; place-items: center; color: #665f55; }
.photo-icon svg { display: block; width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.photo-copy { display: grid; gap: 2px; min-width: 0; }
.photo-copy b { font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-copy small { color: var(--muted); font-size: 11px; line-height: 14px; word-break: keep-all; }
.photo-copy [hidden] { display: none; }
.photo-action { padding: 7px 10px; border-radius: 8px; background: white; border: 1px solid var(--line); font-size: 11px; font-weight: 800; white-space: nowrap; }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .12; pointer-events: none; }

.prompt-options { margin-top: 12px; min-width: 0; }
.prompt-options summary { min-height: 44px; display: flex; align-items: center; gap: 7px; list-style: none; cursor: pointer; font-size: 12px; font-weight: 800; touch-action: manipulation; }
.prompt-options summary::-webkit-details-marker { display: none; }
.prompt-options summary small { color: var(--muted); font-size: 11px; font-weight: 500; }
.prompt-options summary::after { content: "+"; margin-left: auto; padding-inline: 6px; color: var(--muted); font-size: 20px; font-weight: 400; }
.prompt-options[open] summary::after { content: "−"; }
.prompt-options summary:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.prompt-help { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.prompt-help small { display: block; margin-top: 2px; font-size: 11px; }

.generate-button { width: 100%; margin-top: 20px; padding: 16px; font-size: 15px; }
.sparkle { margin-right: 7px; color: var(--yellow); }

.detail-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-bottom: calc(34px + var(--safe-area-bottom)); }
.detail-card > .sheet-handle, .detail-card > .sheet-header { flex-shrink: 0; }
#detailContent { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.detail-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: none; scroll-padding-block: 12px; }
.detail-ticket-wrap { margin: 10px 0 26px; }
.detail-ticket-wrap .ticket { pointer-events: none; }
.detail-title { margin: 0 0 20px; font-size: clamp(26px, 7vw, 30px); letter-spacing: -.06em; line-height: 1.2; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.detail-item { min-width: 0; padding: 15px 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.detail-item:nth-child(odd) { padding-right: 14px; }
.detail-item:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.detail-item small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.detail-item b { font-size: 14px; line-height: 1.35; }
.detail-item .performer-name { display: inline-block; max-width: 100%; vertical-align: top; white-space: nowrap; overflow-wrap: normal; overflow: hidden; text-overflow: ellipsis; }
.detail-item .detail-datetime { font-size: clamp(12px, 3.5vw, 14px); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-note { position: relative; margin: 22px 0; padding: 17px 17px 17px 39px; border-radius: 13px; background: var(--paper); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-note::before { content: "“"; position: absolute; top: 17px; left: 17px; color: var(--coral); font-size: 27px; font-weight: 900; line-height: 1; }
.detail-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; flex-shrink: 0; gap: 9px; margin-top: 20px; background: var(--white); }
.download-button, .delete-button { border-radius: 12px; padding: 13px 15px; cursor: pointer; font-weight: 800; }
.download-button { border: 0; background: var(--ink); color: white; }
.download-button:disabled { background: #e7e1d7; color: #8a8174; cursor: not-allowed; }
.ticket-save-preview { margin-top: 20px; }
.ticket-save-preview[hidden] { display: none; }
.ticket-save-preview p { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ticket-save-preview img { display: block; width: 100%; height: auto; border-radius: 12px; -webkit-touch-callout: default; user-select: auto; }
.delete-button { border: 1px solid var(--line); background: transparent; color: #a64638; }
.generation-detail { margin: 16px 0 20px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #f8f5ef; color: #5a5248; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.generation-detail p { margin: 0; }
.generation-detail p + p { margin-top: 6px; }
.generation-detail .generation-spinner { margin-right: 5px; }
.generation-error { color: #8c3b2c; }
.generation-detail.generation-error { background: #fff2e9; border-color: rgba(151,64,45,.18); }
.generation-recovery { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.generation-recovery p { min-width: 0; word-break: keep-all; }
.retry-generation-button { min-width: 72px; min-height: 44px; padding: 9px 12px; border: 1px solid rgba(151,64,45,.25); border-radius: 10px; background: #fffaf6; color: #8c3b2c; font-size: 12px; font-weight: 800; line-height: 1.4; white-space: nowrap; cursor: pointer; }
.retry-generation-button:hover { background: #f8e5d8; }
.retry-generation-button:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; }

/* Account folders: quiet paper surfaces, with colour reserved for selection. */
.collection-filters { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 14px; min-width: 0; }
.collection-filters .year-tabs { flex: 1 1 auto; min-width: 0; padding-bottom: 0; }
.folder-filter { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 1 auto; min-width: 0; max-width: 50%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,249,.55); font-size: 12px; font-weight: 750; cursor: pointer; }
.folder-filter span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-filter.is-selected { color: #895947; border-color: #d8bcae; background: #f2e6dc; }
:is(.folder-filter, .folder-field-value, .detail-folder-button, .folder-option, .folder-tool-button, .folder-create-button) svg { display: block; width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.folder-filter > svg:last-child, .folder-field-value > svg:last-child, .detail-folder-button > svg:last-child { width: 14px; height: 14px; color: var(--muted); }
.folder-form-button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 48px; margin-top: 12px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; cursor: pointer; }
.folder-field-label { flex: none; font-size: 12px; font-weight: 850; }
.folder-field-label small { margin-left: 4px; color: var(--muted); font-size: 10px; font-weight: 600; }
.folder-field-value { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; color: #5f584e; font-size: 13px; font-weight: 650; }
.folder-field-value > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-folder-button { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 44px; margin-block: -6px; padding: 6px 0; border: 0; border-radius: 4px; background: none; text-align: left; font-size: 14px; font-weight: 750; line-height: 1.35; cursor: pointer; }
.detail-folder-button > span { min-width: 0; overflow-wrap: anywhere; }
.detail-folder-button > svg:first-child { color: #9a7561; }
.detail-folder-button > svg:last-child { margin-left: auto; }
.folder-sheet.is-viewport-constrained { top: var(--folder-viewport-top); bottom: auto; height: var(--folder-viewport-height); }
.folder-card { --folder-workspace-height: 108px; display: flex; flex-direction: column; width: min(100%, 520px); height: min(480px, 75vh); height: min(480px, 75dvh); min-height: 0; max-height: 75vh; max-height: min(75dvh, calc(var(--folder-viewport-height, 100dvh) - var(--safe-area-top) - 12px)); overflow: hidden; padding-bottom: calc(18px + var(--safe-area-bottom)); }
.folder-card > :not(.folder-list) { flex-shrink: 0; }
.folder-card .sheet-handle { margin-bottom: 14px; }
.folder-card .sheet-header { align-items: center; gap: 12px; margin-bottom: 12px; }
.folder-card .sheet-header h2 { font-size: 23px; letter-spacing: -.05em; }
.folder-card .detail-header-actions { gap: 8px; }
.folder-manage-button { flex: none; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; color: var(--ink); }
.folder-manage-button svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.folder-sheet.is-managing .folder-manage-button { background: #eeeae3; }
.folder-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: none; scroll-padding-block: 6px; padding: 3px; margin-inline: -3px; }
/* Reserve the same workspace above the list for create, rename and delete.
   Switching tools changes its contents, never the list's starting position. */
.folder-footer { display: flex; flex-direction: column; flex: 0 0 var(--folder-workspace-height); height: var(--folder-workspace-height); min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: none; scroll-padding-block: 8px; padding: 8px 3px; margin: 0 -3px 12px; border-bottom: 1px solid var(--line); }
.folder-footer > * { flex-shrink: 0; }
/* The editing tools share one reserved row. Crossfades never move the list. */
.folder-workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(90px, auto); min-height: 90px; min-width: 0; }
.folder-workspace > * { grid-area: 1 / 1; min-width: 0; align-self: start; }
.folder-workspace > :not([hidden]) { z-index: 1; }
.folder-workspace > .folder-create-button { align-self: center; margin-block: 0; }
.folder-workspace > .is-workspace-leaving[hidden] { display: block; z-index: 0; pointer-events: none; user-select: none; }
.folder-workspace > .folder-create-button.is-workspace-leaving[hidden] { display: flex; }
.folder-row { display: flex; align-items: center; gap: 2px; min-width: 0; border-radius: 12px; }
.folder-row + .folder-row { margin-top: 4px; }
.folder-row.is-selected { background: #f3e8df; }
.folder-option { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; min-height: 64px; padding: 11px 12px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; }
.folder-icon { display: grid; place-items: center; flex: none; width: 28px; color: #8c8377; }
.folder-icon svg { width: 22px; height: 22px; }
.folder-row-copy { display: grid; gap: 3px; flex: 1 1 auto; min-width: 0; }
.folder-row-copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.4; font-weight: 750; }
.folder-row-copy small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.folder-option .folder-check { display: block; flex: none; width: 17px; height: 17px; color: #95634f; opacity: 0; }
.folder-option .folder-check svg { width: 17px; height: 17px; }
.folder-option:is(.is-selected, [aria-pressed="true"]) .folder-check { opacity: 1; }
.folder-option:is(.is-selected, [aria-pressed="true"]) .folder-icon { color: #95634f; }
.folder-row-tools { display: flex; align-items: center; flex: none; padding-right: 4px; }
.folder-tool-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.folder-tool-button.is-danger { color: #9f6757; }
.folder-empty { margin: 12px 0 6px; padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.65; text-align: center; }
.folder-feedback { margin: 6px 0 0; color: #974f3f; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.folder-editor { margin: 0; padding: 0; border: 0; }
.folder-editor-heading, .folder-delete-confirm > p { display: flex; align-items: center; min-height: 44px; margin: 0; font-size: 13px; font-weight: 750; line-height: 1.5; }
.folder-editor-heading { justify-content: space-between; gap: 10px; }
.folder-editor-heading b { font-size: 13px; font-weight: 750; }
.folder-editor-heading button { min-width: 44px; min-height: 44px; padding: 8px 0 8px 10px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.folder-editor-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.folder-editor-controls input { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f5ef; color: var(--ink); font-size: 16px; }
.folder-editor-controls input:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }
.folder-editor-controls button, .folder-confirm-actions button { min-height: 46px; padding: 10px 16px; border: 0; border-radius: 10px; background: var(--ink); color: var(--white); font-size: 13px; font-weight: 750; cursor: pointer; }
.folder-delete-confirm { margin: 0; padding: 0; border: 0; }
.folder-delete-confirm p { overflow-wrap: anywhere; }
.folder-delete-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.folder-delete-confirm small { display: block; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.folder-confirm-actions { display: flex; flex-shrink: 0; justify-content: flex-end; gap: 6px; margin: 0; white-space: nowrap; }
.folder-confirm-actions button { min-width: 44px; padding-inline: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.folder-confirm-actions .folder-delete-button { border-color: transparent; background: #f1e2d9; color: #8c493a; }
.folder-create-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-block: auto; padding: 12px; border: 1px dashed #d5c9bc; border-radius: 12px; background: #f8f5ef; color: #805b49; font-size: 13px; font-weight: 750; cursor: pointer; }
.folder-workspace :is(button, input) { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease; }
#folderSave, #folderDeleteSubmit { position: relative; }
#folderSave { min-width: 82px; padding-inline: 22px; }
#folderSave::after, #folderDeleteSubmit::after { content: ""; position: absolute; top: 50%; right: 6px; width: 12px; height: 12px; margin-top: -6px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; opacity: 0; pointer-events: none; }
#folderDeleteSubmit::after { right: auto; left: 50%; margin-left: -6px; color: #8c493a; }
#folderSave.is-loading, #folderDeleteSubmit.is-loading { opacity: .8; cursor: progress; }
#folderDeleteSubmit.is-loading { color: transparent; }
#folderSave.is-loading::after, #folderDeleteSubmit.is-loading::after { opacity: 1; animation: folder-action-spin 900ms linear infinite; }
@keyframes folder-action-spin { to { transform: rotate(360deg); } }
.folder-card button:disabled, .folder-form-button:disabled, .detail-folder-button:disabled { opacity: .5; cursor: default; }
.collection-filters[hidden], .collection-filters .year-tabs[hidden], .folder-filter[hidden], .folder-form-button[hidden], .folder-editor[hidden], .folder-delete-confirm[hidden], .folder-feedback[hidden], .folder-empty[hidden], .folder-create-button[hidden], .folder-manage-button[hidden], .folder-row-tools[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) {
  .folder-row:not(.is-selected):hover, .folder-tool-button:hover, .folder-manage-button:hover { background: #f5f0e8; }
  .folder-filter:hover, .folder-form-button:hover, .detail-folder-button:hover { color: #895947; }
}
@media (max-width: 380px) {
  .collection-filters { gap: 7px; }
  .folder-filter { gap: 5px; padding-inline: 10px; }
  .folder-option { gap: 8px; padding-inline: 8px; }
  .folder-card .sheet-header h2 { font-size: 21px; }
  .folder-sheet.is-managing .folder-option .folder-check { display: none; }
}
/* Keep the same sheet height when an editor opens; small viewports give the
   controls room by reducing decorative spacing, not by growing the sheet. */
@media (max-height: 500px) {
  .folder-card { padding-bottom: calc(12px + var(--safe-area-bottom)); }
  .folder-card .sheet-handle, .folder-card .step-label { display: none; }
  .folder-card .sheet-header { margin-bottom: 8px; }
}
.folder-sheet.is-viewport-compact .folder-card { padding-bottom: calc(12px + var(--safe-area-bottom)); }
.folder-sheet.is-viewport-compact .sheet-handle,
.folder-sheet.is-viewport-compact .step-label { display: none; }
.folder-sheet.is-viewport-compact .sheet-header { margin-bottom: 8px; }
.folder-sheet.is-viewport-tight .folder-footer { flex-shrink: 1; }
.folder-sheet.is-viewport-tight .folder-list { flex-basis: 0; }
@media (max-height: 320px) {
  .folder-card > .folder-footer { flex-shrink: 1; }
  .folder-list { flex-basis: 0; }
}

/* Dialog autofocus can match :focus-visible after a tap in Safari.
   Keep focus in place for accessibility; hide only the pointer-mode ring. */
body.pointer-input :is(button, a, summary, input, textarea):focus { outline: none; }
body.pointer-input .style-option input:focus + .style-swatch,
body.pointer-input .photo-drop:focus-within { outline: none; }
body.pointer-input .field input:focus,
body.pointer-input .field textarea:focus { border-color: var(--line); box-shadow: none; }
.retry-generation-button:disabled { opacity: .6; cursor: wait; }

.usage-guide { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: none; margin: 0; overflow: hidden; overscroll-behavior: none; }
.usage-guide::backdrop { background: transparent; backdrop-filter: none; }
.guide-shade { position: absolute; inset: 0; z-index: 2; background: rgb(24 23 21 / 62%); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); mask-repeat: no-repeat; mask-size: 100% 100%; mask-mode: alpha; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; }
.guide-focus { position: absolute; z-index: 3; border: 0; pointer-events: none; }
.guide-focus.is-dark-action::after { content: ""; position: absolute; inset: -4px; border: 2px solid #fff4d9; border-radius: inherit; box-shadow: 0 0 0 4px rgb(255 244 217 / 9%), 0 0 18px rgb(255 244 217 / 20%); }
.guide-target-action { position: absolute; z-index: 3; margin: 0; padding: 0; border: 0; background: transparent; color: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.guide-target-action[hidden] { display: none; }
.guide-target-action:focus-visible { outline: 2px solid #aaa49b; outline-offset: 3px; }
.guide-card { position: absolute; z-index: 4; display: flex; flex-direction: column; width: min(380px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 14px 20px max(14px, var(--safe-area-bottom)); border: 1px solid var(--line); border-radius: 20px; background: var(--white); color: var(--ink); box-shadow: 0 12px 48px #0003; overflow-y: auto; }
.guide-card > [aria-live] { flex: 0 0 auto; height: var(--guide-copy-height, 106px); overflow-y: auto; }
.guide-card.is-guide-finish > [aria-live] { height: auto; }
.guide-card h2[hidden] { display: none; }
.guide-copy-measure { position: absolute; visibility: hidden; pointer-events: none; height: auto; }
.guide-heading, .guide-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.guide-heading { margin-bottom: 6px; flex-shrink: 0; }
#guideCount { color: #8c7768; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
#guideClose { min-height: 32px; border: 0; padding: 4px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.guide-card h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.4; letter-spacing: -.045em; word-break: keep-all; }
.guide-card p { margin: 0; font-size: 14px; line-height: 1.65; color: #706c64; word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
.guide-photo-rules strong { font-weight: 750; }
.guide-photo-later { color: #46613b; }
.guide-photo-locked { color: #92472e; }
.guide-navigation { margin-top: 10px; flex-shrink: 0; }
.guide-navigation button { min-height: 42px; border-radius: 12px; padding: 10px 20px; font-size: 14px; font-weight: 750; cursor: pointer; }
#guidePrevious { border: 1px solid var(--line); background: transparent; color: var(--ink); }
#guidePrevious:disabled { opacity: .3; cursor: default; }
#guideNext { border: 1px solid var(--ink); background: var(--ink); color: var(--white); min-width: 94px; }
.guide-scene { position: absolute; z-index: 1; top: max(12px, var(--safe-area-top)); left: 50%; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); border-radius: 24px; background: var(--white); overflow: hidden; padding: 12px 18px 16px; display: flex; flex-direction: column; }
.guide-scene[hidden] { display: none; }
.guide-changing-screen .guide-focus { visibility: hidden; }
.guide-demo-label { flex-shrink: 0; margin: 0 0 10px; font-size: 10px; text-align: center; letter-spacing: .06em; color: var(--muted); }
.guide-demo-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.guide-demo-form .sheet-handle { display: none; }
.guide-demo-form .sheet-header { flex-shrink: 0; margin-bottom: 12px; }
.guide-demo-form .sheet-header h2 { font-size: 24px; }
.guide-demo-form .step-label { font-size: 10px; }
.guide-demo-form .form-grid { gap: 10px; }
.guide-demo-form .field { gap: 5px; }
.guide-demo-form .field input, .guide-demo-form .field textarea { min-height: 44px; height: 44px; padding: 10px 8px; }
.guide-demo-form .field textarea { height: 56px; resize: none; }
.guide-demo-form .style-picker { margin-top: 12px; }
.guide-demo-form .style-swatch { height: 40px; }
.guide-demo-form .photo-drop { padding: 10px; margin-top: 12px; min-height: 68px; }
.guide-demo-form .generate-button { flex-shrink: 0; min-height: 48px; margin-top: 12px; padding: 12px; }
.guide-demo-detail { overflow-y: auto; min-height: 0; scrollbar-width: none; }
.guide-demo-detail .sheet-header { margin-bottom: 14px; align-items: center; }
.guide-demo-detail h2 { font-size: 24px; }
.guide-demo-ticket .ticket { width: 100%; }
.guide-demo-metadata { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.guide-demo-metadata span { min-width: 0; padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.guide-demo-metadata b { display: block; margin-top: 6px; color: var(--ink); font-size: 13px; }
.guide-demo-actions { display: flex; gap: 8px; margin-top: 18px; padding-bottom: 4px; }
.guide-demo-actions button { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); padding: 10px 14px; font-weight: 750; }
.guide-demo-actions button:first-child { flex: 1; background: var(--ink); color: var(--white); }
.guide-scene [hidden] { display: none !important; }
.guide-demo-home { padding-top: 16px; }
.guide-demo-home > h2 { margin: 0 0 24px; }
@media (prefers-reduced-motion: no-preference) {
  .usage-guide[open] .guide-card { animation: guide-appear 180ms ease-out; }
  @keyframes guide-appear { from { opacity: 0; } to { opacity: 1; } }
}
.account-drawer { inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; margin: 0; overflow: clip; overscroll-behavior-y: none; }
.account-drawer[open] { display: flex; justify-content: flex-end; }
.account-drawer[open]::backdrop { animation: backdrop-in 280ms ease-out both; }
.account-drawer.is-drawer-closing::backdrop { animation: backdrop-out 240ms ease-in both; }
.drawer-panel { width: min(360px, calc(100% - 28px)); height: 100%; height: 100dvh; min-width: 0; display: flex; flex-direction: column; padding: calc(24px + var(--safe-area-top)) max(22px, var(--safe-area-right)) calc(24px + var(--safe-area-bottom)) max(22px, var(--safe-area-left)); overflow-y: auto; overscroll-behavior-y: none; border-radius: 24px 0 0 24px; background: var(--white); box-shadow: -16px 0 60px rgba(23,21,18,.16); }
.account-drawer[open] .drawer-panel { animation: drawer-in 320ms cubic-bezier(.25,.7,.35,1) both; will-change: transform; }
.account-drawer.is-drawer-closing .drawer-panel { animation: drawer-out 240ms cubic-bezier(.4,0,1,1) both; pointer-events: none; }
@keyframes drawer-in { from { transform: var(--drawer-open-start, translateX(100%)); } to { transform: translateX(0); } }
@keyframes drawer-out { from { transform: var(--drawer-close-start, translateX(0)); } to { transform: translateX(100%); } }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.drawer-header h2 { margin: 0; font-size: 24px; letter-spacing: -.055em; }
#accountMessage { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.account-nickname { margin: 0 0 10px; font-size: 22px; font-weight: 800; line-height: 1.35; letter-spacing: -.04em; overflow-wrap: anywhere; }
.account-actions { display: grid; gap: 9px; margin-top: 20px; }
.account-secondary-button { min-height: 44px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 750; cursor: pointer; }
.account-secondary-button:disabled { color: var(--muted); cursor: wait; }
.account-actions .kakao-login-button { min-height: 48px; font-size: 14px; }
.account-unlink-button { justify-self: center; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: #a64638; font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.account-unlink-button:disabled { color: var(--muted); cursor: wait; }
.account-notice { margin-top: auto; padding-top: 32px; color: var(--muted); font-size: 11px; line-height: 1.7; word-break: keep-all; overflow-wrap: anywhere; }
.account-notice p { margin: 0; }
.account-notice p + p { margin-top: 8px; }

.app-status { position: fixed; z-index: 30; left: 50%; bottom: calc(96px + var(--safe-area-bottom)); transform: translateX(-50%); width: max-content; max-width: min(540px, calc(100% - 36px)); padding: 12px 16px; border-radius: 13px; background: rgba(23,21,18,.94); color: var(--white); box-shadow: 0 8px 24px rgba(23,21,18,.16); font-size: 12px; line-height: 1.6; text-align: center; overflow-wrap: anywhere; pointer-events: none; }
.app-status[hidden] { display: none; }

@media (min-width: 640px) {
  .app-shell { padding-left: max(34px, var(--safe-area-left)); padding-right: max(34px, var(--safe-area-right)); }
  .ticket { min-height: 245px; }
  .ticket-copy { padding: 24px 26px; }
  .sheet-card { padding-left: max(34px, var(--safe-area-left)); padding-right: max(34px, var(--safe-area-right)); }
  .drawer-panel { width: min(380px, calc(100% - 28px)); }
}

@media (max-width: 480px) {
  .topbar { height: 68px; }
  .app-shell { padding-left: max(18px, var(--safe-area-left)); padding-right: max(18px, var(--safe-area-right)); }
  .intro .eyebrow { margin-bottom: 20px; font-size: 10px; }
  .intro-copy { margin: 22px 0 30px; line-height: 1.8; }
  .primary-cta { width: min(100%, 280px); }
  body.has-records .topbar { height: 60px; }
  body.has-records .collection { padding-top: 8px; }
  body.has-records .section-heading h2 { font-size: 30px; }
  .ticket-list { gap: 16px; }
  .ticket-title { line-height: 1.15; }
  .ticket-meta { font-size: 11px; }
  .ticket-generation { top: 10px; left: 10px; max-width: calc(100% - 20px); padding: 6px 8px; font-size: 10px; }
  .ticket-stub b { font-size: 17px; }
  .sheet-card { padding-left: max(18px, var(--safe-area-left)); padding-right: max(18px, var(--safe-area-right)); }
  #addDialog .sheet-card { padding: 10px max(18px, var(--safe-area-right)) calc(18px + var(--safe-area-bottom)) max(18px, var(--safe-area-left)); }
  .photo-drop { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; }
  .photo-icon { width: 36px; height: 40px; }
  .photo-copy b { white-space: nowrap; }
  .photo-action { min-height: 44px; display: grid; place-items: center; }
}

@media (max-width: 380px) {
  .ticket { border-radius: 14px; min-height: 137px; }
  .ticket-copy { padding: 11px 12px; }
  .ticket-stub { padding-inline: 6px; }
  .ticket-list .ticket-stub { padding-block: 6px; }
  .ticket-list .barcode { height: 12px; margin-top: 15px; }
  .ticket-list .ticket-stub em { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* Keep the small waiting indicator active; large sheet/drawer motion stays reduced. */
  .ticket.is-generating .generation-spinner { animation-duration: 1.8s !important; animation-iteration-count: infinite !important; }
  #folderSave.is-loading::after, #folderDeleteSubmit.is-loading::after { animation: none !important; opacity: 1; }
}
