/* PolySoCal Trivia — Frontend Styles */

/* Color palette pulled from PolySoCal brand */
:root {
  --pst-primary:       #7b3f6e;
  --pst-primary-dark:  #5e2e54;
  --pst-primary-light: #f5edf3;
  --pst-border:        #e0cedd;
  --pst-text:          #2a2a2a;
  --pst-text-muted:    #666666;
  --pst-correct:       #2d6a4f;
  --pst-wrong:         #7b1d1d;
  --pst-gold:          #c9a84c;
  --pst-card-bg:       #fdf8fc;
  --pst-bar-track:     #e8d5e4;
}

#pst-game-wrap {
  font-family: Arial, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  color: var(--pst-text);
}

/* ---- SCREENS ---- */
.pst-screen { display: none; }
.pst-screen.active { display: block; }

/* ---- LOGO ---- */
.pst-logo {
  display: block;
  max-width: 140px;
  margin: 0 auto 16px;
}

.pst-logo-sm {
  display: block;
  max-width: 80px;
  margin: 0 auto 12px;
}

/* ---- TOPIC SELECTION ---- */
#pst-topic-screen h2 {
  font-family: Georgia, serif;
  font-size: 1.6em;
  color: var(--pst-primary);
  text-align: center;
  margin-bottom: 6px;
}

#pst-topic-screen p.pst-sub {
  text-align: center;
  color: var(--pst-text-muted);
  margin-bottom: 24px;
  font-size: 0.95em;
}

.pst-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.pst-topic-card {
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-border);
  border-radius: 8px;
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.pst-topic-card:hover {
  border-color: var(--pst-primary);
  box-shadow: 0 2px 8px rgba(123,63,110,0.15);
}

.pst-topic-card h3 {
  font-family: Georgia, serif;
  font-size: 1.05em;
  color: var(--pst-primary);
  margin: 0 0 6px;
}

.pst-topic-card p {
  font-size: 0.82em;
  color: var(--pst-text-muted);
  margin: 0;
}

/* ---- GAME SCREEN ---- */
#pst-game-screen {
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-border);
  border-radius: 8px;
  padding: 28px 24px;
}

.pst-progress-bar-wrap {
  height: 6px;
  background: var(--pst-bar-track);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}

.pst-progress-bar-fill {
  height: 100%;
  background: var(--pst-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.pst-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-size: 0.85em;
  color: var(--pst-text-muted);
}

.pst-score-display {
  font-weight: bold;
  color: var(--pst-primary);
  font-size: 1em;
}

.pst-timer-wrap {
  position: relative;
  width: 48px;
  height: 48px;
}

.pst-timer-svg {
  transform: rotate(-90deg);
}

.pst-timer-track {
  fill: none;
  stroke: var(--pst-bar-track);
  stroke-width: 4;
}

.pst-timer-fill {
  fill: none;
  stroke: var(--pst-primary);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 126;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.pst-timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85em;
  font-weight: bold;
  color: var(--pst-primary);
}

.pst-q-counter {
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pst-text-muted);
}

.pst-question {
  font-family: Georgia, serif;
  font-size: 1.45em;
  line-height: 1.5;
  margin: 0 0 24px;
  color: var(--pst-text);
  text-align: center;
}

.pst-answers {
  display: grid;
  gap: 10px;
}

.pst-answer-btn {
  width: 100%;
  padding: 14px 18px;
  background: white;
  border: 2px solid var(--pst-border);
  border-radius: 6px;
  font-size: 1em;
  font-family: Arial, sans-serif;
  color: var(--pst-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.4;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.pst-answer-btn:hover:not(.locked) {
  border-color: var(--pst-primary);
  background: var(--pst-primary-light);
}

.pst-answer-btn.locked {
  cursor: default;
  pointer-events: none;
}

.pst-answer-btn.correct {
  background: #d4edda;
  border-color: var(--pst-correct);
  color: var(--pst-correct);
  font-weight: bold;
}

.pst-answer-btn.wrong {
  background: #f8d7da;
  border-color: var(--pst-wrong);
  color: var(--pst-wrong);
  font-weight: bold;
}

.pst-answer-btn.dimmed {
  opacity: 0.45;
}

.pst-result-msg {
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1em;
  text-align: center;
  display: none;
}

.pst-result-msg.correct {
  background: #d4edda;
  color: var(--pst-correct);
  display: block;
}

.pst-result-msg.wrong {
  background: #f8d7da;
  color: var(--pst-wrong);
  display: block;
}

.pst-result-msg.timeout {
  background: #fff3cd;
  color: #856404;
  display: block;
}

.pst-next-btn {
  display: none;
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  background: var(--pst-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}

.pst-next-btn:hover {
  background: var(--pst-primary-dark);
}

/* ---- RESULT SCREEN ---- */
#pst-result-screen {
  text-align: center;
}

.pst-certificate {
  background: var(--pst-card-bg);
  border: 3px solid var(--pst-primary);
  border-radius: 12px;
  padding: 36px 28px;
  position: relative;
  overflow: hidden;
}

.pst-certificate::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--pst-border);
  border-radius: 8px;
  pointer-events: none;
}

.pst-cert-topic {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pst-text-muted);
  margin-bottom: 8px;
}

.pst-cert-title {
  font-family: Georgia, serif;
  font-size: 2em;
  color: var(--pst-primary);
  margin: 0 0 6px;
  line-height: 1.2;
}

.pst-cert-title.sex-god {
  color: var(--pst-gold);
  font-size: 2.4em;
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
}

.pst-cert-score {
  font-size: 3.2em;
  font-weight: bold;
  color: var(--pst-primary);
  line-height: 1;
  margin: 12px 0 4px;
}

.pst-cert-score.sex-god {
  color: var(--pst-gold);
}

.pst-cert-score-label {
  font-size: 0.82em;
  color: var(--pst-text-muted);
  margin-bottom: 16px;
}

.pst-cert-flavor {
  font-style: italic;
  color: var(--pst-text-muted);
  font-size: 0.95em;
  margin: 0 0 20px;
  line-height: 1.5;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.pst-cert-breakdown {
  display: flex;
  justify-content: center;
  gap: 28px;
  font-size: 0.85em;
  color: var(--pst-text-muted);
  margin-bottom: 24px;
}

.pst-cert-breakdown span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pst-cert-breakdown strong {
  font-size: 1.4em;
  color: var(--pst-text);
}

.pst-cert-date {
  font-size: 0.75em;
  color: var(--pst-text-muted);
  margin-top: 16px;
}

/* Share section */
.pst-share-section {
  margin-top: 24px;
}

.pst-share-section p {
  font-size: 0.85em;
  color: var(--pst-text-muted);
  margin-bottom: 10px;
}

.pst-share-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.pst-share-link-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--pst-border);
  border-radius: 6px;
  font-size: 0.82em;
  color: var(--pst-text-muted);
  background: white;
  cursor: text;
}

.pst-copy-btn {
  padding: 10px 16px;
  background: transparent;
  color: var(--pst-primary);
  border: 2px solid var(--pst-primary);
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.pst-copy-btn:hover {
  background: var(--pst-primary-light);
}

.pst-copy-btn.copied {
  background: var(--pst-correct);
  border-color: var(--pst-correct);
  color: white;
}

.pst-share-email-btn {
  display: inline-block;
  padding: 10px 20px;
  background: transparent;
  color: var(--pst-primary);
  border: 2px solid var(--pst-primary);
  border-radius: 6px;
  font-size: 0.9em;
  text-decoration: none;
  cursor: pointer;
  margin-right: 8px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.pst-share-email-btn:hover {
  background: var(--pst-primary-light);
  text-decoration: none;
}

.pst-play-again-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--pst-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}

.pst-play-again-btn:hover {
  background: var(--pst-primary-dark);
}

/* Shared view banner */
.pst-shared-banner {
  background: var(--pst-primary-light);
  border: 1px solid var(--pst-border);
  border-radius: 8px;
  padding: 14px 20px;
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.9em;
  color: var(--pst-text-muted);
}

.pst-shared-banner strong {
  color: var(--pst-primary);
}

/* Loading */
.pst-loading {
  text-align: center;
  padding: 40px;
  color: var(--pst-text-muted);
  font-style: italic;
}

/* Sex God confetti strip */
.pst-sex-god-banner {
  background: linear-gradient(135deg, var(--pst-primary) 0%, #c97d3f 50%, var(--pst-gold) 100%);
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 0.85em;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 6px 6px 0 0;
  margin-bottom: -3px;
  display: none;
}

.pst-sex-god-banner.visible {
  display: block;
}

@media (max-width: 520px) {
  #pst-game-screen { padding: 18px 14px; }
  .pst-cert-title { font-size: 1.5em; }
  .pst-cert-score { font-size: 2.4em; }
  .pst-share-link-box { flex-direction: column; }
}
