:root {
  color-scheme: light;
  --ink: #333333;
  --body-ink: #666666;
  --accent: #853259;
  --line: #ba9cae;
  --paper: #fffefd;
  --selected: #f9eaf1;
  font-family: "D2Coding", "Cascadia Mono", "Courier New", "Malgun Gothic", monospace;
  color: var(--body-ink);
  background: #efdbe5;
}
* { box-sizing: border-box; }
body { margin: 0; padding: clamp(1rem, 5vw, 3.5rem) clamp(.75rem, 4vw, 2rem); }
.paper {
  position: relative;
  margin-inline: auto;
  max-width: 36rem;
  padding: clamp(2.4rem, 9vw, 4.5rem) clamp(1rem, 6vw, 3rem);
  background: var(--paper);
  box-shadow: 0 14px 40px #54263e22;
}
.paper::before, .paper::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: .5rem;
  background: linear-gradient(135deg, var(--paper) 25%, transparent 25%) 0 0 / 1rem 1rem,
              linear-gradient(225deg, var(--paper) 25%, transparent 25%) 0 0 / 1rem 1rem;
  pointer-events: none;
}
.paper::before { top: -.49rem; transform: rotate(180deg); }
.paper::after { bottom: -.49rem; }
.receipt-header h1 {
  margin: 0 0 1.4rem;
  color: var(--body-ink);
  font-size: clamp(1.3rem, 5vw, 2rem);
  line-height: 1.25;
  letter-spacing: -.055em;
}
.issued, .result, .paper-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
  color: var(--body-ink);
  font-size: 1rem;
  font-weight: 700;
}
.issued {
  padding-block: .9rem;
  border-block: 1px dashed var(--accent);
}
.result {
  margin: 0;
  padding-block: .9rem;
  border-bottom: 1px dashed var(--accent);
}
#list {
  padding-block: .35rem;
}
input { font: inherit; color: inherit; }
input[type=checkbox] {
  appearance: none;
  display: grid;
  place-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  flex: none;
  border: 1px solid #b45883;
  border-radius: .35rem;
  background: var(--paper);
  cursor: pointer;
}
input[type=checkbox]:checked { border-color: #ad4978; background: #ad4978; }
input[type=checkbox]:checked::before {
  content: "";
  width: .33rem;
  height: .58rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
@media (forced-colors: active) {
  input[type=checkbox] { appearance: auto; }
  input[type=checkbox]:checked::before { content: none; }
}
.schedule-group { margin-top: 1.35rem; }
.event-title { margin: 0 0 .35rem; color: var(--body-ink); font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.entry { display: flex; align-items: center; gap: .7rem; padding: .65rem .35rem; min-height: 2.75rem; border-bottom: 1px dotted var(--line); cursor: pointer; line-height: 1.4; }
.entry:has(input:checked) { background: var(--selected); color: #424242; }
.entry:has(input:checked) :is(.single-title,.upcoming) { color: inherit; }
.save { display: block; max-width: 34rem; margin: auto; padding: .7rem; background: var(--selected); color: var(--body-ink); font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; min-height: 2.75rem; }
.save[aria-disabled=true] { cursor: default; opacity: .55; }
.image-fallback { margin: .8rem auto; color: var(--body-ink); font-size: .875rem; text-align: center; line-height: 1.5; }
#notice:not(:empty) { margin: 1rem 0; color: var(--body-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.receipt-image:not([hidden]) { display: block; width: min(100%,34rem); height: auto; margin: 1rem auto; }
.paper-footer { padding-top: .9rem; border-top: 1px dashed var(--accent); }
.barcode {
  width: min(100%,17rem);
  height: 2.1rem;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 9px, transparent 9px 11px, var(--ink) 11px 12px, transparent 12px 15px, var(--ink) 15px 18px, transparent 18px 23px, var(--ink) 23px 24px, transparent 24px 26px, var(--ink) 26px 31px, transparent 31px 33px);
  margin: 1.35rem auto 0;
}

.schedule-subsection + .schedule-subsection { margin-top: .9rem; }
.schedule-city { margin: .75rem 0 .2rem; font-size: .875rem; line-height: 1.4; }
.schedule-meta { margin: 0 0 .3rem; color: var(--body-ink); font-size: .875rem; line-height: 1.45; overflow-wrap: anywhere; }


.schedule-group { margin-top: 0; border-bottom: 1px dotted var(--line); }
.schedule-group summary {
  display: grid;
  grid-template-columns: .65rem minmax(0,1fr) auto;
  align-items: baseline;
  gap: .4rem;
  cursor: pointer;
  padding: .75rem .35rem;
  list-style: none;
}
.schedule-group summary::-webkit-details-marker { display: none; }
.schedule-group summary::before { content: "▸" / ""; color: var(--body-ink); }
.schedule-group[open] summary::before { content: "▾" / ""; }
.schedule-count { color: var(--body-ink); font-size: .875rem; white-space: nowrap; }
.schedule-group[open] .schedule-count { visibility: hidden; }
.schedule-group .event-title { margin: 0; font-size: .875rem; }
.schedule-group .schedule-subsection { margin-inline-start: .6rem; }
.schedule-group .schedule-subsection:last-child { margin-bottom: .65rem; }
.schedule-group .entry:last-child { border-bottom: 0; }
.entry { font-size: .875rem; }
.entry time {
  display: grid;
  grid-template-columns: 5ch 3ch;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  column-gap: .35rem;
  white-space: nowrap;
  flex: none;
}
.musical-entries .entry { min-width: 0; }
@media (min-width: 385px) {
  .musical-entries {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    column-gap: .55rem;
  }
  .musical-entries .entry {
    gap: .35rem;
    padding-inline: 0;
  }
  .musical-entries .entry:last-child { border-bottom: 1px dotted var(--line); }
}
.single-title { min-width: 0; overflow-wrap: anywhere; }
.event-title, .schedule-city, .single-title { color: var(--body-ink); }
.event-title { font-weight: 700; }
.schedule-city, .single-title { font-weight: 400; }

#summary { margin-top: 2.1rem; padding-top: 1.3rem; border-top: 1px dashed var(--line); }
#summaryHeading { margin: 0 0 .8rem; color: var(--body-ink); font-size: 1rem; }


#list > :last-child { border-bottom: 0; }
#receiptForm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; }
.receipt-modes {
  min-width: 0;
  margin: 0;
  padding: .125rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--paper);
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.receipt-modes label { position: relative; cursor: pointer; }
.receipt-modes input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.receipt-modes span {
  display: grid;
  place-items: center;
  min-height: 1.65rem;
  padding: .125rem clamp(.45rem, 2vw, .8rem);
  border-radius: 2rem;
  font-size: .875rem;
  color: var(--body-ink);
  white-space: nowrap;
}
.receipt-modes input:checked + span { background: var(--selected); color: var(--body-ink); font-weight: 700; }
.receipt-modes input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#generateReceipt { flex: 1 0 100%; min-height: 2.75rem; padding: .5rem clamp(.45rem, 2vw, .8rem); white-space: nowrap; font: inherit; font-size: .875rem; font-weight: 700; background: var(--selected); color: var(--body-ink); border: 1px solid var(--accent); cursor: pointer; }
#generateReceipt:disabled { opacity: .55; cursor: default; }
#receiptStatus:empty, .save[hidden] { display: none; }


.receipt-background { min-width: 0; padding: 0; margin: 0; border: 0; }
.background-options { display: flex; gap: .05rem; }
.background-options label {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(1.5rem, 5.6vw, 2rem);
  height: 2.5rem;
  cursor: pointer;
}
.background-options input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.background-options span {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid #30262c33;
  border-radius: 50%;
}
.background-options input:checked + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.background-options input:checked + span::after {
  content: "✓";
  font-size: .8rem;
  font-weight: 700;
  color: #532340;
}
.background-options input:focus-visible + span { box-shadow: 0 0 0 5px #85325938; }
.upcoming { color: var(--body-ink); font-size: .8rem; white-space: nowrap; }
.musical-entries .entry:has(.upcoming) { flex-wrap: wrap; }

.attendance-status { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; color: var(--body-ink); font-size: .875rem; }
.attendance-status + .paper-total { margin-top: .65rem; }

/* Main headings and summary labels retain a stronger visual hierarchy. */
.receipt-header h1, #summaryHeading, .issued, .result, .paper-total { color: var(--ink); }
