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

body {
  background-color: #141414;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', 'Courier New', monospace;
  padding: 40px 16px;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,220,0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(200,180,140,0.04) 0%, transparent 50%);
}

/* ── SCREENS ── */
.screen {
  display: none;
  width: 100%;
  max-width: 340px;
  animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
.screen.active { display: flex; flex-direction: column; align-items: center; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── ONBOARDING SCREEN 1 ── */
.ob-title {
  color: #f4ede0;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
  opacity: 0.5;
}
.ob-heading {
  color: #f4ede0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: 32px;
  line-height: 1.4;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 32px;
}

.opt-card {
  border: 1.5px dashed #3a3530;
  background: transparent;
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  width: 100%;
}
.opt-card:hover { border-color: #8a7a65; }
.opt-card.selected {
  border-color: #f4ede0;
  background: rgba(244,237,224,0.06);
}
.opt-card.selected .opt-check { opacity: 1; }

.opt-icon {
  font-size: 22px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.opt-label {
  color: #f4ede0;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
}
.opt-sub {
  color: #8a7a65;
  font-size: 9px;
  letter-spacing: 0.1em;
  margin-top: 3px;
}
.opt-check {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 1.5px solid #f4ede0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 10px;
  color: #f4ede0;
}

/* ── ONBOARDING SCREEN 2 ── */
.ob-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: #8a7a65;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 28px;
  padding: 0;
}
.ob-back:hover { color: #f4ede0; }

.input-section {
  width: 100%;
  margin-bottom: 24px;
}
.input-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8a7a65;
  margin-bottom: 10px;
  display: block;
}

/* Photo upload */
.photo-drop {
  border: 1.5px dashed #3a3530;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.photo-drop:hover, .photo-drop.dragover {
  border-color: #8a7a65;
  background: rgba(244,237,224,0.04);
}
.photo-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.photo-drop-icon { font-size: 24px; margin-bottom: 8px; }
.photo-drop-text {
  color: #8a7a65;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.photo-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: none;
  margin-top: 10px;
}
.photo-preview.visible { display: block; }

/* Music input */
.yt-input-wrap {
  position: relative;
}
.yt-input {
  width: 100%;
  background: transparent;
  border: 1.5px dashed #3a3530;
  color: #f4ede0;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
}
.yt-input::placeholder { color: #4a4035; }
.yt-input:focus { border-color: #8a7a65; }
.yt-input.error { border-color: #8b3a3a; }
.yt-error {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: #8b3a3a;
  margin-top: 6px;
  display: none;
  text-transform: uppercase;
}
.yt-error.visible { display: block; }
.yt-preview {
  margin-top: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
}
.yt-preview.visible { display: flex; }
.yt-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.yt-meta {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #8a7a65;
  text-transform: uppercase;
}
.yt-meta strong { color: #f4ede0; display: block; font-size: 11px; margin-bottom: 2px; }

/* ── CTA BUTTON ── */
.cta-btn {
  width: 100%;
  background: #f4ede0;
  border: none;
  color: #1a1612;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.cta-btn:hover { background: #fff8ee; }
.cta-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── RECEIPT SCREEN ── */
.receipt-wrap {
  width: 100%;
  max-width: 340px;
  position: relative;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.7)) drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}
.receipt-wrap::before {
  content: '';
  display: block;
  width: 100%;
  height: 18px;
  background:
    radial-gradient(circle at 50% 150%, #141414 60%, transparent 61%) -12px 0 / 24px 18px repeat-x,
    #f4ede0;
}
.receipt-wrap::after {
  content: '';
  display: block;
  width: 100%;
  height: 18px;
  background:
    radial-gradient(circle at 50% -50%, #141414 60%, transparent 61%) -12px 0 / 24px 18px repeat-x,
    #f4ede0;
}

.receipt {
  background: #f4ede0;
  padding: 28px 28px 24px;
  position: relative;
}
.receipt::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

.header { text-align: center; margin-bottom: 20px; }
.store-name {
  font-size: 22px; font-weight: 700;
  letter-spacing: 0.25em; color: #1a1612; text-transform: uppercase;
}
.store-sub {
  font-size: 9px; letter-spacing: 0.15em;
  color: #8a7a65; margin-top: 4px; text-transform: uppercase;
}
.divider {
  border: none; border-top: 1.5px dashed #c8b89a; margin: 14px 0;
}
.meta-row {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.05em;
  color: #5a4e3e; line-height: 1.7;
}
.mood-status {
  text-align: center; font-size: 16px; font-weight: 700;
  letter-spacing: 0.2em; color: #1a1612; padding: 6px 0;
}

/* Receipt photo section */
.receipt-photo {
  width: 100%;
  margin-bottom: 4px;
}
.receipt-photo img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
  filter: sepia(0.15) contrast(1.05);
}
.receipt-photo-label {
  font-size: 8.5px; letter-spacing: 0.18em;
  color: #9a8a72; text-transform: uppercase;
  margin-bottom: 6px;
}

/* Receipt music — Dynamic Island player */
.music-island {
  background: #111;
  border-radius: 20px;
  padding: 10px 12px 10px 10px;
  width: 100%;
}

.music-island-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.music-island-art {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.music-island-info {
  flex: 1;
  min-width: 0;
}

.music-island-title {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.music-island-artist {
  font-size: 9.5px;
  font-weight: 400;
  color: #888;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.music-island-waveform {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  flex-shrink: 0;
}

.music-island-waveform span {
  display: block;
  width: 2.5px;
  background: #555;
  border-radius: 1px;
  animation: wave 0.8s ease-in-out infinite alternate;
}

.music-island-waveform span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.music-island-waveform span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.music-island-waveform span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.music-island-waveform span:nth-child(4) { height: 16px; animation-delay: 0.05s; }
.music-island-waveform span:nth-child(5) { height: 8px;  animation-delay: 0.15s; }

.music-island.playing .music-island-waveform span { background: #fff; }

@keyframes wave {
  from { transform: scaleY(0.4); }
  to   { transform: scaleY(1); }
}

.music-island-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.music-island-time {
  font-size: 8px;
  color: #666;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 24px;
}

.music-island-bar {
  flex: 1;
  height: 3px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.music-island-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s linear;
}

.music-island-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.mi-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0.9;
}

.mi-btn:active { opacity: 0.5; }

.mi-btn svg { display: block; }

.music-island-iframe {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.items { margin: 4px 0; }
.item { margin-bottom: 14px; }
.item:last-child { margin-bottom: 0; }
.item-category {
  font-size: 8.5px; letter-spacing: 0.18em;
  color: #9a8a72; text-transform: uppercase; margin-bottom: 3px;
}
.item-title {
  font-size: 13px; font-weight: 700;
  color: #1a1612; letter-spacing: 0.03em; line-height: 1.3;
}
.item-detail {
  font-size: 11px; font-weight: 400;
  color: #5a4e3e; letter-spacing: 0.02em; margin-top: 1px;
}
.total-row {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; color: #1a1612; text-transform: uppercase;
}
.barcode-wrap { text-align: center; margin: 4px 0 8px; }
.barcode {
  display: inline-block; height: 52px; width: 100%; max-width: 240px;
  background-image: repeating-linear-gradient(
    90deg,
    #1a1612 0px,#1a1612 2px, transparent 2px,transparent 4px,
    #1a1612 4px,#1a1612 5px, transparent 5px,transparent 8px,
    #1a1612 8px,#1a1612 11px, transparent 11px,transparent 13px,
    #1a1612 13px,#1a1612 14px, transparent 14px,transparent 17px,
    #1a1612 17px,#1a1612 20px, transparent 20px,transparent 21px,
    #1a1612 21px,#1a1612 23px, transparent 23px,transparent 26px,
    #1a1612 26px,#1a1612 27px, transparent 27px,transparent 29px,
    #1a1612 29px,#1a1612 32px, transparent 32px,transparent 34px,
    #1a1612 34px,#1a1612 35px, transparent 35px,transparent 37px,
    #1a1612 37px,#1a1612 40px, transparent 40px,transparent 43px,
    #1a1612 43px,#1a1612 44px, transparent 44px,transparent 46px,
    #1a1612 46px,#1a1612 49px, transparent 49px,transparent 51px,
    #1a1612 51px,#1a1612 52px, transparent 52px,transparent 55px,
    #1a1612 55px,#1a1612 58px, transparent 58px,transparent 60px
  );
}
.barcode-num {
  font-size: 9px; letter-spacing: 0.2em; color: #5a4e3e; margin-top: 6px;
}
.footer { text-align: center; margin-top: 10px; }
.footer-main {
  font-size: 9px; letter-spacing: 0.15em;
  color: #3a3028; text-transform: uppercase; font-weight: 700;
}
.footer-sub {
  font-size: 8.5px; letter-spacing: 0.1em; color: #9a8a72; margin-top: 4px;
}

.receipt-restart {
  margin-top: 20px;
  background: none;
  border: 1.5px dashed #3a3530;
  color: #8a7a65;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 12px 24px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.receipt-restart:hover { color: #f4ede0; border-color: #8a7a65; }
