:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #24271f;
  --muted: #63675c;
  --line: #d9dbd1;
  --lime: #d8fa79;
  --white: #fff;
  --sans: "Inter","Pretendard","Apple SD Gothic Neo","Malgun Gothic","Yu Gothic UI","Segoe UI",Arial,sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,input,select,textarea {
  font: inherit;
  color: inherit;
}

button,select {
  cursor: pointer;
}

button {
  border: 0;
  background: none;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid #496f03;
  outline-offset: 3px;
}

[hidden] {
  display: none!important;
}

.wrap {
  width: min(calc(100% - 88px),1160px);
  margin-inline: auto;
}

.topbar {
  height: 74px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.top-inner,.brand,.language,.history-heading,.history-title,.clear,.local-note,.copy,.generate,.downloads button,.dialog-buttons {
  display: flex;
  align-items: center;
}

.top-inner {
  height: 100%;
  justify-content: space-between;
}

.brand {
  gap: 11px;
  font-family: "Inter","Segoe UI",sans-serif;
  font-size: 1.5rem;
  letter-spacing: -1.3px;
  font-weight: 750;
}

.brand-icon {
  width: 37px;
  height: 37px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--lime);
  display: grid;
  place-items: center;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.language {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
}

.language select {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 8px 31px 8px 35px;
  font-size: .875rem;
  font-weight: 600;
}

.language>span {
  position: absolute;
  pointer-events: none;
}

.language>span:first-child {
  left: 11px;
}

.language>span:last-child {
  right: 9px;
}

.language svg {
  width: 16px;
  height: 16px;
}

.language>span:last-child svg {
  width: 13px;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 5px 30px 0;
  min-height: 155px;
}

h1,h2,p {
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem,4.1vw,3.25rem);
  line-height: 1.17;
  font-weight: 800;
  letter-spacing: -.07em;
}

.intro p {
  color: var(--muted);
  margin-top: 10px;
  letter-spacing: -.02em;
}

.ticket-art {
  position: relative;
  width: 159px;
  height: 91px;
  flex: none;
  margin-right: 11px;
}

.ticket {
  position: absolute;
  width: 91px;
  height: 65px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 2px 2px 0 var(--ink);
}

.ticket-back {
  background: var(--lime);
  top: 10px;
  left: 16px;
  transform: rotate(-15deg);
}

.ticket-front {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-evenly;
  padding: 7px;
  background: #fff;
  left: 39px;
  top: 15px;
  transform: rotate(11deg);
}

.ticket-front canvas {
  width: 43px;
  height: 43px;
  image-rendering: pixelated;
}

.ticket-stub {
  height: 45px;
  width: 16px;
  border-left: 1px dashed var(--ink);
  background: repeating-linear-gradient(0deg,var(--ink) 0 2px,transparent 2px 4px);
  background-clip: content-box;
  padding-left: 5px;
}

.spark {
  position: absolute;
  background: var(--ink);
  clip-path: polygon(50% 0,61% 38%,100% 50%,61% 62%,50% 100%,39% 62%,0 50%,39% 38%);
}

.spark-one {
  right: 2px;
  top: 3px;
  width: 23px;
  height: 23px;
}

.spark-two {
  left: 1px;
  bottom: 5px;
  width: 13px;
  height: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  gap: 22px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 3px 3px 0 #35382f;
  display: flex;
  flex-direction: column;
}

h2 {
  font-size: 1.18rem;
  font-weight: 750;
  letter-spacing: -.045em;
}

.setup form {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 22px;
  padding: 23px 24px 24px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend,.field-label {
  display: block;
  font-size: .94rem;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0 0 10px;
  padding: 0;
}

.types {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 9px;
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
  min-width: 0;
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tile {
  min-height: 58px;
  padding: 10px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #d8dad1;
  border-radius: 8px;
  background: #fff;
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.tile svg {
  width: 18px;
  height: 18px;
}

.choice input:checked+.tile {
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: inset 0 0 0 .5px var(--ink);
}

.choice input:focus-visible+.tile {
  outline: 3px solid #496f03;
  outline-offset: 2px;
}

.choice:hover input:not(:checked)+.tile,.downloads button:hover,.copy:hover,.clear:enabled:hover,.record-open:hover,.delete-record:hover {
  background: #f1f4e9;
}

.fields {
  display: grid;
  gap: 13px;
}

.field-label {
  margin-bottom: 8px;
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.input-icon svg {
  height: 17px;
  width: 17px;
}

.fields input:not([type=checkbox]),textarea,.fields select {
  width: 100%;
  border: 1px solid #babeb1;
  background: #fff;
  border-radius: 8px;
  padding: 11px 13px;
  min-height: 45px;
  line-height: 1.4;
}

.input-box .with-icon {
  padding-left: 41px!important;
}

input::placeholder,textarea::placeholder {
  color: #74796d;
  opacity: 1;
}

textarea {
  resize: vertical;
  min-height: 83px;
}

.fields .select-box select {
  appearance: none;
  padding-right: 38px;
}

.select-box>span {
  position: absolute;
  right: 14px;
  pointer-events: none;
}

.select-box svg {
  width: 15px;
}

.check-line {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: .875rem;
}

.check-line input {
  accent-color: #485d1b;
  width: 16px;
  height: 16px;
}

.hint {
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.5;
  margin-top: 7px;
}

.error {
  font-size: .875rem;
  color: #a42116;
}

[aria-invalid=true] {
  border-color: #a42116!important;
}

.generate {
  margin-top: auto;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  font-weight: 700;
}

.generate svg {
  color: var(--lime);
  height: 18px;
  width: 18px;
}

.generate:enabled:hover {
  background: #373d2e;
}

.appearance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.style-field {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 7px;
  min-width: 0;
  font-weight: 650;
  font-size: .875rem;
}

.color-control, #margin {
  display: flex;
  position: relative;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #babeb1;
  border-radius: 8px;
  background: #fff;
}

.color-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.color-control:focus-within {
  outline: 3px solid #496f03;
  outline-offset: 2px;
}

.swatch {
  flex: none;
  width: 19px;
  height: 19px;
  border: 1px solid #0003;
  border-radius: 5px;
}

.hex {
  font: .8125rem/1 Consolas, monospace;
}

#margin {
  appearance: none;
  padding-right: 30px;
  font: inherit;
  font-weight: 500;
}

#contrast-note {
  grid-column: 1 / -1;
  margin: 0;
  color: #80501d;
}

.generate:disabled, .downloads button:disabled, .copy:disabled {
  opacity: .55;
}

#preview-empty {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 480px), (min-width: 701px) and (max-width: 850px) {
  .appearance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-field:last-of-type { grid-column: 1 / -1; }
}

.counter,#preview-label {
  font-size: .78rem;
  line-height: 1.35;
}

.preview-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 18px 20px 20px;
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 220px;
  gap: 10px;
  padding: 16px 25px 13px;
  border: 1px solid #d8dccf;
  border-radius: 9px;
  background-color: #f3f5eb;
  background-image: radial-gradient(#c7ccba .85px,transparent .95px);
  background-size: 11px 11px;
}

.qr-sheet {
  display: grid;
  place-items: center;
  background: #fff;
  width: clamp(146px,13vw,174px);
  aspect-ratio: 1;
  border: 1.2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 #b9c594;
  overflow: hidden;
}

#qr {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#preview-label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: .02em;
  color: #505648;
  font-family: "IBM Plex Mono",Consolas,monospace;
  background: #f3f5eb;
  padding: 0 5px;
}

.corner {
  width: 11px;
  height: 11px;
  position: absolute;
  border: solid #828b6f;
}

.tl {
  top: 11px;
  left: 11px;
  border-width: 1.5px 0 0 1.5px;
}

.tr {
  top: 11px;
  right: 11px;
  border-width: 1.5px 1.5px 0 0;
}

.bl {
  bottom: 11px;
  left: 11px;
  border-width: 0 0 1.5px 1.5px;
}

.br {
  bottom: 11px;
  right: 11px;
  border-width: 0 1.5px 1.5px 0;
}

.downloads {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
}

.downloads button,.copy,.dialog-buttons button {
  border: 1px solid #c9cdc0;
  border-radius: 7px;
  justify-content: center;
  gap: 7px;
  padding: 8px 4px;
  min-height: 40px;
  font-size: .875rem;
  font-weight: 650;
}

.downloads svg,.copy svg,.clear svg {
  width: 16px;
  height: 16px;
}

.copy {
  width: 100%;
  background: #f6f7f1;
}

.history {
  margin: 35px 0 40px;
}

.history-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.history-title {
  gap: 10px;
}

.history-title>span:first-child svg {
  width: 23px;
  height: 23px;
}

.history-title h2 {
  font-size: 1.3rem;
}

.counter {
  font-family: Consolas,monospace;
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eff0e8;
  color: #4d5344;
}

.clear {
  gap: 6px;
  color: #52574b;
  font-size: .84rem;
  padding: 7px 9px;
  border-radius: 6px;
}

.clear:disabled {
  opacity: .55;
}

.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 85px;
  border: 1px dashed #c3c7b8;
  border-radius: 11px;
  background: #fafbf7;
  color: #64695d;
  font-size: .9rem;
  text-align: center;
  padding: 16px;
}

.empty-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #d8dccf;
  border-radius: 8px;
  background: #f1f3e9;
}

.empty-icon svg {
  width: 17px;
  height: 17px;
}

.local-note {
  justify-content: flex-start;
  gap: 6px;
  margin-top: 11px;
  color: #686d60;
  font-size: .8125rem;
}

.local-note svg {
  width: 14px;
  height: 14px;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 10px;
}

.record {
  position: relative;
  min-width: 0;
  background: #fff;
  border: 1px solid #cdd1c3;
  border-radius: 10px;
}

.record-open {
  display: flex;
  text-align: start;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 80px;
  padding: 10px 27px 10px 10px;
  border-radius: 10px;
}

.record canvas {
  width: 45px;
  height: 45px;
  flex: none;
  image-rendering: pixelated;
  border: 1px solid #e5e7df;
  border-radius: 3px;
}

.record-info {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.record-info strong {
  font-size: .85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-info small {
  font-size: .75rem;
  color: var(--muted);
}

.delete-record {
  position: absolute;
  right: 3px;
  top: 3px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: var(--muted);
}

.delete-record svg {
  width: 14px;
  height: 14px;
}

dialog {
  width: min(390px,calc(100% - 32px));
  border: 1.5px solid var(--ink);
  border-radius: 15px;
  padding: 24px;
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

dialog::backdrop {
  background: #20251e60;
}

dialog p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: .94rem;
}

.dialog-buttons {
  justify-content: flex-end;
  gap: 8px;
}

.dialog-buttons button {
  padding: 8px 16px;
}

.dialog-buttons #confirm {
  background: var(--ink);
  color: #fff;
}

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%,12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s,transform .16s;
  background: var(--ink);
  color: #fff;
  border-radius: 9px;
  font-size: .9rem;
  padding: 11px 19px;
  max-width: calc(100% - 32px);
  width: max-content;
  text-align: center;
  z-index: 3;
}

#toast.shown {
  opacity: 1;
  transform: translate(-50%,0);
}

@media(min-width:1400px) {
  .intro {
    min-height: 175px;
  }
  .stage {
    min-height: 245px;
  }
  .setup form {
    gap: 26px;
  }
  .tile {
    min-height: 64px;
  }
}

@media(max-width:900px) {
  .wrap {
    width: calc(100% - 42px);
  }
  .workspace {
    gap: 16px;
    grid-template-columns: minmax(0,1.1fr) minmax(0,1fr);
  }
  .setup form {
    padding-inline: 16px;
  }
  .preview-body {
    padding: 15px;
  }
  .tile {
    gap: 5px;
    font-size: .84rem;
  }
  .record-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media(max-width:700px) {
  .workspace {
    grid-template-columns: minmax(0,1fr);
    gap: 19px;
  }
  .wrap {
    width: calc(100% - 32px);
  }
  .topbar {
    height: 60px;
  }
  .brand {
    font-size: 1.25rem;
  }
  .brand-icon {
    width: 32px;
    height: 32px;
  }
  .intro {
    min-height: 126px;
    padding: 24px 0;
    gap: 10px;
  }
  .intro h1 {
    font-size: 2.1rem;
  }
  .intro p {
    font-size: .9rem;
  }
  .ticket-art {
    transform: scale(.75);
    transform-origin: right center;
    width: 124px;
    margin: 0 8px 0 -25px;
  }
  .setup form {
    gap: 19px;
    padding: 18px;
  }
  .tile {
    min-height: 53px;
    font-size: .9rem;
  }
  .stage {
    min-height: 225px;
  }
  .qr-sheet {
    width: 164px;
  }
  .history {
    margin-top: 29px;
  }
  .history-title {
    gap: 7px;
  }
  .history-title h2 {
    font-size: 1.15rem;
  }
  .empty {
    min-height: 85px;
  }
  .record-grid {
    grid-template-columns: repeat(auto-fit,minmax(min(100%,190px),1fr));
  }
}

@media(max-width:440px) {
  .ticket-art {
    display: none;
  }
  .tile {
    flex-direction: column;
    min-height: 60px;
    gap: 5px;
    font-size: .83rem;
    word-break: keep-all;
  }
  .tile svg {
    width: 17px;
  }
  .types {
    gap: 7px;
  }
  .panel {
    border-radius: 12px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition: none!important;
  }
}

