:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #5a5a5a;
  --accent: #000000;
  --line: #000000;
  --pad: 16px;
  --mono: 'OCR B 10 BT', 'OCR-B 10 BT', 'PT Mono', 'Courier New', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  font-smooth: never;
  text-rendering: geometricPrecision;
}

body {
  min-height: 100vh;
  padding: 24px 14px 60px;
  display: flex;
  justify-content: center;
  letter-spacing: 0.02em;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.035) 0px,
    rgba(0, 0, 0, 0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  z-index: 1;
}

.terminal {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 4px 4px 0 var(--line);
}

.head .ascii,
.foot .ascii-foot {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.2;
  white-space: pre;
  overflow-x: auto;
}

.statusline {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  padding: 6px 0 14px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 16px;
}

.statusline .right {
  margin-left: auto;
  color: var(--muted);
}

.blink {
  display: inline-block;
  animation: blink 1s steps(2, end) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.block {
  margin: 14px 0;
}

.intro p,
.intro h1 {
  margin: 2px 0;
  font-size: 16px;
  font-weight: normal;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.intro .price {
  margin-top: 10px;
}

.intro .price b {
  border: 1px solid var(--line);
  padding: 1px 6px;
  font-weight: normal;
}

.art pre {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.15;
  white-space: pre;
  overflow-x: auto;
}

.gallery {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 2px;
}

.gallery.has-photos {
  display: flex;
}

.gallery .photo {
  margin: 0;
  border: 1px solid var(--line);
  padding: 4px;
  flex: 1 1 140px;
  min-width: 0;
  background: var(--bg);
}

.gallery .photo img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.art-preview {
  margin: 6px 0 2px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  background: var(--bg);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
}

.art-preview pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.15;
  white-space: pre;
  text-align: left;
}

.qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  font-family: var(--mono);
  font-size: 16px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1;
}

.qty-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

.qty-btn:active {
  transform: translate(1px, 1px);
}

.qty-ctrl input[type="number"] {
  width: 32px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--fg);
  background: transparent;
  border: none;
  padding: 4px 2px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.qty-ctrl input[type="number"]::-webkit-outer-spin-button,
.qty-ctrl input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-ctrl input[type="number"]:focus {
  background: transparent;
  color: var(--fg);
  text-decoration: underline;
}

.total {
  margin: 12px 0 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: 16px;
  display: inline-block;
}

.total b {
  font-weight: normal;
  padding: 0 2px;
}

.form {
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 16px 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.row label {
  min-width: 64px;
  color: var(--fg);
}

.row input[type="text"] {
  flex: 1;
  min-width: 200px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--fg);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 6px 4px;
  outline: none;
  caret-color: var(--fg);
}

.row input[type="text"]:focus {
  background: #000;
  color: #fff;
}

.row input[type="text"]::placeholder {
  color: var(--muted);
  font-style: normal;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.options legend {
  padding: 0 6px;
  background: var(--bg);
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.opt-row.active .opt-name {
  font-weight: bold;
}

.opt-name {
  flex: 1;
  min-width: 120px;
}

.hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 18px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.06s ease;
  margin-top: 6px;
}

.btn:hover {
  background: var(--fg);
  color: var(--bg);
}

.btn:active {
  transform: translate(1px, 1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.btn .bracket {
  font-weight: bold;
}

.status {
  min-height: 22px;
  margin-top: 10px;
  font-size: 14px;
}

.status.ok {
  color: #005f00;
  background: #eaffea;
  padding: 6px 8px;
  border: 1px solid #005f00;
}

.status.err {
  color: #7a0000;
  background: #ffecec;
  padding: 6px 8px;
  border: 1px solid #7a0000;
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.btn.secondary {
  font-size: 16px;
}

.foot {
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.foot .ascii-foot {
  font-size: 14px;
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

/* Mobile tweaks */
@media (max-width: 540px) {
  .head .ascii,
  .foot .ascii-foot {
    font-size: 11px;
  }
  .art pre {
    font-size: 11px;
  }
  .terminal {
    padding: 14px 12px;
    box-shadow: 3px 3px 0 var(--line);
  }
  .row label {
    min-width: 48px;
  }
}
