/* Quizer Host Remote PWA — Material Design 3 + Mobile App UI Redesign */

:root {
  --md-sys-color-surface: var(--bg, #fef8f1);
  --md-sys-color-surface-container-low: var(--bg-soft, #fff4e8);
  --md-sys-color-surface-container: var(--surface, #ffffff);
  --md-sys-color-surface-container-high: var(--surface-2, #fdf4ea);
  --md-sys-color-on-surface: var(--text-1, #2a2340);
  --md-sys-color-on-surface-variant: var(--text-2, #5b5470);
  --md-sys-color-primary: var(--accent, #f48b5c);
  --md-sys-color-on-primary: var(--accent-ink, #ffffff);
  --md-sys-color-secondary: var(--accent-2, #7b5dc4);
  --md-sys-color-outline: var(--border, rgba(42, 35, 64, 0.14));
  --md-sys-color-good: var(--good, #2e9d70);
  --md-sys-color-bad: var(--bad, #c94673);

  --md-shape-md: 16px;
  --md-shape-lg: 24px;
  --md-shape-xl: 28px;
  --md-shape-full: 9999px;
  --md-spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  overscroll-behavior: none;
  overscroll-behavior-y: contain;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-sans, 'Inter', sans-serif);
  transition: background 0.35s ease, color 0.25s ease;
}

.pwa-shell {
  max-width: 540px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* MD3 Install Bar */
.md3-install-bar {
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  border-radius: var(--md-shape-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.md3-install-copy { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.md3-install-copy span { opacity: 0.82; font-size: 12px; }
.md3-install-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.md3-tonal-btn {
  border: none; border-radius: var(--md-shape-full); padding: 8px 16px;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font-weight: 800; font-size: 13px; cursor: pointer;
}
.md3-icon-close { border: none; background: transparent; color: inherit; font-size: 16px; opacity: 0.75; cursor: pointer; }

/* MD3 App Bar & Chips */
.md3-appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.md3-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--md-shape-full);
  background: var(--md-sys-color-surface-container);
  border: 1.5px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface);
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.md3-chip-btn { cursor: pointer; }

/* MD3 Cards */
.md3-card {
  background: var(--md-sys-color-surface-container);
  border: var(--card-border, 1.5px solid var(--md-sys-color-outline));
  border-radius: var(--card-radius, var(--md-shape-xl));
  padding: 18px;
  box-shadow: var(--card-shadow, 0 6px 20px rgba(0, 0, 0, 0.05));
}

.md3-secret-card {
  background: #231c38;
  color: #fef8f1;
  border-radius: var(--md-shape-xl);
  padding: 18px 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
}

.md3-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--md-sys-color-primary); margin-bottom: 4px;
}
.md3-title {
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: 22px; font-weight: 900; margin: 0; line-height: 1.15;
}
.timer-big {
  font-size: 34px; font-weight: 900; color: var(--md-sys-color-primary); font-variant-numeric: tabular-nums;
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* MD3 Buttons */
.md3-btn {
  border: none;
  border-radius: var(--md-shape-full);
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: 1.5px solid var(--md-sys-color-outline);
  transition: transform 0.16s var(--md-spring);
}
.md3-btn:active { transform: scale(0.96); }
.md3-btn-filled {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
  border: none;
  background: var(--grad, var(--md-sys-color-primary));
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(201, 70, 115, 0.25);
}
.md3-btn-good { background: var(--md-sys-color-good); color: #ffffff; border-color: transparent; }
.md3-btn-bad { background: var(--md-sys-color-bad); color: #ffffff; border-color: transparent; }
.md3-btn-sm { padding: 8px 13px; font-size: 13px; }

.md3-field {
  padding: 11px 14px;
  border-radius: var(--md-shape-md);
  border: 2px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
}

.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--md-sys-color-outline); flex-shrink: 0; }

/* Thumb-Zone Sticky Primary Action */
.thumb-zone-sticky {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  padding-top: 6px;
}

/* PIN Overlay */
.pin-overlay {
  position: fixed; inset: 0; background: rgba(24, 18, 40, 0.9); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.pin-card {
  background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface);
  border-radius: var(--md-shape-xl); padding: 28px 24px; width: 100%; max-width: 360px; text-align: center;
}
