:root {
  --bg: #0a0a1a;
  --surface: #13132a;
  --surface2: #1e1e3a;
  --gold: #c8a800;
  --gold-light: #f0cc00;
  --text: #f0f0f0;
  --text-dim: #888aaa;
  --green: #00e676;
  --red: #ff4444;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
}

/* ── Screens ────────────────────────────────── */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.screen.active {
  display: flex;
}

/* ── Home ─────────────────────────────────── */

.home-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px 24px;
  gap: 48px;
}

.logo {
  text-align: center;
}

.logo-icon {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(200,168,0,0.6));
}

.logo h1 {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--text);
  text-transform: uppercase;
}

.logo h1 span {
  color: var(--gold);
}

.tagline {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

/* ── Buttons ─────────────────────────────── */

.btn-primary, .btn-secondary, .btn-ghost {
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s, opacity 0.1s;
}

.btn-primary:active, .btn-secondary:active, .btn-ghost:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn-primary {
  background: var(--gold);
  color: #000;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-icon {
  font-size: 20px;
}

/* ── Analysing ───────────────────────────── */

.analysis-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
  gap: 32px;
}

.photo-preview-wrap {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--surface2);
  aspect-ratio: 4/3;
  background: var(--surface);
}

.photo-preview-wrap.small {
  max-width: 300px;
  max-height: 220px;
  aspect-ratio: auto;
}

.photo-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.analysis-status {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#status-text {
  color: var(--text-dim);
  font-size: 15px;
}

/* ── Confirm ─────────────────────────────── */

.confirm-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  gap: 16px;
  min-height: 100%;
}

.confirm-content h2 {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: -8px;
  text-align: center;
}

.form-section {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-section label {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.form-section input[type="text"],
.form-section input[type="number"] {
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 17px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

.form-section input:focus {
  border-color: var(--gold);
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.toggle-row label:first-child {
  font-size: 15px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

/* Toggle switch */
.toggle-wrap { position: relative; }

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  display: block;
  width: 52px;
  height: 30px;
  background: var(--surface);
  border-radius: 15px;
  cursor: pointer;
  position: relative;
  transition: background 0.25s;
  border: 1px solid rgba(255,255,255,0.1);
}

.toggle-label::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}

.toggle-input:checked + .toggle-label {
  background: var(--gold);
}

.toggle-input:checked + .toggle-label::after {
  transform: translateX(22px);
  background: #000;
}

.dog-number-row {
  margin-top: -8px;
}

.hidden {
  display: none !important;
}

/* Score preview */
.score-preview {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(135deg, var(--gold) 0%, #8a6800 100%);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(0,0,0,0.7);
}

.score-value {
  font-size: 52px;
  font-weight: 900;
  color: #000;
  line-height: 1;
}

.confirm-actions {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

/* ── Card screen ─────────────────────────── */

.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 24px;
  min-height: 100%;
}

#card-canvas {
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.card-actions {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
