/* 통근 영수증 - 편의점 감열지 영수증 컨셉. 라이트 테마 전용 (종이는 다크모드가 없다). */

:root {
  color-scheme: light;

  /* 색 토큰 */
  --bg: #E7E4DD;        /* 페이지 바탕 */
  --paper: #FBFAF6;     /* 영수증 종이 */
  --ink: #1C1B19;       /* 잉크 */
  --muted: #6B6862;     /* 보조 (종이 위) */
  --muted-bg: #56534C;  /* 보조 (회색 바탕 위, 글씨 대비 확보용으로 살짝 진하게) */
  --stamp: #D6402B;     /* 도장 빨강 - "낭비됨" 도장에만 */
  --dot: #B9B5AC;       /* 점선 */

  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --font-receipt: Galmuri11, "Apple SD Gothic Neo", "Malgun Gothic", monospace;

  --muted-soft: #77746D; /* 영수증 기준 설명(괄호 줄) */
  --leader: #CFCBC2;      /* 점선 채움 */

  /* 포스기 */
  --pos: #26272B;
  --key: #E6E3DC;
  --key-edge: #A39F94;
  --lcd-bg: #1D2620;
  --lcd-fg: #B8F27C;
  --led-on: #1FBF4F;
  --pos-text: #D7D5CE;
  --pos-sub: #A6A49D;
  --pos-w: 380px;
  --font-lcd: "DSEG7-Classic", ui-monospace, "SF Mono", monospace;

  --gutter: 16px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- 레이아웃 ---------- */

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 36px max(var(--gutter), env(safe-area-inset-right)) calc(44px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

.hero { text-align: center; margin-bottom: 24px; }
.hero__icon { display: block; margin: 0 auto 12px; width: 44px; height: 44px; }
.hero__title {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__lead {
  margin: 10px auto 0;
  max-width: 24em;
  font-size: 16px;
  color: var(--muted-bg);
}

.stack { display: flex; flex-direction: column; gap: 22px; }

/* 공유 링크로 들어온 사람은 영수증을 먼저 본다 */
.is-shared .result { order: -1; }

/* ---------- 입력: 편의점 포스기 ---------- */

.pos {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--pos-w);
  margin: 0 auto;
}

.pos__body {
  position: relative;
  padding: 16px 12px 46px;
  border-radius: 22px 22px 18px 18px;
  background-color: var(--pos);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 28%, rgba(0, 0, 0, 0.14));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 1px 0 0 rgba(255, 255, 255, 0.04),
    inset -1px 0 0 rgba(0, 0, 0, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 4px 0 #15161A,
    0 16px 26px rgba(28, 27, 25, 0.34);
}

.pos__brand {
  margin: 0 0 8px;
  text-align: center;
  text-indent: 0.42em;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.42em;
  color: #7B7D85;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7), 0 -1px 0 rgba(255, 255, 255, 0.06);
  user-select: none;
}
.pos__guide {
  margin: 0 0 12px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--pos-text);
}

/* 고객 표시창 (LCD): 표시 전용. 입력칸이 아니다 */
.lcd {
  margin-bottom: 22px;
  padding: 10px 14px 10px;
  border-radius: 10px;
  background: var(--lcd-bg);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.7), inset 0 0 0 2px #0F1411, 0 1px 0 rgba(255, 255, 255, 0.1);
}
.lcd__cap {
  font-family: Galmuri11, var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #86B25C;
}
.lcd__time {
  position: relative;
  text-align: right;
  font-family: var(--font-lcd);
  font-size: 52px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.lcd__ghost {
  position: absolute;
  top: 0; right: 0;
  color: var(--lcd-fg);
  opacity: 0.07; /* 꺼진 세그먼트 자국 */
}
.lcd__digits {
  position: relative;
  color: var(--lcd-fg);
  text-shadow: 0 0 10px rgba(184, 242, 124, 0.55), 0 0 2px rgba(184, 242, 124, 0.9);
}
.lcd__read {
  text-align: right;
  font-family: Galmuri11, var(--font-ui);
  font-size: 16.5px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--lcd-fg);
  text-shadow: 0 0 6px rgba(184, 242, 124, 0.4);
}
.lcd__line {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 242, 124, 0.14);
  font-family: Galmuri11, var(--font-ui);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--lcd-fg);
  text-shadow: 0 0 6px rgba(184, 242, 124, 0.4);
  word-break: keep-all;
}

.form { display: grid; gap: 26px; }

.field { margin: 0; padding: 0; border: 0; min-width: 0; }

/* 단계 번호 라벨 */
.step {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 11px;
  padding: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: #F6F4EE;
}
.step__no {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #F6F4EE;
  color: var(--pos);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
.step__sub { font-size: 14px; font-weight: 600; color: var(--pos-sub); }

.field__label {
  display: block;
  width: 100%;
  margin: 0 0 9px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #E9E7E0;
}
.field__opt { font-weight: 500; color: var(--pos-sub); letter-spacing: 0.02em; }
.field__hint { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--pos-sub); }
.field__error {
  margin: 10px 0 0;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  border-left: 4px solid var(--ink);
  border-radius: 2px;
  background: #F1EEE5;
  color: var(--ink);
}
.field__error::before { content: "※ "; }

/* 입력칸: 밝은 바탕 (여기에 넣는다는 것이 바로 보이게) */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding-right: 14px;
  border: 2px solid #8C8A83;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: inset 0 2px 3px rgba(28, 27, 25, 0.12), 0 1px 0 rgba(255, 255, 255, 0.12);
}
.input-wrap:focus-within { border-color: var(--lcd-fg); outline: 3px solid var(--lcd-fg); outline-offset: 2px; }
.input-wrap[aria-invalid="true"], .input-wrap.is-invalid { outline: 3px dashed #F3D36B; outline-offset: 2px; }

.input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 50px;
  padding: 0 4px 0 12px;
  border: 0;
  outline: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: right;
  caret-color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.input:placeholder-shown { font-size: 17px; font-weight: 500; }
.input::placeholder { color: #77746D; opacity: 1; }
.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap__unit { flex: none; margin-left: 6px; font-size: 16px; font-weight: 700; color: #4F4C46; }

.hm { display: flex; gap: 10px; }
.hm .input-wrap { flex: 1 1 0; min-width: 0; }

/* 시도 선택 (네이티브 select 를 그대로 쓰되 포스기 톤으로) */
.select {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 0 44px 0 14px;
  border: 2px solid #8C8A83;
  border-radius: 10px;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M2 2l6 6 6-6' fill='none' stroke='%231C1B19' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 10px;
  box-shadow: inset 0 2px 3px rgba(28, 27, 25, 0.12), 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.select:focus-visible { border-color: var(--lcd-fg); outline: 3px solid var(--lcd-fg); outline-offset: 2px; }

/* 물리 키 (버튼, 라디오 공통) */
.key,
.ptoggle__key,
.seg__item span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 4px 2px;
  border: 0;
  border-radius: 9px;
  background: var(--key);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 var(--key-edge), 0 7px 8px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.06s, box-shadow 0.06s, background-color 0.06s;
}
.key:active,
.ptoggle:active .ptoggle__key,
.seg__item:active span {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--key-edge), 0 2px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.key:focus-visible { outline: 3px solid #F5F3EC; outline-offset: 3px; }

/* 세그먼트 = 키 묶음. 선택된 키는 어둡게 반전되고 흰 글씨 + 체크가 붙는다 (LED 는 보조) */
.seg { display: grid; gap: 12px 8px; padding-bottom: 4px; }
.seg--2 { grid-template-columns: repeat(2, 1fr); }
.seg--7 { grid-template-columns: repeat(7, 1fr); gap: 12px 4px; }
.seg__item { position: relative; display: block; margin: 0; }
.seg__item input {
  position: absolute; inset: 0; z-index: 1; /* 투명한 라디오가 키 위에 덮여 눌림을 그대로 받는다 */
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.seg__item span::before,
.ptoggle__key::before {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #B4B0A5;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
}
.seg__item input:checked + span,
.ptoggle input:checked + .ptoggle__key {
  transform: translateY(3px);
  background: #0E0F12;
  color: #FFFFFF;
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--lcd-fg), 0 1px 0 2px #4A6B2A, inset 0 2px 5px rgba(0, 0, 0, 0.6);
}
.seg__item input:checked + span::before,
.ptoggle input:checked + .ptoggle__key::before {
  background: var(--lcd-fg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 0 8px 2px rgba(184, 242, 124, 0.8);
}
.seg__item input:checked + span::after,
.ptoggle input:checked + .ptoggle__key::after {
  content: "";
  position: absolute;
  top: 8px; left: 9px;
  width: 5px; height: 9px;
  border: solid var(--lcd-fg);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.seg__item input:focus-visible + span,
.ptoggle input:focus-visible + .ptoggle__key { outline: 3px solid #F5F3EC; outline-offset: 3px; }

/* -5분 / +5분 키 */
.tkeys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; padding-bottom: 4px; }
.key--step { font-size: 18px; letter-spacing: 0.02em; }

/* 자세히 설정 (접이식) */
.more {
  border: 1.5px solid #4C4E55;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.more__sum {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  list-style: none;
  cursor: pointer;
  border-radius: 12px;
}
.more__sum::-webkit-details-marker { display: none; }
.more__sum::after { content: "+"; content: "+" / ""; flex: none; margin-left: auto; font-size: 24px; font-weight: 500; line-height: 1; color: #F6F4EE; }
.more[open] > .more__sum::after { content: "-"; content: "-" / ""; }
.more__sum:focus-visible { outline: 3px solid #F5F3EC; outline-offset: 3px; }
.more__t { flex: none; font-size: 16px; font-weight: 800; color: #F6F4EE; }
.more__v { min-width: 0; font-size: 13px; line-height: 1.4; color: var(--pos-sub); }
.more__body { display: grid; gap: 20px; padding: 6px 14px 16px; }

/* 결제 키: 크게 한 줄 */
.key--pay {
  width: 100%;
  min-height: 72px;
  margin-top: 2px;
  padding: 8px 8px 4px;
  border-radius: 13px;
  background: var(--stamp);
  color: var(--paper);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 0 #8B2314, 0 10px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.key--pay:active { box-shadow: 0 2px 0 #8B2314, 0 3px 4px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); transform: translateY(4px); }

/* 프린터 출력구: 영수증이 이 틈에서 나온다 */
.pos__slot {
  position: absolute;
  left: 4px; right: 4px; bottom: 6px;
  height: 14px;
  border-radius: 7px;
  background: #0B0C0E;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, background-color 0.15s;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--line { background: var(--paper); color: var(--ink); }
.btn--xl { width: 100%; min-height: 56px; font-size: 18px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: progress; }
@media (hover: hover) {
  .btn--primary:hover:not([disabled]):not([aria-disabled="true"]) { background: #34322E; }
  .btn--line:hover:not([disabled]):not([aria-disabled="true"]) { background: #F1EEE5; }
}

/* ---------- 결과 + 프린터 ---------- */

.result {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--pos-w);
  margin: calc(-13px - 22px) auto 0; /* 포스기 출력구 가운데에서 종이가 시작된다 (stack gap 22px 포함) */
  scroll-margin-top: 16px;
}
.result:focus { outline: none; }
.is-shared .result { margin-top: 0; }

/* 검은 바는 공유 링크로 들어와 영수증이 포스기 위에 올라오는 경우에만 쓴다 */
.printer {
  display: none;
  position: absolute;
  top: 0; left: 50%;
  z-index: 3;
  width: calc(100% - 8px);
  height: 12px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: var(--ink);
  box-shadow: 0 3px 6px rgba(28, 27, 25, 0.28), inset 0 -2px 0 rgba(251, 250, 246, 0.14);
}
.is-shared .printer { display: block; }

.paper-window {
  position: relative;
  padding: 0 0 10px;
}
.is-shared .paper-window { padding-top: 12px; }

.sheet { position: relative; }

.receipt {
  position: relative;
  width: calc(100% - 16px);
  max-width: calc(var(--pos-w) - 16px);
  margin: 0 auto;
  color: var(--ink);
  font-family: var(--font-receipt);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: 0.04em; /* 도트 글꼴은 살짝 벌어져야 잘 읽힌다 */
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-synthesis: none;
  filter: drop-shadow(0 1px 0 rgba(28, 27, 25, 0.08)) drop-shadow(0 10px 14px rgba(28, 27, 25, 0.16));
}

/* 톱니 절취선 (투명 배경 위 종이색 삼각형) */
.tear {
  height: 8px;
  background-repeat: round no-repeat;
  background-size: 16px 8px;
}
.tear--top {
  margin-bottom: -1px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='8' viewBox='0 0 16 8'%3E%3Cpath d='M0 8L8 0L16 8Z' fill='%23FBFAF6'/%3E%3C/svg%3E");
}
.tear--bottom {
  margin-top: -1px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='8' viewBox='0 0 16 8'%3E%3Cpath d='M0 0L8 8L16 0Z' fill='%23FBFAF6'/%3E%3C/svg%3E");
}

.receipt__body {
  padding: 8px 20px 18px;
  background: var(--paper);
}

.r-title {
  margin: 10px 0 2px;
  text-align: center;
  font-size: 33px; /* 11px x 3: 픽셀이 정수배로 맞아 또렷하다 */
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.r-sub { text-align: center; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }

.r-dash {
  height: 2px;
  margin: 24px 0; /* 묶음 사이 여백을 넓게 */
  background: repeating-linear-gradient(90deg, var(--dot) 0 7px, transparent 7px 12px);
}

.r-row { display: flex; align-items: flex-end; gap: 6px; margin: 4px 0; }
.r-row__k { flex: none; }
.r-row__lead {
  flex: 1 1 auto;
  min-width: 10px;
  height: 2px;
  margin-bottom: 0.5em;
  background: repeating-linear-gradient(90deg, var(--leader) 0 2px, transparent 2px 8px); /* 연하고 성긴 점선 */
}
.r-row__v { flex: none; text-align: right; }
/* 합계 줄: "(1년)" 은 라벨 아래 작은 글씨로 두고, 값이 길어 한 줄에 안 들어가면 값이 아랫줄 오른쪽으로 내려간다 */
.r-unit { font-size: 12px; line-height: 1.2; color: var(--muted); }
.r-row--total { align-items: center; flex-wrap: wrap; }
.r-row--total .r-row__k { display: flex; flex-direction: column; line-height: 1.25; }
.r-row--total .r-row__lead { margin-bottom: 0; }
.r-row--total .r-row__v { margin-left: auto; }
.r-row--total { margin: 10px 0; font-size: 22px; font-weight: 400; letter-spacing: 0.03em; } /* 강조는 굵기 대신 크기(11px x 2) */
.r-note { margin: 0 0 10px; font-size: 11px; line-height: 1.7; letter-spacing: 0.05em; color: var(--muted-soft); }
.r-head { margin: 0 0 8px; font-size: 11px; line-height: 1.6; letter-spacing: 0.24em; color: var(--muted-soft); }
.r-plain { margin: 2px 0 6px; }
.r-note + .r-row { margin-top: 12px; }

.r-rank { margin: 4px 0 2px; text-align: center; }
.r-rank__sub { margin-top: 10px; font-size: 16px; line-height: 1.7; }
.r-rank__main {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.9;
  padding: 1px 8px;
  background: var(--ink); /* 강조는 굵기 대신 역상 */
  color: var(--paper);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.r-avg { margin-top: 14px; text-align: center; font-size: 18px; font-weight: 400; }
.r-avg + .r-note { margin: 2px 0 0; text-align: center; }
.r-empty { margin: 6px 0; text-align: center; font-size: 16px; line-height: 1.9; }

.r-tail { position: relative; }
.r-bar { display: flex; align-items: center; margin-top: 10px; min-height: 92px; }
.r-bar__code { flex: 0 0 56%; max-width: 200px; }
.barcode { display: block; width: 100%; height: 48px; color: var(--ink); }
.r-bar__num { margin-top: 4px; text-align: center; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }

.stamp {
  position: absolute;
  right: 0; bottom: 26px;
  padding: 3px 10px 4px;
  border: 3px solid var(--stamp);
  border-radius: 6px;
  color: var(--stamp);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.08em;
  -webkit-text-stroke: 0.6px var(--stamp); /* 획을 살짝 두껍게 (글꼴 굵기는 쓰지 않는다) */
  white-space: nowrap;
  opacity: 0.92;
  transform: rotate(-11deg);
  box-shadow: inset 0 0 0 1.5px var(--stamp);
  pointer-events: none;
}

.r-thanks { margin-top: 12px; text-align: center; font-size: 12px; line-height: 1.7; letter-spacing: 0.05em; color: var(--muted); }

/* 인쇄 애니메이션: 프린터 입구에서 위 -> 아래로 한 줄씩 찍혀 내려온다 (감열지 프린터처럼 끊어서 전진) */
.result.is-printing .receipt { animation: receipt-print 0.9s steps(30, end) both; }
.result.is-printing .stamp { animation: stamp-hit 0.34s 0.95s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.result.is-printing .opt,
.result.is-printing .actions,
.result.is-printing .cta { animation: fade-in 0.3s 0.9s ease-out both; }

/* 위·좌우는 그림자 여유를 두고, 아래쪽 경계만 움직인다 */
@keyframes receipt-print {
  from { clip-path: inset(-30px -60px 100% -60px); }
  to { clip-path: inset(-30px -60px -80px -60px); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes stamp-hit {
  from { opacity: 0; transform: rotate(-11deg) scale(1.8); }
  to { opacity: 0.92; transform: rotate(-11deg) scale(1); }
}

/* 액션 줄 */
.actions { display: flex; flex-wrap: wrap; gap: 10px; max-width: 380px; margin: 10px auto 0; }
.actions .btn { flex: 1 1 calc(50% - 5px); }
.cta { display: flex; max-width: 380px; margin: 12px auto 0; }

/* 이미지에 금액 넣기: 포스기 키 스타일 토글 (연봉을 넣었을 때만 보인다) */
.opt {
  max-width: 380px;
  margin: 12px auto 0;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background-color: var(--pos);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 40%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 3px 0 #15161A, 0 8px 14px rgba(28, 27, 25, 0.25);
}
.ptoggle { position: relative; display: block; }
.ptoggle input {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.ptoggle__key { padding-right: 20px; }
.opt__note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--pos-text); }
.opt__note:not(:empty) { margin-top: 12px; }

/* ---------- 출처 ---------- */

.sources__box { border: 1.5px dashed var(--dot); border-radius: 16px; }
.sources__sum {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 16px;
}
.sources__sum::-webkit-details-marker { display: none; }
.sources__sum::after { content: "+"; content: "+" / ""; font-size: 22px; font-weight: 500; line-height: 1; }
.sources__box[open] > .sources__sum::after { content: "-"; content: "-" / ""; }
.sources__sum:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.sources__body { padding: 2px 16px 18px; font-size: 13.5px; line-height: 1.65; }
.sources__body h3 { margin: 14px 0 6px; font-size: 14px; font-weight: 700; }
.sources__body ul { margin: 0; padding-left: 18px; }
.sources__body li { margin-bottom: 6px; }
.sources__body a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.sources__body a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.sources__note { margin: 12px 0 0; font-weight: 600; }

/* ---------- 푸터 · 토스트 ---------- */

.foot { margin-top: 30px; text-align: center; font-size: 13px; color: var(--muted-bg); }
.foot a { display: inline-block; min-height: 44px; line-height: 44px; padding: 0 6px; color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.foot a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

.toast {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.viewer {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: var(--ink);
}
.viewer__msg { flex: none; margin: 0 0 12px; color: var(--paper); font-size: 17px; font-weight: 700; text-align: center; }
.viewer__scroll { flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; text-align: center; }
.viewer__img { display: inline-block; max-width: 100%; height: auto; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.viewer__close { flex: none; width: 100%; max-width: 380px; margin-top: 12px; }

.noscript { margin: 0; padding: 16px; text-align: center; font-weight: 600; }

@media (max-width: 380px) {
  :root { --gutter: 12px; }
  .hero__title { font-size: 29px; }
  .receipt__body { padding-left: 16px; padding-right: 16px; }
}

/* 키 44px 이상을 지키려고 좁은 폰에서는 요일 키를 4 + 3 으로 접는다 */
@media (max-width: 389px) {
  .seg--7 { grid-template-columns: repeat(4, 1fr); gap: 12px 8px; }
  .lcd__time { font-size: 46px; }
  .r-row--total { font-size: 20px; } /* 합계 줄이 한 줄에 들어오게 */
}

@media (prefers-reduced-motion: reduce) {
  .result.is-printing .receipt,
  .result.is-printing .stamp,
  .result.is-printing .opt,
  .result.is-printing .actions,
  .result.is-printing .cta { animation: none; }
  .btn, .key, .seg__item span, .toast { transition: none; }
}
