:root {
  color-scheme: light;
  --ink: #111214;
  --muted: #71747b;
  --line: #d9dad6;
  --paper: #ffffff;
  --canvas: #f6f6f3;
  --blue: #114fec;
  --shadow: 0 24px 70px rgba(20, 21, 24, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: var(--canvas);
}

button,
img {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  font-weight: 750;
}

.brand img {
  width: 34px;
  height: 28px;
  object-fit: contain;
}

.receipt-view {
  padding-top: clamp(38px, 8vh, 72px);
}

.heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(17, 79, 236, 0.1);
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.receipt-time {
  min-width: 76px;
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: right;
}

.receipt-frame {
  min-height: 390px;
  padding: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(17, 18, 20, 0.12);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.receipt-frame img {
  width: 100%;
  height: auto;
  max-height: 72vh;
  max-height: 72svh;
  display: block;
  object-fit: contain;
  background: #fff;
}

#receiptImage[hidden] {
  display: none;
}

.state-panel {
  min-height: 340px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.state-panel[hidden] {
  display: none;
}

.state-panel p {
  margin: 0;
}

.loader {
  width: 24px;
  height: 24px;
  border: 1.5px solid #dadbd8;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: turn 0.85s linear infinite;
}

.empty-mark {
  width: 68px;
  height: 82px;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fafaf8;
}

.empty-mark span {
  width: 100%;
  height: 1px;
  background: #c9cac6;
}

.empty-mark span:last-child {
  width: 58%;
}

.state-title {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
}

.state-copy {
  max-width: 230px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.save-button {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(17, 18, 20, 0.14);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.save-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.save-button:not(:disabled):active {
  transform: scale(0.985);
}

.save-button:focus-visible {
  outline: 3px solid rgba(17, 79, 236, 0.3);
  outline-offset: 3px;
}

.save-button:disabled {
  cursor: default;
  opacity: 0.3;
}

.status-text {
  min-height: 19px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

footer {
  margin-top: auto;
  padding-top: 42px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  color: #90928f;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

footer strong {
  color: var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
}

@keyframes turn {
  to { transform: rotate(360deg); }
}

@media (min-width: 600px) {
  .page-shell {
    padding-inline: 28px;
  }

  .receipt-frame {
    min-height: 520px;
    padding: 20px;
  }
}

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