:root {
  --ink: #171512;
  --muted: #746f66;
  --paper: #f4f0e8;
  --paper-deep: #e7e0d4;
  --white: #fffdf9;
  --coral: #ff624a;
  --yellow: #f3d64e;
  --violet: #9d82ff;
  --line: rgba(23, 21, 18, 0.14);
  --shadow: 0 22px 60px rgba(39, 29, 17, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    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;
}

button, input, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) max(22px, env(safe-area-inset-right)) calc(120px + env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

body:not(.has-records) .app-shell { display: flex; flex-direction: column; padding-bottom: calc(32px + env(safe-area-inset-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.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 {
  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;
}
@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; 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; }
.ticket-stub b { margin-top: 5px; font-size: clamp(13px, 4vw, 21px); line-height: 1.05; letter-spacing: -.04em; }
.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: 70%; max-width: 55px; height: 19px; margin-top: 13px; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px, currentColor 3px 5px, transparent 5px 7px); opacity: .9; }

.ticket.style-paper { color: #201b17; }
.ticket.style-paper .ticket-shine { background: linear-gradient(105deg, rgba(250,243,225,.9), rgba(250,243,225,.3)); mix-blend-mode: screen; }
.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%); }

.floating-add {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-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); }

/* The sheet card owns scrolling; dialog autofocus must not scroll the animated shell. */
.sheet { inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; margin: 0; overflow: clip; }
.sheet[open] { display: grid; align-items: end; }
.sheet[open] .sheet-card { will-change: transform; }
.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 - env(safe-area-inset-top) - 12px);
  margin: auto auto 0;
  padding: 10px 22px calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-padding-block: 20px;
  border-radius: 26px 26px 0 0;
  background: var(--white);
  box-shadow: var(--shadow);
  animation: sheet-in 380ms cubic-bezier(.25,.7,.35,1) both;
}
@keyframes sheet-in { from { transform: 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; } }
#addDialog[open] { align-items: end; }
#addDialog .sheet-card {
  width: min(100%, 600px);
  margin: auto auto 0;
  max-height: calc(100dvh - max(64px, 10svh, env(safe-area-inset-top)));
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
}
#addDialog .sheet-handle { display: block; margin: 2px auto 14px; }
#addDialog .sheet-header { margin-bottom: 18px; }
#addDialog .sheet-header h2 { font-size: 25px; }
#addDialog .step-label { font-size: 10px; }
#addDialog .form-grid { gap: 12px 10px; }
#addDialog .field { gap: 6px; }
#addDialog .field input, #addDialog .field textarea { padding: 10px 8px; min-height: 44px; }
#addDialog .field input { height: 44px; }
#addDialog .field textarea { min-height: 64px; max-height: 120px; }
#addDialog .style-picker { margin-top: 16px; }
#addDialog .style-swatch { height: 40px; }
#addDialog .style-option > b { margin-top: 5px; }
#addDialog .photo-drop { min-height: 68px; margin-top: 16px; padding: 10px; }
#addDialog .generate-button { min-height: 48px; margin-top: 16px; 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; }
.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 control inside its grid column without changing the picker. */
.field input[type="date"] {
  -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 { min-height: 1.5em; text-align: left; }
.field input[type="date"]::-webkit-datetime-edit { min-width: 0; padding: 0; }
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,21,18,.07); }

.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(3,1fr); gap: 9px; }
.style-option { position: relative; cursor: pointer; }
.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(--ink); outline: 3px solid rgba(23,21,18,.08); }
.style-option input:focus-visible + .style-swatch { outline: 3px solid var(--coral); 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); }

.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: 3px solid var(--coral); outline-offset: 3px; }
.photo-icon { width: 45px; height: 45px; border-radius: 9px; background: var(--paper-deep); display: grid; place-items: center; font-size: 21px; }
.photo-copy { display: grid; gap: 4px; min-width: 0; }
.photo-copy b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-copy small { color: var(--muted); font-size: 10px; }
.photo-action { padding: 7px 10px; border-radius: 8px; background: white; border: 1px solid var(--line); font-size: 11px; font-weight: 800; }
.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: 3px solid var(--coral); outline-offset: 2px; 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 { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
.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-note { margin: 22px 0; padding: 17px; border-radius: 13px; background: var(--paper); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.detail-note::before { content: "“"; color: var(--coral); font-size: 27px; font-weight: 900; vertical-align: -8px; margin-right: 4px; }
.detail-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.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; }
.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: 2px solid var(--coral); outline-offset: 3px; }
.retry-generation-button:disabled { opacity: .6; cursor: wait; }

.info-dialog { width: min(calc(100% - 32px), 420px); max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 32px); margin: auto; overflow-y: auto; overscroll-behavior-y: contain; }
.info-dialog article { position: relative; padding: 31px; border-radius: 23px; background: var(--white); box-shadow: var(--shadow); }
.info-dialog .close-button { position: absolute; right: 18px; top: 18px; }
.info-dialog h2 { margin: 0 0 13px; font-size: 35px; letter-spacing: -.07em; }
.info-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.7; font-size: 14px; }
.info-dialog .about-copy { margin: 0; word-break: keep-all; }
.how-to-list { display: grid; gap: 18px; margin: 24px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); list-style: none; }
.how-to-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; }
.how-to-number { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #f7e7dd; color: #a7543e; font-size: 11px; font-weight: 800; }
.how-to-list h3 { margin: 2px 0 5px; font-size: 14px; font-weight: 800; letter-spacing: -.03em; }
.info-dialog .how-to-list p { margin: 0; font-size: 12px; line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere; }
.account-drawer { inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; margin: 0; overflow: clip; }
.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: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) 22px; overflow-y: auto; overscroll-behavior-y: contain; 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 + env(safe-area-inset-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, env(safe-area-inset-left)); padding-right: max(34px, env(safe-area-inset-right)); }
  .ticket { min-height: 245px; }
  .ticket-copy { padding: 24px 26px; }
  .sheet-card { padding-inline: 34px; }
  .drawer-panel { width: min(380px, calc(100% - 28px)); }
}

@media (max-width: 480px) {
  .topbar { height: 68px; }
  .app-shell { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-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, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  #addDialog .sheet-card { padding: 10px max(18px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .photo-drop { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; }
  .photo-icon { width: 36px; height: 40px; }
  .photo-copy b { white-space: normal; overflow-wrap: anywhere; }
  .photo-copy small { font-size: 11px; line-height: 1.5; }
  .photo-action { min-height: 44px; display: grid; place-items: center; }
  .info-dialog article { padding: 28px 24px; }
}

@media (max-width: 380px) {
  .ticket { border-radius: 14px; min-height: 137px; }
  .ticket-copy { padding: 11px 12px; }
  .ticket-stub { padding-inline: 6px; }
}

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