/* ─── CSS Variables (Material Design 3 – same colors as Android app) ─── */
:root {
  --primary:             #006E26;
  --on-primary:          #FFFFFF;
  --primary-container:   #96F99C;
  --secondary:           #526350;
  --background:          #FCFDF7;
  --on-background:       #1A1C19;
  --surface:             #FCFDF7;
  --on-surface:          #1A1C19;
  --surface-variant:     #DEE5D9;
  --on-surface-variant:  #424940;
  --outline:             #72796F;
  --outline-variant:     #C2C9BD;
  --error:               #BA1A1A;
  --shadow:              rgba(0,0,0,0.15);

  --radius-btn:   28px;
  --radius-card:  16px;
  --max-width:    520px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary:             #7ADB82;
    --on-primary:          #003910;
    --primary-container:   #00531B;
    --secondary:           #B9CCB5;
    --background:          #1A1C19;
    --on-background:       #E2E3DD;
    --surface:             #1A1C19;
    --on-surface:          #E2E3DD;
    --surface-variant:     #424940;
    --on-surface-variant:  #C2C9BD;
    --outline:             #8C9389;
    --outline-variant:     #424940;
    --shadow:              rgba(0,0,0,0.4);
  }
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', sans-serif;
  background-color: var(--background);
  color: var(--on-background);
}

/* ─── App Shell ─── */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 0;
}

/* ─── Screen container ─── */
.screen {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ─── App Header ─── */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 12px;
  gap: 8px;
}

.app-header img {
  width: clamp(56px, 18%, 90px);
  aspect-ratio: 1;
  object-fit: contain;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--on-surface);
  text-align: center;
}

/* ─── Volume chooser ─── */
.volume-chooser {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 0 0 60px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-btn);
  background-color: var(--primary);
  color: var(--on-primary);
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px var(--shadow);
  text-decoration: none;
}

.btn:hover  { opacity: 0.88; box-shadow: 0 4px 12px var(--shadow); }
.btn:active { opacity: 0.75; }

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  box-shadow: none;
}

/* ─── Volume screen ─── */
.volume-title {
  text-align: center;
  font-size: 16px;
  color: var(--on-surface-variant);
  padding: 8px 0 4px;
}

/* ─── Card ─── */
.card-wrap {
  flex: 1;
  padding: 8px 0;
  display: flex;
}

.card {
  flex: 1;
  background-color: var(--surface-variant);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 12px var(--shadow);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}

.card-text {
  font-size: 26px;
  line-height: 1.4;
  color: var(--on-surface);
  flex: 1;
  display: flex;
  align-items: center;
}

.card-viewed {
  font-size: 13px;
  color: var(--on-surface-variant);
  text-align: center;
  padding-top: 16px;
}

/* ─── Loading state ─── */
.loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Rate section ─── */
.rate-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}

.rate-label {
  font-size: 14px;
  color: var(--on-surface);
}

.rate-buttons {
  display: flex;
  width: 100%;
  gap: 16px;
}

.rate-btn {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

.rate-btn:hover  { background: var(--surface-variant); }
.rate-btn:active { transform: scale(0.9); }

.rate-btn svg {
  width: 36px;
  height: 36px;
  fill: var(--on-surface-variant);
  transition: fill 0.2s;
}

.rate-btn.active-up   svg { fill: var(--primary); }
.rate-btn.active-down svg { fill: var(--error); }

/* ─── Finish game ─── */
.finish-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 24px 0;
}

.finish-text {
  font-size: 36px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--on-surface);
}

/* ─── Next Tech Footer ─── */
nexttech-footer {
  display: block;
  margin-top: auto;
  align-self: stretch;
  background-color: var(--background);
  color: var(--on-background);
}

/* ─── Tablet / Desktop tweaks ─── */
@media (min-width: 600px) {
  .card-text { font-size: 28px; }
  .card      { padding: 32px 28px; min-height: 280px; }
  .btn       { font-size: 20px; padding: 16px 24px; }
  .finish-text { font-size: 40px; }
}

@media (min-width: 900px) {
  #app { justify-content: center; }
  .screen { min-height: auto; }
  .volume-chooser { padding-bottom: 0; }
  .card { min-height: 320px; }
}
