:root {
  --guide-bg: #07070d;
  --guide-panel: rgba(255,255,255,0.04);
  --guide-border: rgba(255,255,255,0.12);
  --guide-text: #f5f5f8;
  --guide-muted: #9a9aa6;
}

.screen#screen-guide.active {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.guide-scroll {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  gap: 16px;
}

#guide-prep {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  padding-top: 8px;
}

.guide-intro {
  color: var(--guide-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.guide-config-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--guide-border);
  border-radius: 18px;
}

.guide-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.guide-config-field {
  display: grid;
  gap: 6px;
  color: var(--guide-muted);
  font-size: 12px;
}

.guide-config-field input,
.guide-config-field select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--guide-border);
  background: rgba(255,255,255,0.03);
  color: var(--guide-text);
  padding: 10px 12px;
}

.guide-panel {
  display: block;
  gap: 16px;
}

.guide-checklist {
  display: grid;
  gap: 12px;
}

.guide-checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--guide-panel);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--guide-text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.guide-checklist-item:hover {
  background: rgba(255,255,255,0.06);
}

.guide-checklist-item.checked {
  border-color: var(--accent);
  background: rgba(255, 186, 0, 0.12);
}

.guide-checkmark {
  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--guide-border);
  color: var(--accent);
  font-size: 14px;
}

#guide-ready-btn {
  margin-top: 20px;
}

#guide-ready-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.guide-status-row,
.guide-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.guide-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.guide-progress-card {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.guide-progress-text {
  color: var(--guide-muted);
  font-size: 12px;
}

.guide-progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.guide-progress-bar {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255,183,3,0.72), rgba(255,186,0,0.92));
  transition: width 0.25s ease;
}

.guide-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  animation: guideProgressSheen 1.2s linear infinite;
}

@keyframes guideProgressSheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.guide-metric {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--guide-text);
}

.guide-metric span {
  display: block;
  font-size: 12px;
  color: var(--guide-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  color: var(--guide-text);
}

.guide-apparatus-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-apparatus-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--guide-text);
}

.guide-guidance {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--guide-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--guide-text);
  margin-bottom: 16px;
}

.guide-ble-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--guide-border);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 18px;
}

.guide-ble-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.ble-status-text {
  color: var(--guide-muted);
  font-size: 0.95rem;
}

.ble-status-text.available {
  color: #38b000;
}

.ble-status-text.unavailable {
  color: #ffb703;
}

.ble-device-info,
.ble-weight-row {
  color: var(--guide-muted);
  font-size: 0.95rem;
}

.guide-ble-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ble-autofill-toggle {
  color: var(--guide-muted);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-countdown-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--guide-border);
  background: rgba(255, 255, 255, 0.05);
}

.guide-countdown-text {
  color: var(--guide-text);
  font-size: 0.95rem;
}

.guidance-prompt-text {
  font-weight: 700;
  font-size: 1rem;
}

.guidance-rate-text {
  color: var(--guide-muted);
  font-size: 0.95rem;
}

.guidance-ok {
  border-color: #38b000;
  background: rgba(56,176,0,0.08);
}

.guidance-slow {
  border-color: #ffb703;
  background: rgba(255,183,3,0.12);
}

.guidance-fast {
  border-color: #fb5607;
  background: rgba(251,86,7,0.12);
}

.guidance-missing {
  border-color: var(--guide-border);
  background: rgba(255,255,255,0.03);
}

.guide-svg-wrap {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--guide-border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

#guide-apparatus {
  width: min(100%, 260px);
  color: var(--guide-text);
}

#guide-apparatus svg {
  width: 100%;
  height: auto;
}

.guide-apparatus svg {
  max-width: 100%;
  height: auto;
}

.apparatus-water {
  transition: height 0.2s ease, y 0.2s ease;
}

.apparatus-ripple {
  transition: opacity 0.15s ease;
}

.guide-data-row {
  color: var(--guide-muted);
}

.guide-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  color: var(--guide-muted);
}

.guide-small-text {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 130px;
  text-align: center;
  color: var(--guide-text);
}

.guide-finish-feedback {
  color: var(--guide-text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.guide-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.guide-timer,
.guide-weight {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--guide-border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--guide-text);
  font-weight: 700;
  min-width: 80px;
  text-align: center;
}

.guide-svg-wrap {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--guide-border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

#v60-svg {
  max-width: 100%;
  height: auto;
  width: 220px;
}

.guide-cue {
  color: var(--guide-text);
  background: var(--guide-panel);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.cue-ok {
  border-color: #38b000;
  background: rgba(56,176,0,0.12);
  color: #d0f0c0;
}

.cue-slow {
  border-color: #ffb703;
  background: rgba(255,183,3,0.14);
  color: #ffe8a1;
}

.cue-fast {
  border-color: #fb5607;
  background: rgba(251,86,7,0.14);
  color: #ffd7c3;
}

#guide-abort-btn {
  margin-top: 12px;
}

#guide-done {
  display: none;
}

.guide-recipe-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.guide-recipe-pill {
  border: 1px solid var(--guide-border);
  background: rgba(255,255,255,0.04);
  color: var(--guide-text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
}

.guide-recipe-pill.selected {
  border-color: var(--accent);
  background: rgba(255,186,0,0.14);
}

.guide-recipe-summary {
  color: var(--guide-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
  min-height: 40px;
}

.brew-recommendation-section {
  margin-top: 8px;
}

.brew-recommendation {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
  color: #f5f5f8;
  font-size: 14px;
  line-height: 1.5;
}

#apply-recommendation-btn {
  margin-top: 10px;
}

.guide-done-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.15rem;
  color: var(--guide-text);
}

.guide-done-summary {
  color: var(--guide-muted);
  background: var(--guide-panel);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.guide-replay-hint,
.guide-hint {
  color: var(--guide-muted);
  font-size: 13px;
  margin-top: 0;
  margin-bottom: 12px;
}

.replay-meta {
  margin-bottom: 18px;
}

.replay-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--guide-text);
}

.replay-sub {
  color: var(--guide-muted);
  font-size: 13px;
  line-height: 1.4;
}

.replay-controls {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.replay-compare-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
}

.replay-compare-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.replay-compare-label,
.replay-speed-label {
  color: var(--guide-muted);
  font-size: 12px;
}

.replay-compare-value {
  color: var(--guide-text);
  font-weight: 700;
  margin-top: 4px;
}

.replay-overlay-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.replay-overlay-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.replay-overlay-bar-expected {
  background: rgba(255,183,3,0.35);
}

.replay-overlay-bar-actual {
  background: rgba(56,176,0,0.45);
}

.replay-scrub-wrap {
  display: grid;
  gap: 12px;
}

#replay-scrub {
  width: 100%;
}

.replay-step-actions,
.replay-speed-row,
.replay-speed-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.replay-speed-btn.active {
  border-color: var(--accent);
  background: rgba(255,186,0,0.14);
}

.brew-card-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.guide-placeholder {
  color: var(--guide-muted);
  background: var(--guide-panel);
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
}

@media (max-width: 520px) {
  .guide-ble-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .replay-compare-head {
    flex-direction: column;
  }
}
