:root {
  --bg: #f4ecdd;
  --ink: #2b2b2b;
  --accent: #e7567a;
  --accent-2: #4a8fb0;
  --panel: #fffdf7;
  --line: #d8cdb5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Courier New", ui-monospace, monospace;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

header {
  text-align: center;
  padding: 18px 12px 6px;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 2px;
}

.tagline {
  margin: 4px 0 0;
  font-size: 0.8rem;
  opacity: 0.7;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 4px 4px 0 var(--ink);
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  border-bottom: 2px dashed var(--line);
  padding-bottom: 6px;
}

.panel h2 small { font-weight: normal; opacity: 0.6; }

/* ----- Viewfinder ----- */
.stage {
  position: relative;
  background: #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#video.live { display: block; }

.status {
  color: #cfc6b3;
  font-size: 0.8rem;
  text-align: center;
  padding: 0 16px;
  margin: 0;
}

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  text-shadow: 0 0 12px var(--accent);
}

/* ----- Controls ----- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

button, .file-btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

button:active, .file-btn:active { transform: translate(2px, 2px); box-shadow: none; }

button.primary { background: var(--accent); color: #fff; }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.file-btn { display: inline-block; }

.check { font-size: 0.82rem; display: flex; align-items: center; gap: 4px; }

/* ----- Sliders ----- */
.sliders {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sliders label {
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sliders output { float: right; opacity: 0.7; }

.sliders input[type="range"] { width: 100%; accent-color: var(--accent); }

select, input[type="text"] {
  font-family: inherit;
  padding: 6px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
}

/* ----- Receipt ----- */
.receipt-wrap {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: repeating-linear-gradient(45deg, #ece3cf, #ece3cf 8px, #e6dcc4 8px, #e6dcc4 16px);
  border-radius: 6px;
}

#receipt {
  background: #fffef9;
  padding: 10px 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

#receipt-canvas {
  display: block;
  width: 300px;
  max-width: 78vw;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.strip-count { font-size: 0.8rem; align-self: center; opacity: 0.75; }

.caption-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  margin-top: 10px;
}

.note {
  font-size: 0.72rem;
  opacity: 0.6;
  margin: 8px 0 0;
}

.hidden { display: none !important; }

/* ----- Print ----- */
@media print {
  body * { visibility: hidden; }
  #receipt, #receipt * { visibility: visible; }
  #receipt {
    position: absolute;
    left: 0;
    top: 0;
    padding: 0;
    box-shadow: none;
  }
  #receipt-canvas {
    width: 48mm;
    max-width: none;
  }
}
