:root {
  --bg-primary: #1C1E21;
  --text-primary: #FFFFFF;
  --text-secondary: #E4E6EB;
  --text-muted: #B0B3B8;
  --accent: #00d4ff;
  --danger: #ff4466;
  --focus-ring: rgba(0, 212, 255, 0.55);

  --header-h: 64px;
  --footer-h: 56px;
  --safe-pad: 8px;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  padding: var(--safe-pad);
  box-sizing: border-box;
}

.screen {
  position: absolute;
  inset: var(--safe-pad);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}
.screen.hidden { display: none; }

.centered {
  margin: auto;
  text-align: center;
  padding: 24px;
  max-width: 520px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.loading-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  word-break: break-all;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--text-primary);
  font-size: 36px;
  font-weight: bold;
  line-height: 64px;
  margin: 0 auto 16px;
}
.error-message {
  font-size: 22px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.error-hint, .finished-hint {
  font-size: 14px;
  color: var(--text-muted);
}

.picker-header {
  padding: 16px 24px 12px;
}
.picker-title {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
}
.picker-hint {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.picker-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  scrollbar-width: none;
}
.picker-list::-webkit-scrollbar { display: none; }

.picker-item {
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  transition: background 200ms cubic-bezier(0.4, 0.04, 0.5, 1),
              border-color 200ms cubic-bezier(0.4, 0.04, 0.5, 1),
              transform 200ms cubic-bezier(0.6, 0, 0.4, 1);
  cursor: pointer;
}
.picker-item.focused {
  background: rgba(0, 212, 255, 0.12);
  border-color: var(--focus-ring);
  transform: translateX(4px);
}
.picker-item-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.picker-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stepper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  height: var(--header-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.step-counter {
  font-size: 16px;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.recipe-title {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 60%;
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stepper-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  overflow: hidden;
  min-height: 0;
}

.step-text {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  text-align: center;
  width: 100%;
  max-height: 100%;
  word-wrap: break-word;
  overflow: hidden;
}

.stepper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  height: var(--footer-h);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  gap: 12px;
}

.hint {
  font-size: 18px;
  color: var(--text-muted);
  min-width: 24px;
  text-align: center;
}
.hint.disabled { opacity: 0.2; }

.progress-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}
.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: background 200ms cubic-bezier(0.4, 0.04, 0.5, 1),
              transform 200ms cubic-bezier(0.4, 0.04, 0.5, 1);
}
.progress-dot.completed { background: var(--text-secondary); }
.progress-dot.active {
  background: var(--accent);
  transform: scale(1.5);
}

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

.page-pips {
  display: flex;
  gap: 4px;
  height: 4px;
  align-items: center;
}
.page-pip {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 200ms cubic-bezier(0.4, 0.04, 0.5, 1);
}
.page-pip.active { background: var(--accent); }

.finished-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 12px;
}
.finished-recipe {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

#step-measure {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  word-wrap: break-word;
  left: -9999px;
  top: -9999px;
}
