:root {
  --bg: #ffffff;
  --panel: #f7f7f8;
  --line: #e2e2e6;
  --text: #1a1a1e;
  --text-muted: #6b6d76;
  --accent: #c96a3a;
  --accent-dark: #a8562d;
  --green: #2e9e5b;
  --green-bg: #eaf7ef;
  --red: #c0392b;
  --red-bg: #fdecea;
  --radius: 10px;
  --mono: 'Consolas', 'SFMono-Regular', Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.rack {
  width: 100%;
  max-width: 460px;
}

.plate {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: 0 8px 30px -12px rgba(0,0,0,0.08);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0 0;
  letter-spacing: -0.01em;
}

.ch-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-dark);
  border: 1px solid #ecd3c4;
  background: #fdf3ec;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: var(--panel);
  display: block;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: #fdf6f1;
}

.dropzone input { display: none; }

.dropzone .icon {
  font-size: 22px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.dropzone .msg { font-size: 13px; color: var(--text-muted); }
.dropzone .filename {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  word-break: break-all;
}

button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

button.primary:disabled {
  background: #d8d8dc;
  color: #9a9aa2;
  cursor: not-allowed;
}

button.primary:not(:disabled):hover { background: var(--accent-dark); }
button.primary:not(:disabled):active { transform: scale(0.99); }

.meter-stage { display: none; }
.meter-stage.active { display: block; }

.segments {
  display: flex;
  gap: 6px;
  margin: 18px 0 10px;
}

.segment {
  flex: 1;
  height: 8px;
  border-radius: 3px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.segment.lit { background: var(--accent); }
.segment.lit.done { background: var(--green); }

.segment.pulsing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.5);
  animation: pulse 1.3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.stage-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stage-labels span.current { color: var(--accent-dark); font-weight: 700; }
.stage-labels span.current.done-label { color: var(--green); }

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.dot.done { background: var(--green); }
.dot.error { background: var(--red); }
.dot.blink { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

.timer {
  font-family: var(--mono);
  color: var(--text);
}

.error-box {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--red-bg);
  border: 1px solid #f3c9c3;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--red);
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.download-btn {
  display: none;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid #bfe6cd;
  background: var(--green-bg);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.download-btn:hover { background: #ddf2e3; }

.reset-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.reset-link:hover { color: var(--text); }

.banner {
  max-width: 460px;
  margin: 0 auto 14px;
  padding: 9px 16px;
  background: #fdf3ec;
  border: 1px solid #ecd3c4;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--accent-dark);
  text-align: center;
}

footer {
  text-align: center;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #b3b3ba;
  letter-spacing: 0.04em;
}
