@import url('https://fonts.googleapis.com/css2?family=Chiron+GoRound+TC:wght@400;500;700&display=swap');

:root {
    --bg: #0c111b;
    --bg-soft: #0f1724;
    --panel: rgba(11, 16, 26, 0.94);
    --panel-2: rgba(22, 28, 41, 0.92);
    --line: rgba(214, 150, 71, 0.18);
    --ink: #ffffff;
    --muted: rgba(255, 255, 255, 0.72);
    --gold: #d59647;
    --gold-soft: #f2c27a;
    --green: #3fb983;
    --green-dark: #2d8c62;
    --danger: #d46464;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Chiron GoRound TC", serif;
    background:
        linear-gradient(rgba(12, 17, 27, 0.7), rgba(12, 17, 27, 0.78)),
        url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/bg.jpg') center/cover fixed no-repeat;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
}

.page-shell {
    width: min(1180px, calc(100% - 1.5rem));
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.site-header,
.top-nav,
.button-row,
.stats-row,
.table-actions,
.split,
.quiz-stage__meta,
.quiz-stage__actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.site-header,
.split {
    justify-content: space-between;
}

.site-header {
    position: relative;
    z-index: 2;
    margin-bottom: 1.5rem;
}

.brand {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.top-nav {
    flex-wrap: wrap;
}

.top-nav a,
.quiz-stage__meta span:last-child {
    color: var(--muted);
}

.main-content,
.stack,
.panel,
.table-card,
.question-form,
.answer-options {
    display: grid;
    gap: 1rem;
}

.panel,
.table-card,
.quiz-stage__card {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.panel::before,
.table-card::before,
.quiz-stage__card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/corners.png') top right / 110px no-repeat,
        url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/corners.png') top left / 110px no-repeat,
        url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/corners.png') bottom left / 110px no-repeat,
        url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/corners.png') bottom right / 110px no-repeat;
    opacity: 0.18;
    pointer-events: none;
}

.hero {
    min-height: 320px;
    align-items: center;
    grid-template-columns: 1.35fr auto;
}

.hero::after {
    content: "";
    position: absolute;
    width: min(75vw, 720px);
    height: min(75vw, 720px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/circle.png') center/contain no-repeat;
    opacity: 0.18;
    animation: spin 100s linear infinite;
    pointer-events: none;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.eyebrow {
    margin: 0;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: clamp(2rem, 6vw, 4.25rem);
    color: var(--gold);
    line-height: 1.05;
}

h2 {
    font-size: clamp(1.35rem, 4vw, 2.3rem);
}

p,
td,
th,
label,
input,
textarea,
select,
button {
    font: inherit;
}

p,
.muted {
    color: var(--muted);
    line-height: 1.65;
}

.button,
button,
.answer-choice {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button,
button {
    padding: 0.95rem 1.25rem;
    background: var(--green);
    color: #fff;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
}

.button:hover,
button:hover {
    background: var(--green-dark);
}

.button.ghost,
button.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label {
    display: grid;
    gap: 0.45rem;
    color: var(--ink);
}

.alert {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 18px;
    border: 1px solid var(--line);
}

.alert-success {
    background: rgba(63, 185, 131, 0.12);
    color: #9ef0c7;
}

.alert-error {
    background: rgba(212, 100, 100, 0.12);
    color: #ffb0b0;
}

.stats-row {
    flex-wrap: wrap;
}

.stat {
    min-width: 130px;
    padding: 1rem 1.1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat strong {
    display: block;
    color: var(--gold);
    font-size: 1.6rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.9rem 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th {
    color: var(--gold);
}

.inline-form {
    display: inline;
}

.option-card {
    border-radius: 20px;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.option-card.correct {
    border-color: rgba(63, 185, 131, 0.45);
    background: rgba(63, 185, 131, 0.12);
}

.option-card.incorrect {
    border-color: rgba(212, 100, 100, 0.45);
    background: rgba(212, 100, 100, 0.12);
}

.quiz-player-body .site-header {
    display: none;
}

.quiz-stage {
    position: relative;
    min-height: calc(100vh - 120px);
    min-height: calc(100dvh - 120px);
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.quiz-stage__orbit {
    position: absolute;
    inset: 0;
    margin: auto;
    width: min(92vw, 980px);
    height: min(92vw, 980px);
    background: url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/circle.png') center/contain no-repeat;
    opacity: 0.22;
    animation: spin 110s linear infinite;
    pointer-events: none;
}

.quiz-stage__timer,
.quiz-stage__card {
    position: relative;
    z-index: 1;
}

.quiz-stage__timer {
    display: flex;
    justify-content: center;
    margin-top: 0.25rem;
}

.timer-shell {
    position: relative;
    width: 180px;
    height: 180px;
    background: var(--bg);
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.timer-shell__svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-shell__track,
.timer-shell__progress {
    fill: none;
    stroke-width: 6;
}

.timer-shell__track {
    stroke: #1d2940;
}

.timer-shell__progress {
    stroke: var(--green);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-shell__text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
}

.timer-shell__text span {
    font-size: 2.4rem;
    color: var(--ink);
}

.timer-shell__text small {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.quiz-stage__card {
    padding: 1.5rem;
    background: rgba(11, 16, 26, 0.96);
    border-width: 8px;
    border-color: rgba(41, 45, 59, 0.95);
}

.quiz-stage__header {
    text-align: center;
    display: grid;
    gap: 0.7rem;
}

.quiz-stage__meta {
    justify-content: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.95rem;
}

.quiz-stage__question {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 0 0.35rem;
}

.quiz-stage__question p {
    color: var(--ink);
    font-size: clamp(1.3rem, 3vw, 2.1rem);
    text-align: center;
    line-height: 1.7;
}

.quiz-stage__options {
    display: grid;
    gap: 0.85rem;
}

.answer-choice {
    width: 100%;
    padding: 1rem 1.1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    text-align: left;
    color: var(--ink);
    background: var(--panel-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
}

.answer-choice strong {
    color: var(--gold);
    min-width: 1.6rem;
}

.quiz-stage__actions {
    justify-content: center;
}

.hidden-form {
    display: none;
}

.player-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.player-stage {
    width: min(100%, 960px);
}

.player-stage--live {
    min-height: 100vh;
    display: grid;
    align-items: stretch;
}

.player-card {
    position: relative;
    overflow: hidden;
    padding: 1.3rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 1rem;
}

.player-card--welcome {
    min-height: min(92vh, 760px);
    align-content: center;
}

.player-card--results {
    min-height: min(92vh, 760px);
    align-content: start;
}

.player-error {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(212, 100, 100, 0.12);
    border: 1px solid rgba(212, 100, 100, 0.25);
    color: #ffb0b0;
}

.player-stats {
    justify-content: center;
}

.player-description {
    padding-bottom: 0.35rem;
}

.player-result-subline {
    text-align: center;
    color: var(--muted);
    font-size: 1.05rem;
}

.quiz-stage--inline {
    min-height: 100vh;
    min-height: 100dvh;
    align-content: center;
    padding: 0;
    gap: 0.45rem;
}

.timer-shell--compact {
    width: 118px;
    height: 118px;
}

.quiz-stage__card--full {
    min-height: calc(100vh - 132px);
    min-height: calc(100dvh - 132px);
    display: grid;
    grid-template-rows: auto 1fr auto auto;
}

.quiz-stage__question--compact {
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.quiz-stage__actions--spaced {
    padding-top: 5px;
}

.stat--hero {
    min-width: min(100%, 280px);
    margin: 0 auto;
    text-align: center;
    padding: 1.25rem 1.5rem;
}

.stat--hero strong {
    font-size: clamp(2.4rem, 8vw, 4.2rem);
    line-height: 1;
}

.auth-panel {
    max-width: 520px;
    margin: 0 auto;
}

.leaderboard-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 52px;
    background: url('https://pixelmatters.au/wp-content/themes/twentytwenty/assets/separator.png') center/contain no-repeat;
    opacity: 0.7;
}

.leaderboard-list {
    display: grid;
    gap: 0.9rem;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: minmax(110px, 160px) 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(12, 17, 27, 0.88);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(18px);
    animation: leaderboardReveal 0.65s ease forwards;
    animation-delay: var(--delay, 0s);
}

.leaderboard-row--first {
    background:
        linear-gradient(90deg, rgba(213, 150, 71, 0.22), rgba(63, 185, 131, 0.12)),
        rgba(12, 17, 27, 0.96);
    border-color: rgba(213, 150, 71, 0.45);
    transform: scale(1.02);
}

.leaderboard-row--first .leaderboard-row__place {
    color: var(--gold-soft);
}

.leaderboard-row--first .leaderboard-row__score {
    color: #fff4cf;
}

.leaderboard-row--empty {
    grid-template-columns: 1fr;
    opacity: 1;
    transform: none;
    animation: none;
    justify-items: center;
    color: var(--muted);
}

.leaderboard-row__place {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.88rem;
}

.leaderboard-row__name {
    color: var(--ink);
    font-size: clamp(1.05rem, 2.4vw, 1.4rem);
}

.leaderboard-row__score {
    color: var(--green);
    font-weight: 700;
    white-space: nowrap;
}

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

@keyframes leaderboardReveal {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 780px) {
    .page-shell {
        width: min(100% - 0.5rem, 100%);
        padding: 0;
    }

    .page-shell {
        width: min(100% - 0.5rem, 100%);
    }

    .site-header,
    .split,
    .button-row,
    .quiz-stage__meta,
    .quiz-stage__actions {
        display: grid;
        gap: 0.75rem;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .timer-shell {
        width: 148px;
        height: 148px;
    }

    .timer-shell--compact {
        width: 96px;
        height: 96px;
    }

    .timer-shell__text span {
        font-size: 2rem;
    }

    .timer-shell--compact .timer-shell__text span {
        font-size: 1.65rem;
    }

    .quiz-stage__card {
        padding: 0.85rem;
        border-width: 6px;
        min-height: calc(100vh - 108px);
        min-height: calc(100dvh - 108px);
    }

    .quiz-stage__question p {
        font-size: clamp(1.05rem, 4.6vw, 1.35rem);
        line-height: 1.38;
    }

    .answer-choice {
        padding: 0.72rem 0.85rem;
        border-radius: 18px;
        gap: 0.7rem;
        -webkit-tap-highlight-color: transparent;
    }

    .answer-choice:focus,
    .answer-choice:active {
        outline: none;
        background: var(--panel-2);
        border-color: rgba(255, 255, 255, 0.08);
    }

    .player-card--welcome,
    .player-card--results {
        min-height: 100vh;
        border-radius: 18px;
        padding: 1rem 0.9rem;
    }

    .player-stats .stat {
        min-width: 100px;
        padding: 0.8rem 0.9rem;
    }

    .player-description {
        padding-bottom: 0.55rem;
    }

    .quiz-stage__header {
        gap: 0.35rem;
    }

    .quiz-stage__timer {
        margin-top: 0;
    }

    .quiz-stage--inline {
        gap: 0.3rem;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .quiz-stage__card--full {
        min-height: calc(100vh - 108px);
        min-height: calc(100dvh - 108px);
    }

    .leaderboard-row {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    th:nth-child(4),
    td:nth-child(4) {
        display: none;
    }
}

@media (hover: hover) and (pointer: fine) {
    .answer-choice:hover {
        background: rgba(63, 185, 131, 0.18);
        border-color: rgba(63, 185, 131, 0.42);
    }
}

@media (hover: none), (pointer: coarse) {
    .answer-choice:hover,
    .answer-choice:focus,
    .answer-choice:active {
        background: var(--panel-2);
        border-color: rgba(255, 255, 255, 0.08);
        transform: none;
    }
}
