/* ============================================================
   Horrortainment Quiz — Player Styles
   Neon Grindhouse / TV Quiz Show aesthetic
   Mobile-first
   ============================================================ */

/* ------------------------------------------------------------
   Custom Properties
------------------------------------------------------------ */
:root {
  --black: #0a0a0a;
  --grey-900: #111111;
  --grey-800: #1a1a1a;
  --grey-700: #2a2a2a;
  --grey-600: #3a3a3a;
  --grey-400: #888888;
  --grey-200: #cccccc;
  --white: #ffffff;

  --red: #cc0000;
  --red-bright: #ff1a1a;
  --red-glow: rgba(204, 0, 0, 0.4);
  --green: #39ff14;
  --green-dark: #1a7a00;
  --green-glow: rgba(57, 255, 20, 0.3);
  --amber: #ff9500;
  --amber-glow: rgba(255, 149, 0, 0.3);
  --gold: #ffd700;

  --font-display: "Bebas Neue", sans-serif;
  --font-ui: "Barlow Condensed", sans-serif;
  --font-body: "Barlow", sans-serif;

  --radius: 6px;
  --radius-lg: 12px;
  --transition: 0.15s ease;

  --screen-pad: 20px;
  --max-width: 640px;
}

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

html,
body {
  height: 100%;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Film grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 9999;
}

/* ------------------------------------------------------------
   App Container
------------------------------------------------------------ */
#htq-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------
   Screens
------------------------------------------------------------ */
.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--screen-pad);
}

.screen--active {
  display: flex;
}

.screen-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 40px;
  padding-bottom: 40px;
}

/* ------------------------------------------------------------
   Loading Screen
------------------------------------------------------------ */
#screen-loading {
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.loading-inner {
  text-align: center;
}

.loading-skull {
  font-size: 64px;
  animation: pulse-skull 1.2s ease-in-out infinite;
}

.loading-text {
  font-family: var(--font-ui);
  font-size: 18px;
  color: var(--grey-400);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 16px;
}

@keyframes pulse-skull {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

/* ------------------------------------------------------------
   Intro Screen
------------------------------------------------------------ */
#screen-intro {
  background:
    radial-gradient(ellipse at top, #1a0000 0%, transparent 60%), var(--black);
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.difficulty-badge {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
}

.difficulty-badge[data-difficulty="easy"] {
  color: var(--green);
  border-color: var(--green);
  background: rgba(57, 255, 20, 0.08);
}

.difficulty-badge[data-difficulty="medium"] {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(255, 149, 0, 0.08);
}

.difficulty-badge[data-difficulty="hard"] {
  color: var(--red-bright);
  border-color: var(--red-bright);
  background: rgba(255, 26, 26, 0.08);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-400);
  background: var(--grey-800);
  border: 1px solid var(--grey-700);
  padding: 3px 8px;
  border-radius: var(--radius);
}

.quiz-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 8vw, 64px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--white);
  text-shadow:
    0 0 20px var(--red-glow),
    0 0 40px var(--red-glow);
}

.quiz-description {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--grey-400);
  line-height: 1.6;
}

.quiz-stats {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--grey-800);
  border-bottom: 1px solid var(--grey-800);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--white);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-400);
}

.attempt-warning {
  background: rgba(255, 149, 0, 0.1);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------
   Buttons
------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  padding: 14px 28px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn--primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 0 20px var(--red-glow);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--red-bright);
  box-shadow:
    0 0 30px var(--red-glow),
    0 0 60px var(--red-glow);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--grey-800);
  color: var(--white);
  border: 1px solid var(--grey-600);
}

.btn--secondary:hover {
  background: var(--grey-700);
  border-color: var(--grey-400);
}

.btn--ghost {
  background: transparent;
  color: var(--grey-400);
  border: 1px solid var(--grey-700);
}

.btn--ghost:hover {
  color: var(--white);
  border-color: var(--grey-400);
}

.btn--large {
  font-size: 20px;
  padding: 18px 40px;
  width: 100%;
}

/* ------------------------------------------------------------
   Question Screen
------------------------------------------------------------ */
#screen-question {
  background: radial-gradient(ellipse at bottom, #0d0d0d 0%, var(--black) 100%);
  justify-content: flex-start;
  overflow-y: auto;
}

#screen-question .screen-inner {
  padding-top: 20px;
  gap: 16px;
  justify-content: flex-start;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-progress {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--grey-400);
  letter-spacing: 0.05em;
}

.progress-sep {
  margin: 0 4px;
  color: var(--grey-600);
}

.question-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.score-label {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-400);
}

#q-score {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--gold);
  line-height: 1;
}

/* Timer */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--grey-800);
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--green);
  border-radius: 4px;
  transition:
    width 1s linear,
    background-color 0.5s ease;
  transform-origin: left;
}

.timer-bar--amber {
  background: var(--amber);
}
.timer-bar--red {
  background: var(--red-bright);
  box-shadow: 0 0 8px var(--red-glow);
}

.timer-number {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--white);
  min-width: 40px;
  text-align: right;
  transition: color 0.5s ease;
}

.timer-number--amber {
  color: var(--amber);
}
.timer-number--red {
  color: var(--red-bright);
}

/* Question text */
.question-body {
  background: var(--grey-900);
  border: 1px solid var(--grey-800);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 100px;
  display: flex;
  align-items: center;
}

.question-text {
  font-family: var(--font-ui);
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 600;
  line-height: 1.4;
  color: var(--white);
}

/* Answers */
.answers-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  background: var(--grey-800);
  border: 2px solid var(--grey-700);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  text-align: left;
  font-family: var(--font-ui);
  font-size: clamp(15px, 3.5vw, 18px);
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.3;
}

.answer-btn:hover,
.answer-btn:focus-visible {
  border-color: var(--red);
  background: var(--grey-700);
  box-shadow: 0 0 12px var(--red-glow);
  transform: translateX(2px);
}

.answer-btn:active {
  transform: translateX(0);
}

.answer-btn--correct {
  border-color: var(--green) !important;
  background: rgba(57, 255, 20, 0.1) !important;
  box-shadow: 0 0 16px var(--green-glow) !important;
  color: var(--green) !important;
  pointer-events: none;
}

.answer-btn--wrong {
  border-color: var(--red-bright) !important;
  background: rgba(255, 26, 26, 0.1) !important;
  box-shadow: 0 0 16px var(--red-glow) !important;
  color: var(--red-bright) !important;
  pointer-events: none;
  animation: shake 0.4s ease;
}

.answer-btn--disabled {
  pointer-events: none;
  opacity: 0.5;
}

.answer-letter {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--grey-400);
  min-width: 24px;
  transition: color var(--transition);
}

.answer-btn--correct .answer-letter {
  color: var(--green);
}
.answer-btn--wrong .answer-letter {
  color: var(--red-bright);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

/* ------------------------------------------------------------
   Feedback Screen
------------------------------------------------------------ */
#screen-feedback {
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.screen-inner--feedback {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 0;
}

.feedback-icon {
  font-size: 80px;
  animation: feedback-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes feedback-pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.feedback-label {
  font-family: var(--font-display);
  font-size: 42px;
  letter-spacing: 0.05em;
  margin-top: 12px;
}

.feedback-label--correct {
  color: var(--green);
}
.feedback-label--wrong {
  color: var(--red-bright);
}

.feedback-correct {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--grey-400);
  margin-top: 8px;
  max-width: 340px;
}

/* ------------------------------------------------------------
   Ad Break Screen
------------------------------------------------------------ */
#screen-adbreak {
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.screen-inner--adbreak {
  align-items: center;
  text-align: center;
  gap: 24px;
  padding-top: 0;
}

.adbreak-label {
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-400);
}

.adbreak-progress {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--grey-400);
}

/* ------------------------------------------------------------
   Results Screen
------------------------------------------------------------ */
#screen-results {
  background:
    radial-gradient(ellipse at top, #1a0000 0%, transparent 50%), var(--black);
}

.results-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--grey-800);
}

.results-performance-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-bright);
}

.results-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.results-score {
  font-family: var(--font-display);
  font-size: clamp(72px, 18vw, 120px);
  color: var(--white);
  line-height: 1;
  text-shadow: 0 0 40px var(--red-glow);
}

.results-score-sep {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--grey-600);
}

.results-score-total {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--grey-400);
}

.results-pct {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.results-breakdown {
  display: flex;
  gap: 32px;
  justify-content: center;
}

.breakdown-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.breakdown-value {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
}

.breakdown-value--correct {
  color: var(--green);
}
.breakdown-value--wrong {
  color: var(--red-bright);
}

.breakdown-label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-400);
}

.attempt-note {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--amber);
  text-align: center;
  letter-spacing: 0.05em;
}

/* Score submission */
.score-submit-wrap {
  background: var(--grey-900);
  border: 1px solid var(--grey-700);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-submit-label {
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--grey-200);
}

.score-submit-row {
  display: flex;
  gap: 10px;
}

.name-input {
  flex: 1;
  background: var(--grey-800);
  border: 2px solid var(--grey-600);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--white);
  outline: none;
  transition: border-color var(--transition);
}

.name-input:focus {
  border-color: var(--red);
}

.name-input::placeholder {
  color: var(--grey-600);
}

.name-error {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--red-bright);
}

.name-success {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--green);
}

.results-actions {
  display: flex;
  gap: 12px;
}

.results-actions .btn {
  flex: 1;
}

/* ------------------------------------------------------------
   Ad Slots (placeholders — Phase 7 fills these)
------------------------------------------------------------ */
.ad-slot {
  width: 100%;
  background: var(--grey-900);
  border: 1px dashed var(--grey-700);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-600);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ad-slot--intro {
  height: 100px;
  margin-top: 8px;
}
.ad-slot--midquiz {
  width: 100%;
  height: 120px;
}
.ad-slot--results {
  height: 120px;
}

/* .ad-slot::after {
  content: "Ad Placement";
} */

.btn--share-result {
  width: 100%;
  margin-top: 8px;
  font-size: 18px;
  padding: 20px;
  box-shadow:
    0 0 30px var(--red-glow),
    0 0 60px var(--red-glow);
  animation: pulse-share 2s ease-in-out infinite;
}

@keyframes pulse-share {
  0%,
  100% {
    box-shadow:
      0 0 30px var(--red-glow),
      0 0 60px var(--red-glow);
  }
  50% {
    box-shadow:
      0 0 50px var(--red-glow),
      0 0 100px var(--red-glow);
  }
}

#adbreak-countdown {
  font-size: 18px;
  font-family: var(--font-ui);
  letter-spacing: 0.05em;
  display: block;
  margin-top: 8px;
}

/* ------------------------------------------------------------
   Audio Toggle
------------------------------------------------------------ */
.audio-toggle {
  background: transparent;
  border: 1px solid var(--grey-700);
  border-radius: var(--radius);
  color: var(--white);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  transition:
    border-color var(--transition),
    opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.audio-toggle:hover {
  border-color: var(--grey-400);
}

.audio-toggle--off {
  opacity: 0.4;
}

/* ------------------------------------------------------------
   Desktop enhancements
------------------------------------------------------------ */
@media (min-width: 640px) {
  .screen {
    padding: 40px 24px;
  }

  .screen-inner {
    padding-top: 60px;
  }

  .answers-grid {
    gap: 12px;
  }

  .answer-btn {
    padding: 18px 24px;
  }

  .results-actions {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
  }

  .btn--large {
    width: auto;
    min-width: 240px;
    align-self: flex-start;
  }
}

.share-link {
  color: var(--red-bright);
  text-decoration: none;
  font-weight: 700;
}

.share-link:hover {
  color: var(--white);
}
