
* {
    box-sizing: border-box;
}


:root {
    --purple-bg: #1a0b2e;
    --purple-card: #2a1844;
    --purple-accent: #7b4bff;
    --purple-accent-dark: #5a2edb;
    --purple-soft: #3a255a;
    --text-light: rgba(255,255,255,0.85);
    --text-dim: rgba(255,255,255,0.6);
}

body {
    margin: 0;
    padding: 0;
    background: #1a0b2e;
    font-family: 'Inter', Arial, sans-serif;
    color: white;
    overflow-x: hidden;
}

hr {
    border: var(--purple-accent);
    border-top: 2px solid #A78BFA; /* same as year input */
    margin: 16px 0;
}


/* Homepage styling */

#homeScreen {
    background-image: url('bg-desk.webp');
	background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    text-align: center;
	min-height: 100vh;

}

@media (max-width: 768px) {
  #homeScreen {
	background-image: url('bg-mob.webp');  
    min-height: 100vh; /* reset */
    padding-bottom: 0; /* reset */
    background-position: center -80%; /* reset */
  }
}

.purple-home::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 0;
}


.screen.gameplay.purple-home {
    position: relative;
    background-image: url('bg-mob.webp');
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
}

/* FORCE ALL SCREENS HIDDEN BY DEFAULT */
.screen {
    display: none !important;
}

/* ONLY SHOW THE ACTIVE SCREEN */
.screen.visible {
    display: block !important;
}

/* Center gameplay-type screens (game, reveal, summary) */
.screen.gameplay {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
}

/* HOME SCREEN */
.purple-home {
    background: none;
}

.home-nickname {
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.home-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 6px;
}

.home-calendar {
    font-size: 32px;
    margin-bottom: 12px;
}

.home-subtitle {
    font-size: 25px;
    margin-bottom: 24px;
}

/* TOP HEADER */
#topHeader {
    width: 100%;
    background: var(--purple-card);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

#siteName {
    font-size: 16px;
    font-weight: 700;
}

#todayDate {
    font-size: 14px;
    opacity: 0.7;
}

/* CARDS */
.card {
    background: var(--purple-card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

/* PROGRESS CIRCLES */
.progress-circles {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--purple-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    opacity: 0.6;
}

.circle.active {
    background: var(--purple-accent);
    opacity: 1;
}

/* Progress bar container */
#progressBarWrapper {
    width: 100%;
    height: 10px;
    background: rgba(0, 255, 0, 0.15);
    border-radius: 6px;
    overflow: hidden;
    margin: 6px 0 18px 0;
    box-shadow: 0 0 8px rgba(0,255,0,0.3);
}

/* Progress bar fill */
#progressBarFill {
    height: 100%;
    width: 0%;
    background: #00ff66;
    box-shadow: 0 0 12px #00ff66, 0 0 20px #00ff66;
    transition: width 0.4s ease;
}

/* STREAKS START */
/* STREAK CARD */
.streak-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.streak-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* adjust spacing */
    padding: 12px 0;
}

.streak-inline .streak-label {
    font-size: 1rem; /* reduce if needed */
    font-weight: 600;
    color: white;
}

.streak-inline .flame {
    font-size: 1.2rem;
}

#homeStreak {
    font-size: 1rem; /* reduce if needed */
    font-weight: 700;
}

.streak-inline .streak-label,
#homeStreak {
    font-size: 0.9rem;
}

/* STREAKS END */


.flame {
    font-size: 22px;
}

/* BUTTONS */
button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.play-btn,
.profile-btn,
.next-btn {
    width: 100%;
    padding: 16px;
    background: var(--purple-accent);
    border-radius: 12px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin-top: 10px;
}

.play-btn:active,
.profile-btn:active,
.next-btn:active {
    background: var(--purple-accent-dark);
    transform: scale(0.97);
}


/* LIST SCREENS */
#statsList,
#leaderboardListScreen,
#streakList,
#dailyResultsList,
#leaderboardListSummary {
    background: var(--purple-card);
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
}

/* GAMEPLAY FIX — MATCHES YOUR CURRENT HTML */


#questionHeader {
    text-align: center;
    margin-bottom: 6px; /* tighten spacing */
}

#questionNumber {
    text-align: center;
    font-size: 16px;
    opacity: 0.7;
    margin-bottom: 5px;
}

#questionBox {
    background: var(--purple-card);
    padding: 8px 24px 12px 24px; /* top, right, bottom, left */
    border-radius: 16px;
    margin-bottom: 8px;
    text-align: center;
}

#questionText {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}




#guessLabel {
    font-size: 14px;
    opacity: 0.6;
    margin-bottom: 14px; 
    min-height: 0;      /* FIX: locks the height */
    line-height: 14px;    /* FIX: vertically centres the text */
    display: block;         /* optional but helps */
    justify-content: center;
    align-items: center;
}
.year-input {
    width: 120px;
    padding: 12px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border-radius: 12px;
    border: 2px solid var(--purple-accent);
    background: var(--purple-soft);
    color: white;
    outline: none;
    margin: 0 auto;
    display: block;
}



/* ONBOARDING */
/* Make onboarding use the same card layout */
.onboarding-card {
    padding: 30px;
    text-align: center;
}

/* Ensure slides fill the card cleanly */
.onboarding-slide {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Progress indicator styling */
.onboard-progress {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 10px;
}

/* Input styling consistent with home screen */
.onboard-input {
    width: 80%;
    padding: 12px;
    font-size: 18px;
    border-radius: 10px;
    border: none;
    text-align: center;
    margin-top: 10px;
}

#onboardingSlides .onboarding-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 20px 0;
}

#onboardingSlides .game-card {
    border: 3px solid #a06bff; /* purple outline */
    border-radius: 16px;

    max-width: 500px;
    width: 80%;
    margin: 20px auto 0 auto;

    padding: 20px; /* match leaderboard padding */

    background: rgba(255,255,255,0.08); /* subtle, same feel */

    display: flex;
    flex-direction: column;
    align-items: center;

    /* IMPORTANT: remove vertical centering */
    justify-content: flex-start;

    /* match leaderboard height behaviour */
    min-height: auto;
}


.hidden {
    display: none !important;;
}

/* SUMMARY SCREEN */
#summaryTable {
    background: var(--purple-card);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* BOTTOM NAV */
#bottomNav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;

    display: flex;
    justify-content: space-around;
    align-items: center;

    background: var(--purple-card);
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 9999;
}

.nav-item {
    text-align: center;
    opacity: 0.6;
    font-size: 12px;
    color: var(--text-light);
}

.nav-item span {
    font-size: 20px;
    display: block;
    color: var(--text-light);
}

.nav-item.active {
    opacity: 1;
    color: white;
}


/* COOKIE CONSENT */
#cookieConsentWrapper {
    position: fixed;
    bottom: 0; /* always visible */
    left: 0;
    width: 100%;
    display: none;
    z-index: 9999; /* ensure it appears above everything */
    padding: 0 0 20px 0; /* optional breathing room */
}

#cookieConsentInner {
    background: var(--purple-card);
    padding: 16px;
    margin: 0 20px;
    border-radius: 12px;
    text-align: center;
}

/* History Facts */
.fact-card {
  background-color: #3b2a6f;
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  margin: 10px 0 6px 0;    /* FIXED: remove auto-centering */
  width: 100%;           /* FIXED: fill parent */
  max-width: none;       /* FIXED: no external width limit */
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-family: 'Segoe UI', sans-serif;
}


.fact-card p {
    text-align: left;
}

.fact-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.fact-icon {
  font-size: 1.4em;
  margin-right: 8px;
}

.fact-card h3 {
  margin: 0;
  font-size: 1.2em;
}

.fact-card p {
  font-size: 1em;
  line-height: 1.4;
  overflow-wrap: break-word;
}
/* ⭐ REVEAL CARD FIX */
/* ================================
   ⭐ REVEAL SCREEN LAYOUT (MOBILE SAFE)
   ================================ */

.reveal-answer-label {
    font-size: 1rem;
    color: #bbbbbb;
    margin-bottom: 4px;
    opacity: 1;              /* always visible */
    transform: none;         /* no animation */
}


#revealScreen {
    display: flex;
    flex-direction: column;
    height: 100vh;          /* full screen height like question screen */
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;       /* prevent double scroll */
}


#revealYearValue {
    color: #ffffff;
}

/* ================================
   ⭐ REVEAL CARD (scrollable content)
   ================================ */

#revealCard {
    background: var(--purple-card);
    color: white;

    width: 100%;            /* EXACT match to question card */
    max-width: 420px;       /* EXACT match to question card */

    flex: 1;                /* stretch vertically like question card */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);

    margin: 0 auto;         /* centre horizontally */
    overflow-y: auto;       /* scroll inside card if needed */
    padding-bottom: 100px;  /* space so content never hides behind button */
    box-sizing: border-box;
}


/* ================================
   ⭐ TEXT BLOCK (centered layout)
   ================================ */

#revealTextBlock {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}


/* ================================
   ⭐ YEAR (hero moment)
   ================================ */

#revealYearValue {
    font-size: 3rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}


/* ================================
   ⭐ USER GUESS (secondary)
   ================================ */

#revealUserGuess {
    font-size: 1.2rem;
    color: #bbbbbb;
    margin-bottom: 14px;
}


/* ================================
   ⭐ ICON + CORRECT/INCORRECT
   ================================ */

#revealIcon,
#revealMainText {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}


/* ================================
   ⭐ FEEDBACK LINE (animated)
   ================================ */

.question-feedback {
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    margin-bottom: 12px;
    color: #ffffff;
}

.comment-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}


/* ================================
   ⭐ SCORE BOX
   ================================ */

#revealScoreBox {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: rgba(255,255,255,0.08);
    box-sizing: border-box;
    padding: 12px;
    border-radius: 14px;
    margin-top: 10px;
    width: 100%;
    gap: 8px;
    overflow: hidden;
	/* ⭐ Add reveal animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
	
}

#revealScore,
#revealTotalScore {
    display: inline-block;
}


/* ================================
   ⭐ DID YOU KNOW CARD
   ================================ */

#revealDidYouKnow h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

#revealFact {
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-line;
    margin-bottom: 20px;
}


/* ================================
   ⭐ NEXT QUESTION BUTTON (fixed)
   ================================ */

#nextQuestionBtn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);

    width: calc(100% - 40px);  /* same as question screen */
    max-width: 420px;          /* same width as card */

    z-index: 200;
}

/* INCORRECT ICON (red circle with dark X) */
.incorrect-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #ff6b7a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -10px auto 5px auto;
    font-size: 17px !important;   /* ← lock size */
    line-height: 1 !important;    /* ← prevents vertical stretching */
    font-weight: 900;
    color: #3a003a;
}

.correct-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #4cd964;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -10px auto 5px auto;
    font-size: 17px !important;   /* ← lock size */
    line-height: 1 !important;    /* ← prevents vertical stretching */
    font-weight: 900;
    color: var(--purple-card);
}

.icon-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}


.score-left,
.score-right {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.score-left {
  text-align: left;
  align-items: flex-start;
}

.score-right {
  text-align: right;
  align-items: flex-end;
}

.score-label {
  font-size: clamp(10px, 3vw, 12px);
  white-space: nowrap;
}

.score-main {
  font-size: clamp(13px, 4vw, 15px);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.score-progress {
  font-size: clamp(10px, 3vw, 11px);
  white-space: nowrap;
}


.score-progress {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
}

.historian-comment {
    margin-left: 10px;
    font-size: 0.95rem;   
    font-weight: normal;
    opacity: 0.85;
    vertical-align: middle;
}


#shareScoreBtn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;

    background: var(--purple-accent);
    color: white;
    font-size: 18px;
    font-weight: 700;

    border-radius: 12px;
    border: none;

    /* Slight glow to make it feel “special” */
    box-shadow: 0 4px 12px rgba(122, 60, 255, 0.35);

    transition: 0.2s ease;
}

#shareScoreBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(122, 60, 255, 0.5);
}

#shareScoreBtn:active {
    transform: scale(0.97);
}

#questionFeedback {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}


.correct-flash {
    color: #4cd964 !important; /* green */
}

.incorrect-flash {
    color: #ff6b7a !important; /* red */
}

#statsScreen h2 {
    text-align: center;
    width: 100%;
}


.stats-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 18px 20px 25px;
    margin: 20px auto;
    width: 90%;
    max-width: 420px;
    backdrop-filter: blur(6px);
}

.stats-heading {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #E5D4FF; /* soft purple */
    letter-spacing: 0.5px;
}

.stats-header {
    text-align: center;
    margin-bottom: 15px;
}

.stats-player-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
}

.stats-player-title {
    font-size: 1rem;
    color: #d8caff;
    opacity: 0.9;
}

.chart-wrapper {
    width: 100%;
    max-width: 350px; /* match your intended canvas width */
    margin: 0 auto;
    padding: 0;
    position: relative;
}




.chart-wrapper canvas {
    width: 100% !important;
    height: 200px !important;
    display: block;
}



.yon-btn {
    background: linear-gradient(135deg, #B57CFF, #6A0DAD);
    border: none;
    padding: 14px 22px;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    max-width: 260px;
    margin: 20px auto 0;
    display: block;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(150, 80, 255, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.yon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(150, 80, 255, 0.55);
}

.yon-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(150, 80, 255, 0.35);
}

.game-card {
    background: var(--purple-card);
    color: white;

    width: 100%;
    max-width: 420px;

    margin: 0 auto;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);

    box-sizing: border-box;
}

#yearForm {
    display: flex;
    flex-direction: column;
    gap: 14px; /* perfect spacing between guess label → input */
    margin: 0;
    padding: 0;
}

#yearForm * {
    margin: 0;
}
.input-wrapper {
    display: flex;
    justify-content: center;
}


#leaderboardListScreen,
#streakLeaderboardList {
    overflow-y: auto;
    max-height: calc(100vh - 150px); /* tuned for your layout */
    padding-bottom: 180px; /* ensures last rows are visible above bottom nav */
    -webkit-overflow-scrolling: touch;
}


@media (max-width: 480px) {
    #leaderboardListScreen {
        padding: 8px 10px;
    }
}
#leaderboardListScreen ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

#leaderboardListScreen li {
    margin: 0;
    padding: 0;
}

#leaderboardListScreen li.lb-row.lb-me {
    background: rgba(122, 66, 216, 0.25) !important;
    border-left: 6px solid #7a42d8 !important;
    border-radius: 6px;
    padding: 6px 10px !important;
    font-weight: bold;
}
#leaderboardListScreen .lb-score {
    text-align: right !important;
    white-space: nowrap !important;
}

#leaderboardListScreen .lb-flag {
    font-size: 1.2em !important;
    white-space: nowrap !important;
    margin-left: 4px !important;
}

#leaderboardListSummary .lb-row.lb-me {
    background: rgba(122, 66, 216, 0.25) !important; /* soft purple */
    border-left: 6px solid #7a42d8 !important;
    border-radius: 6px;
    padding: 6px 10px !important;
    font-weight: bold;
}

.leaderboard-me {
    background: #e8d5ff;        /* light violet */
    border-left: 6px solid #7a42d8;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
}

#streakLeaderboardList .lb-row.lb-me {
    background: rgba(122, 66, 216, 0.25) !important;
    border-left: 6px solid #7a42d8 !important;
    border-radius: 6px;
    padding: 6px 10px !important;
    font-weight: bold;
}


/* PROFILE SCREEN */
#profileScreen {
    text-align: center;
    padding: 20px;

    height: calc(100vh - 70px); /* subtract bottom nav height */
    overflow-y: auto;           /* allow scrolling */
    -webkit-overflow-scrolling: touch; /* smooth iOS scroll */
    padding-bottom: 120px;      /* ensures last button is visible */
}

.purple-screen {
    padding-bottom: 120px;
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 10px;
    opacity: 0.9;
}

.profile-stats {
    background: var(--purple-card);
    padding: 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.profile-btn {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    display: block;
}

.profile-btn {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    display: block;
    padding: 16px;
    background: var(--purple-accent);
    border-radius: 12px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin-top: 10px;
}

.profile-btn:active {
    background: var(--purple-accent-dark);
    transform: scale(0.97);
}

#profileScreen.screen.visible {
    display: block !important;
}


.profile-divider {
    border: none;
    border-top: 2px solid var(--purple-accent);
    width: 100%;
    margin: 10px 0 20px 0;
}


.accuracy-basic {
    margin-top: 20px;
}

.acc-item {
    display: grid;
    grid-template-columns: 130px 1fr 40px;
    align-items: center;
    margin: 6px 0;
    font-size: 0.9rem;
}

.acc-bar {
    background: #2a2a2a;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.acc-bar div {
    height: 100%;
    background: var(--purple-accent);
    width: 0%;
    transition: width 0.4s ease;
}


.home-summary {
    font-size: 1.1rem;
    text-align: center;
    white-space: normal;
    margin-top: 10px;
    line-height: 1.5;
}

.nickname-change-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 20px 0;
}

.purple-o {
  color: var(--purple-accent); /* or var(--yon-purple) if you're using the new palette */
  font-weight: inherit;
}