/* ============================================================
   APEX MASTER STYLESHEET
   Dark Silver / Midnight Black
   ============================================================
*/

/* 1. RESET */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* 3. LOGIN SCREEN */

#login-screen {
    z-index: 10000;
}

.login-card {
    text-align: center;
}

.login-brand {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.login-brand h1 {
    margin: 0;
    font-size: clamp(38px, 10vw, 54px);
    line-height: 1;
    text-transform: uppercase;
}

.login-kicker {
    font-size: 9px;
}

.login-message {
    width: 100%;
    min-height: 22px;
    margin: 14px 0 0;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 11px;
    line-height: 1.45;
    letter-spacing: 0.04em;
    text-align: center;
}

/* 5. HEADER */

.game-header {
    width: 100%;
    text-align: center;
    overflow: visible;
    isolation: isolate;
}

.game-header h1 {
    position: relative;
    z-index: 2;
    margin: 0;
    font-size: 42px;
    text-transform: uppercase;
}

.game-header::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 72px;
    width: 260px;
    height: 170px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(205, 213, 220, 0.055), transparent 68%);
    filter: blur(18px);
    pointer-events: none;
    z-index: -1;
}

/* 6. PYRAMID LOGO / 3D PYRAMID */

.game-logo-frame {
    width: 210px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 700px;
}

.pyramid-3d {
    --pyramid-size: 112px;
    --pyramid-height: 100px;
    position: relative;
    width: var(--pyramid-size);
    height: var(--pyramid-height);
    transform-style: preserve-3d;
    transform-origin: 50% 45%;
    animation: pyramid-3d-spin 7s linear 1;
    animation-fill-mode: forwards;
    will-change: transform;
}

/* 7. PYRAMID FACES */

.pyramid-3d__face {
    position: absolute;
    top: -24px;
    left: 0;
    width: var(--pyramid-size);
    height: calc(var(--pyramid-height) + 24px);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    transform-origin: 50% 100%;
    backface-visibility: visible;
}

.game-header .game-logo .pyramid-3d__face--front {
    transform: rotateY(0deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

.game-header .game-logo .pyramid-3d__face--right {
    transform: rotateY(90deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

.game-header .game-logo .pyramid-3d__face--back {
    transform: rotateY(180deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

.game-header .game-logo .pyramid-3d__face--left {
    transform: rotateY(270deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

/* 8. PYRAMID BASE */

.pyramid-3d__base {
    display: none !important;
}

/* 9. PYRAMID SHADOW */

.pyramid-3d::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -11px;
    width: 82px;
    height: 13px;
    transform: translateX(-50%) rotateX(70deg);
    background: rgba(0, 0, 0, 0.72);
    filter: blur(10px);
    border-radius: 50%;
}

/* 10. PYRAMID ROTATION */

@keyframes pyramid-3d-spin {
    from {
        transform: rotateX(-6deg) rotateY(0deg);
    }
    to {
        transform: rotateX(-6deg) rotateY(360deg);
    }
}

/* 11. GAME STATUS */

#game-status {
    margin: 10px 0 0;
    font-weight: 400;
}

/* 12. SCREENS */

.screen {
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* 13. BLACK PANELS */

.card {
    color: var(--pyramid-silver);
    padding: 24px;
}

.card h2 {
    margin: 0 0 12px;
}

.card p {
    margin: 8px 0;
}

/* 14. FORM */

form {
    margin-top: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 400;
}

input[type="text"] {
    width: 100%;
    padding: 9px 0 10px;
    outline: none;
    font-weight: 400;
    letter-spacing: 0.04em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

input[type="text"]:focus {
    border-bottom-color: #ffffff;
    box-shadow: 0 6px 14px -12px rgba(220, 225, 230, 0.5);
}

/* 15. LOBBY */

.lobby-entry {
    padding: 12px 4px 30px;
}

.lobby-entry h2 {
    margin: 0 0 7px;
}

.lobby-subtitle {
    max-width: 520px;
    margin: 0;
}

.lobby-entry form {
    margin-top: 28px;
}

/* 16. LOBBY ROSTER (merged with the boxed panel styling) */

.lobby-roster {
    position: relative;
    padding: 20px;
}

.lobby-roster-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 10px;
}

.lobby-kicker {
    display: block;
    margin-bottom: 5px;
    font-size: 9px;
}

.lobby-roster-header h2 {
    margin: 0;
    color: #ffffff !important;
    font-family: "Cinzel", Georgia, serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lobby-player-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 30px;
    font-size: 13px;
}

.lobby-population-status {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
}

.lobby-roster #player-list {
    margin-top: 6px;
}

/* 17. BUTTONS */

button {
    width: 100%;
    margin-top: 14px;
    padding: 15px 16px;
    color: #ffffff !important;
    font-size: 16px;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease,
        opacity 0.15s ease,
        color 0.15s ease;
}

@media (hover: hover) {
    button:hover:not(:disabled) {
        background: #ffffff;
        border-color: #ffffff !important;
        color: #020304 !important;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.055),
            0 9px 22px rgba(0, 0, 0, 0.28);
    }
}

button:active {
    transform: scale(0.98);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35);
}

button:disabled {
    cursor: not-allowed;
    transform: none;
}

/* 18. SECONDARY BUTTON */

.secondary-button:hover {
    background: transparent !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* 19. PLAYER COUNT */

#player-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    background: #090b0d;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 400;
}

/* 20. PLAYER LIST */

#player-list,
#voting-player-list,
#runoff-player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

#player-list li {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 4px;
    font-size: 14px;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

#player-list li::before {
    content: "";
    width: 4px;
    height: 4px;
    margin-right: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #777f87;
    box-shadow: 0 0 6px rgba(190, 196, 201, 0.22);
}

#player-list li:hover {
    padding-left: 8px;
    color: #ffffff !important;
}

/* 21. VOTING OPTIONS */

#voting-player-list li,
#runoff-player-list li {
    margin: 0;
}

.vote-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 15px;
    font-weight: 400;
    text-align: left;
}

.vote-player:hover:not(:disabled),
.vote-player.selected {
    background: #ffffff;
    color: #020304 !important;
}

.vote-player:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 22. VOTE PROGRESS */

#vote-progress,
#runoff-progress {
    margin: 14px 0 0;
    font-weight: 400;
}

/* 23. MESSAGES */

.message {
    min-height: 22px;
    margin: 12px 0 0 !important;
    font-size: 14px !important;
}

.global-message {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 1000;
    width: calc(100% - 32px);
    max-width: 500px;
    padding: 13px 15px;
    transform: translateX(-50%);
    font-size: 14px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.global-message.visible {
    opacity: 1;
}

/* 24. HOST CONTROLS */

#host-controls,
#voting-host-controls,
#runoff-host-controls,
#results-host-controls {
    border-color: #ffffff !important;
    background: var(--pyramid-panel);
}

#host-controls h2,
#voting-host-controls h2,
#runoff-host-controls h2,
#results-host-controls h2 {
    color: #ffffff !important;
}

/* 25. RESULTS */

.results-score-section,
.grade-results-section {
    width: 100%;
}

.results-section-heading {
    margin: 0 0 18px;
    color: #ffffff !important;
    font-family: "Cinzel", Georgia, serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* 26. GRADE GROUP */

.grade-group {
    width: 100%;
    margin: 0 0 18px;
    overflow: hidden;
    background: #06080a;
}

.grade-group-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 8px 12px;
    border-bottom: 2px solid #ffffff !important;
    background: #0a0d10;
}

.grade-group-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    background: #050505;
    color: #ffffff !important;
    font-family: "Cinzel", Georgia, serif;
    font-size: 12px;
    font-weight: 800;
}

.grade-group-title {
    color: #ffffff !important;
    font-family: "Cinzel", Georgia, serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* 27-31. GRADES A to F */
.grade-group-a {
    border-color: #ffffff !important;
}

.grade-group-a .grade-group-heading {
    background: #111111;
}

.grade-group-a .grade-group-title {
    color: #ffffff !important;
}

.grade-group-b {
    border-color: #ffffff !important;
}

.grade-group-c {
    border-color: #ffffff !important;
}

.grade-group-d {
    border-color: #ffffff !important;
}

.grade-group-e {
    border-color: #ffffff !important;
}

.grade-group-e .grade-player-name {
    color: #e6e6e6 !important;
    font-weight: 450;
}

.grade-group-f {
    margin-bottom: 8px;
    border-color: #ffffff !important;
}

/* 32. INDIVIDUAL RESULT */

.grade-result {
    width: 100%;
    padding: 10px 12px;
    animation: results-follow-reveal 0.4s ease both;
}

.grade-result:last-child {
    border-bottom: none;
}

/* 33. RESULT IDENTITY */

.grade-result-identity {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.grade-player-name {
    min-width: 0;
    overflow: hidden;
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 14px;
    font-weight: 450;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 34. A RESULT */

.grade-group-a .grade-result {
    padding-top: 11px;
    padding-bottom: 11px;
}

.grade-group-a .grade-player-name {
    color: #ffffff !important;
}

/* 35. B RESULT */

.grade-group-b .grade-player-name {
    color: #cccccc !important;
    font-weight: 450;
}

/* 36. A/B PROGRESS AREA */

.grade-progress-area {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    margin-top: 7px;
}

/* 37. VOTE PROGRESS TRACK */

.grade-progress-track {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 14px;
    overflow: hidden;
    background: #111519;
}

/* 38. VOTE PROGRESS BAR */

.grade-progress-bar {
    height: 100%;
    min-width: 3px;
    border-radius: 2px;
    background: #c3c9ce;
    transform-origin: left center;
    transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 39. VOTE COUNT */

.grade-vote-count {
    flex: 0 0 auto;
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 9px;
    font-weight: 450;
    white-space: nowrap;
}

/* 40. SIMPLE INFORMATION */

.grade-simple-information {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex: 0 0 auto;
}

.grade-simple-votes {
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 9px;
    font-weight: 450;
    white-space: nowrap;
}

.grade-position {
    min-width: 48px;
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 8px;
    font-weight: 450;
    text-align: right;
    white-space: nowrap;
}

/* 41. C RESULTS */

.grade-group-c .grade-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 39px;
    padding: 7px 12px;
}

.grade-group-c .grade-player-name {
    flex: 1;
    min-width: 0;
    color: #a9a9a9 !important;
    font-size: 13px;
    font-weight: 450;
}

/* 42. D RESULTS */

.grade-group-d .grade-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    padding: 6px 12px;
}

.grade-group-d .grade-player-name {
    color: #909090 !important;
    font-size: 12px;
    font-weight: 450;
}

.grade-group-d .grade-simple-votes {
    color: #5c5c5c !important;
    font-size: 8px;
}

/* 43. F RESULTS */

.grade-group-f .grade-result {
    padding: 5px 12px;
}

.grade-group-f .grade-player-name {
    color: #626262 !important;
    font-size: 12px;
    font-weight: 450;
}

/* 44. RUNOFF RESULTS */

.runoff-results-section {
    width: 100%;
    margin-top: 28px;
    padding-top: 22px;
}

.results-section-note {
    margin: 0 0 15px;
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 12px;
    line-height: 1.4;
}

.runoff-score-list {
    display: flex;
    flex-direction: column;
}

.runoff-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 8px 0;
}

.runoff-score-row:first-child {
    border-top: 1px solid #555555;
}

.runoff-score-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.runoff-score-name {
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 13px;
    font-weight: 450;
}

.runoff-score-grade {
    color: #707070 !important;
    font-size: 8px;
    font-weight: 450;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.runoff-score-value {
    flex: 0 0 auto;
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 11px;
    font-weight: 450;
    white-space: nowrap;
}

/* 45. RESULT REVEAL ANIMATION */

@keyframes results-follow-reveal {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 46. GAME START TRANSITION */

.game-start-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 30px;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(211, 218, 224, 0.07), transparent 34%),
        #020304;
    opacity: 0;
    pointer-events: none;
    perspective: none;
    transition: opacity 260ms ease;
}

.game-start-transition.active {
    opacity: 1;
    pointer-events: all;
}

.game-start-transition.leaving {
    opacity: 0;
}

/* 47. GAME START VISUAL */

.game-start-visual {
    position: relative;
    width: min(72vw, 270px);
    height: min(72vw, 270px);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none;
    animation: none;
    perspective: 900px;
}

/* 48. GAME START PYRAMID */

.game-start-image {
    --pyramid-size: 170px;
    --pyramid-height: 150px;
    position: relative;
    width: var(--pyramid-size);
    height: var(--pyramid-height);
    transform-style: preserve-3d;
    transform-origin: 50% 100%;
    filter: brightness(1.08) contrast(0.96) drop-shadow(0 18px 34px rgba(0, 0, 0, 0.72));
    user-select: none;
    pointer-events: none;
    animation: game-start-image-spin 2.8s cubic-bezier(0.22, 0.72, 0.28, 1) both;
    will-change: transform, opacity;
}

.game-start-image .pyramid-3d__face {
    top: -24px;
    width: var(--pyramid-size);
    height: calc(var(--pyramid-height) + 24px);
}

.game-start-image .pyramid-3d__face--front {
    transform: rotateY(0deg) translateZ(85px) rotateX(26.565deg);
}

.game-start-image .pyramid-3d__face--right {
    transform: rotateY(90deg) translateZ(85px) rotateX(26.565deg);
}

.game-start-image .pyramid-3d__face--back {
    transform: rotateY(180deg) translateZ(85px) rotateX(26.565deg);
}

.game-start-image .pyramid-3d__face--left {
    transform: rotateY(270deg) translateZ(85px) rotateX(26.565deg);
}

.game-start-image .pyramid-3d__base {
    display: none !important;
}

/* 49. GAME START TITLE */

.game-start-title {
    position: relative;
    min-height: 72px;
    margin: 0;
    color: #ffffff !important;
    font-family: "Cinzel", Georgia, serif;
    font-size: clamp(25px, 7vw, 38px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 8px 28px rgba(0, 0, 0, 0.7);
}

.game-start-line {
    min-height: 1.05em;
}

/* 50. GAME START IMAGE ANIMATION */

@keyframes game-start-image-spin {
    0% {
        opacity: 0;
        transform: perspective(900px) rotateY(0deg) scale(0.84);
    }
    12% {
        opacity: 1;
    }
    50% {
        opacity: 1;
        transform: perspective(900px) rotateY(180deg) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: perspective(900px) rotateY(360deg) scale(0.94);
    }
}

/* 52. AUDIO CONTROL */

#pyramid-audio-control {
    position: fixed !important;
    bottom: 14px !important;
    right: 14px !important;
    width: auto !important;
    min-width: 0 !important;
    height: 30px !important;
    padding: 0 9px !important;
    margin: 0 !important;
    font-size: 9px !important;
    line-height: 1 !important;
    letter-spacing: 0.12em !important;
    z-index: 10000 !important;
}

#pyramid-audio-control span {
    font-size: 8px !important;
    opacity: 0.65;
}

#pyramid-audio-control:hover {
    border-color: #e7ebef !important;
    background: rgba(20, 22, 24, 0.95) !important;
}

#pyramid-audio-control.muted {
    opacity: 0.55;
}

/* 53. MOBILE */

@media (max-width: 400px) {
    #login-screen {
        padding: 22px 16px;
    }

    .login-card {
        min-height: calc(100dvh - 44px);
        padding: 34px 20px 24px;
    }

    .login-brand h1 {
        font-size: clamp(34px, 10vw, 46px);
    }

    .app {
        padding-left: 14px;
        padding-right: 14px;
    }

    .game-header h1 {
        font-size: 36px;
    }

    .game-logo-frame {
        width: 180px;
        height: 130px;
    }

    .pyramid-3d {
        --pyramid-size: 96px;
        --pyramid-height: 88px;
    }

    .card {
        padding: 20px;
    }

    .grade-group {
        margin-bottom: 15px;
    }

    .grade-group-heading {
        min-height: 43px;
        padding: 7px 10px;
    }

    .grade-group-badge {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
        font-size: 11px;
    }

    .grade-group-title {
        font-size: 9px;
    }

    .grade-result {
        padding-left: 10px;
        padding-right: 10px;
    }

    .grade-player-name {
        font-size: 13px;
    }

    .grade-progress-area {
        gap: 6px;
    }

    .grade-progress-track {
        height: 13px;
    }

    .grade-vote-count {
        font-size: 8px;
    }

    .grade-group-c .grade-result {
        padding-left: 10px;
        padding-right: 10px;
    }

    .grade-group-c .grade-player-name {
        font-size: 12px;
    }

    .grade-simple-information {
        gap: 6px;
    }

    .grade-simple-votes {
        font-size: 8px;
    }

    .grade-position {
        min-width: 43px;
        font-size: 7px;
    }

    .grade-group-d .grade-player-name,
    .grade-group-f .grade-player-name {
        font-size: 11px;
    }

    .game-start-title {
        font-size: 18px;
    }

    .game-start-visual {
        width: min(72vw, 240px);
        height: min(72vw, 240px);
    }

    .game-start-image {
        --pyramid-size: 150px;
        --pyramid-height: 132px;
    }

    .game-start-image .pyramid-3d__face--front {
        transform: rotateY(0deg) translateZ(75px) rotateX(26.565deg);
    }

    .game-start-image .pyramid-3d__face--right {
        transform: rotateY(90deg) translateZ(75px) rotateX(26.565deg);
    }

    .game-start-image .pyramid-3d__face--back {
        transform: rotateY(180deg) translateZ(75px) rotateX(26.565deg);
    }

    .game-start-image .pyramid-3d__face--left {
        transform: rotateY(270deg) translateZ(75px) rotateX(26.565deg);
    }
}

/* 54. REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    .pyramid-3d {
        animation: none !important;
        transform: rotateX(-6deg) rotateY(0deg);
    }

    .grade-result {
        animation: none;
    }

    .grade-progress-bar {
        transition: none;
    }

    .game-start-image {
        animation: none;
        transform: none;
        opacity: 1;
    }

    .game-start-visual {
        animation: none;
    }

    .game-start-transition {
        transition: none;
    }
}

/* ============================================================
   ACCOUNT MENU (small circular button, top right)
   ============================================================
*/

.account-menu-wrapper {
    position: absolute;
    z-index: 40;
}

.account-menu-button {
    margin: 0;
}

.account-menu-button:hover:not(:disabled) {
    background: #ffffff;
    color: #020304 !important;
}

.account-menu {
    position: absolute;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-menu .account-menu-danger {
    border-radius: 0 0 6px 6px;
}

/* ============================================================
   REVIEW SCREEN (preliminary results before runoff)
   ============================================================
*/

#review-candidate-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#review-candidate-list .vote-player,
#review-candidate-list .vote-player:hover:not(:disabled) {
    background: #090c0f;
    color: #ffffff !important;
    cursor: default;
}

#review-duration-select {
    display: block;
    width: 100%;
    margin: 4px 0 6px;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #ffffff 50%),
        linear-gradient(135deg, #ffffff 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    color: #ffffff;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 16px;
    letter-spacing: 0.05em;
    cursor: pointer;
}

#review-duration-select:focus {
    outline: none;
    box-shadow: 0 6px 14px -12px rgba(220, 225, 230, 0.5);
}

#review-duration-select option {
    background: #090c0f;
    color: #ffffff;
}

#review-wait-message {
    text-align: center;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    letter-spacing: 0.06em;
}

/* ============================================================
   RUNOFF TIMER
   (font-size and margin are set by .voting-timer, .runoff-timer below)
   ============================================================
*/

#runoff-timer {
    color: #ffffff !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    min-height: 1.2em;
}

#runoff-timer:empty {
    display: none;
}

/* ============================================================
   LOBBY FLAIR
   ============================================================
*/

.lobby-chamber {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#lobby-pyramid {
    width: min(56vw, 210px);
    height: auto;
    overflow: visible;
    animation: lobby-float 5s ease-in-out infinite;
}

.lobby-tier {
    fill: transparent;
    stroke-width: 1.5;
    stroke-linejoin: round;
    transition: fill 0.6s ease, stroke 0.6s ease, filter 0.6s ease;
}

#lobby-pyramid.full {
    animation:
        lobby-float 5s ease-in-out infinite,
        lobby-ready 2.4s ease-in-out infinite;
}

.lobby-pyramid-caption {
    margin-top: 12px;
    font-size: 11px;
}

@keyframes lobby-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

#player-list .lobby-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 12px;
}

#player-list .lobby-player:hover {
    padding-left: 12px;
    background: #0d1115;
    border-color: #626a73;
}

#player-list li.lobby-player::before {
    display: none;
}

#player-list li.lobby-empty {
    justify-content: center;
    border: 1px dashed #343a41;
    border-radius: 8px;
    color: #899199 !important;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    letter-spacing: 0.1em;
}

#player-list li.lobby-empty::before {
    display: none;
}

.lobby-player.entering {
    animation: lobby-player-enter 0.45s ease both;
}

@keyframes lobby-player-enter {
    from {
        opacity: 0;
        transform: translateX(-14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.lobby-player-number {
    min-width: 22px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.lobby-player-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    letter-spacing: 0.05em;
}

.lobby-player-tag {
    flex: 0 0 auto;
    padding: 3px 8px;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 9px;
    letter-spacing: 0.16em;
}

.lobby-player-tag.you {
    background: #ffffff;
    border-color: #ffffff;
    color: #020304;
}

.lobby-hint {
    margin: 10px 0 0;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
    #lobby-pyramid,
    #lobby-pyramid.full,
    .lobby-player.entering {
        animation: none;
    }
}

/* ============================================================
   APEX 1.47 UI / TIMER POLISH
   ============================================================
*/

.screen-enter {
    animation: apex-screen-enter 260ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes apex-screen-enter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   LEFT NAVIGATION DRAWER TRIGGER
   ============================================================
*/

.quick-nav-button {
    position: absolute;
    z-index: 40;
    margin: 0;
    cursor: pointer;
}

.quick-nav-button span {
    opacity: 0.92;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.quick-nav-button:hover:not(:disabled) {
    background: #fff !important;
}

.quick-nav-button[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.quick-nav-button[aria-expanded="true"] span:nth-child(3) {
    opacity: 0;
}

/* ============================================================
   LEFT NAVIGATION DRAWER
   ============================================================
*/

.quick-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    z-index: 9001;
    width: min(350px, 88vw);
    transform: translateX(-104%);
    transition: transform 0.32s cubic-bezier(0.2, 0.75, 0.25, 1);
    overflow-y: auto;
}

.quick-panel.open {
    transform: translateX(0);
}

.quick-panel-inner {
    padding: 26px 22px 30px;
}

.quick-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.quick-panel-drawer-title {
    margin: 5px 0 0;
    font-size: 18px;
}

/* ============================================================
   DRAWER SECTION NAVIGATION
   ============================================================
*/

.quick-panel-nav {
    display: grid;
    gap: 7px;
    margin-bottom: 34px;
}

.quick-panel-nav-button {
    display: grid !important;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 12px;
    width: 100% !important;
    margin: 0 !important;
    text-align: left;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        color 0.2s ease;
}

.quick-panel-nav-button:hover:not(:disabled) {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.055) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

.quick-panel-nav-button.active {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(255, 255, 255, 0.92) !important;
    color: #020304 !important;
}

.quick-panel-nav-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-family: "Oswald", sans-serif;
    font-size: 10px;
    letter-spacing: 0.08em;
}

.quick-panel-nav-button.active .quick-panel-nav-index {
    border-color: rgba(0, 0, 0, 0.18);
}

.quick-panel-nav-button strong {
    display: block;
    font-family: "Oswald", sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.16em;
}

.quick-panel-nav-button small {
    display: block;
    margin-top: 3px;
    font-family: "Oswald", sans-serif;
    letter-spacing: 0.08em;
    opacity: 0.65;
}

/* ============================================================
   MOBILE ADJUSTMENT
   ============================================================
*/

@media (max-width: 600px) {
    .quick-nav-button {
        top: 2px;
        left: 0;
    }

    .quick-panel {
        width: min(330px, 90vw);
    }
}

/* ============================================================
   BACKDROPS AND PANEL CONTENT
   ============================================================
*/

.quick-panel-backdrop,
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.64);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.quick-panel-backdrop {
    pointer-events: none;
}

.quick-panel-backdrop.visible {
    pointer-events: auto;
}

.quick-panel-backdrop.visible,
.modal-backdrop.visible {
    opacity: 1;
}

.quick-panel-kicker,
.quick-panel-label,
.modal-kicker {
    color: var(--pyramid-silver-muted);
    font-family: "Oswald", sans-serif;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.quick-panel-close {
    margin: 0 !important;
}

.quick-panel-section h2,
.modal-card h2 {
    margin: 7px 0 12px;
    color: #fff;
    font-family: "Cinzel", Georgia, serif;
    font-size: 25px;
    letter-spacing: 0.08em;
}

.quick-panel-section>p:not(.quick-panel-label) {
    color: var(--pyramid-silver-muted);
    line-height: 1.6;
}

.quick-panel-timer {
    text-align: center;
}

.quick-panel-player-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 22px;
}

.quick-player-row {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    padding: 11px 0;
    color: var(--pyramid-silver);
    font-family: "Oswald", sans-serif;
    letter-spacing: 0.06em;
}

.quick-player-row span:first-child {
    color: var(--pyramid-silver-muted);
}

.quick-panel-rules {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.quick-panel-rules p {
    margin: 0;
    padding: 14px;
    color: var(--pyramid-silver-muted);
    font-size: 13px;
    line-height: 1.55;
}

.quick-panel-rules strong {
    color: #fff;
    font-family: "Oswald", sans-serif;
    letter-spacing: 0.13em;
    font-weight: 500;
}

.voting-timer:not(:empty),
.runoff-timer:not(:empty) {
    animation: timer-pulse 1.5s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% {
        opacity: 0.78;
    }
    50% {
        opacity: 1;
    }
}

.modal-backdrop {
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}

.modal-backdrop.visible {
    pointer-events: auto;
}

.modal-card {
    width: min(470px, 100%);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.modal-backdrop.visible .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-card select {
    width: 100%;
    margin-top: 4px;
    padding: 13px 12px;
    background: #050709;
    color: #fff;
    font: 500 15px "Oswald", sans-serif;
    letter-spacing: 0.04em;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
    margin-top: 22px;
}

.modal-actions button {
    margin: 0 !important;
}

@media (max-width: 520px) {
    .quick-panel-inner {
        padding: 22px 20px;
    }

    .modal-card {
        padding: 23px;
    }
}

/* ============================================================
   APEX 1.48 — GRAPHITE / DEPTH PASS
   ============================================================
*/

.game-logo-frame {
    position: relative;
    filter: drop-shadow(0 22px 25px rgba(0, 0, 0, 0.32));
}

.quick-nav-button:active {
    transform: translateY(2px);
    box-shadow:
        0 3px 7px rgba(0, 0, 0, 0.35),
        inset 0 2px 4px rgba(0, 0, 0, 0.45) !important;
}

.quick-panel-nav-button,
.quick-panel-rules p {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.08)) !important;
    box-shadow:
        0 7px 16px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(0, 0, 0, 0.28) !important;
}

.quick-panel-nav-button:active {
    transform: translateY(2px) !important;
    box-shadow:
        0 2px 7px rgba(0, 0, 0, 0.30),
        inset 0 2px 4px rgba(0, 0, 0, 0.32) !important;
}

button:not(:disabled) {
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

button:not(:disabled):active {
    transform: translateY(2px);
    box-shadow:
        0 2px 7px rgba(0, 0, 0, 0.30),
        inset 0 2px 4px rgba(0, 0, 0, 0.28);
}

.voting-timer,
.runoff-timer,
.quick-panel-timer {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 18px 0 !important;
    padding: 8px 16px;
    color: #edf1f4 !important;
    font-family: "SFMono-Regular", "Roboto Mono", "Courier New", monospace;
    font-size: 28px !important;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    line-height: 1;
    text-shadow: 0 0 12px rgba(231, 235, 239, 0.16), 0 2px 5px rgba(0, 0, 0, 0.55);
    background: linear-gradient(180deg, #0a0d10, #15191d);
    animation: none !important;
}

.quick-panel-backdrop.hidden {
    display: block;
    visibility: hidden;
}

.quick-panel-backdrop.visible {
    visibility: visible;
}

/* ============================================================
   APEX ACCOUNT AUTH
   ============================================================
*/

#account-login-panel,
#account-create-panel {
    margin-top: auto;
}

.account-auth-form {
    flex-direction: column;
}

#login-username,
#login-password,
#create-username,
#create-email,
#create-password,
#create-password-confirm {
    width: 100%;
    min-height: 48px;
    outline: none;
    background: transparent;
    color: #e7ebef;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.04em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#login-username::placeholder,
#login-password::placeholder,
#create-username::placeholder,
#create-email::placeholder,
#create-password::placeholder,
#create-password-confirm::placeholder {
    color: rgba(231, 235, 239, 0.42);
}

#login-username:focus,
#login-password:focus,
#create-username:focus,
#create-email:focus,
#create-password:focus,
#create-password-confirm:focus {
    border-bottom-color: #ffffff !important;
}

#login-button,
#create-account-submit {
    margin-top: 6px;
}

.login-secondary-button {
    font-family: "Oswald", "Arial Narrow", sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

.login-secondary-button:hover {
    border-color: rgba(231, 235, 239, 0.55);
    color: #e7ebef;
}

.join-game-bucket {
    width: 100%;
    margin: 0 0 26px;
}

.join-game-bucket:last-child {
    margin-bottom: 0;
}

.join-game-bucket-heading {
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(231, 235, 239, 0.13);
    text-transform: uppercase;
}

.join-game-bucket-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* APEX 1.50: personal history records */
.history-item {
    padding: 16px 0;
}

.history-item:last-child {
    border-bottom: 0;
}

.history-item h3 {
    margin: 0 0 7px;
    font-size: 15px;
}

.history-item p {
    margin: 0 0 6px;
    color: #c0c6cc;
    font-size: 13px;
    line-height: 1.5;
}

.history-item small {
    color: #8d969f;
    font-size: 11px;
}

#save-game-button {
    margin: 8px 0;
    font-weight: 800;
}

#save-game-button:disabled {
    opacity: 0.55;
}

/* ============================================================
   APEX LUXE THEME (final layer, overrides everything above)
   Oxblood black, champagne gold, ivory. Layout and UI only.
   ============================================================
*/

:root {
    --lx-gold-hi: #e4ecf7;
    --lx-ivory: #e6ebf2;
    --lx-muted: #9aa6b8;
    --lx-card: rgba(9, 15, 30, .88);
    --lx-serif: "Cormorant Garamond", "Cinzel", Georgia, serif;
    --lx-caps: "Cinzel", Georgia, serif;
    --lx-sans: "Jost", "Helvetica Neue", Arial, sans-serif;
    --pyramid-panel: #0b1424;
    --pyramid-silver: var(--lx-ivory);
    --pyramid-silver-muted: var(--lx-muted);
}

body {
    color: var(--lx-ivory);
    font-family: var(--lx-serif);
    font-size: 18px;
}

/* film grain over everything, never blocks taps */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

p,
label,
li,
small,
span,
div {
    font-family: inherit;
}

/* ---------- Layout: a centred, airy column ---------- */

.app {
    max-width: 560px;
    margin: 0 auto;
    padding: 18px 16px 60px;
}

.screen {
    gap: 18px;
}

/* ---------- Header as a gilded crest ---------- */

.game-header h1,
.login-brand h1 {
    font-family: var(--lx-caps) !important;
    font-weight: 800 !important;
    letter-spacing: 0.5em !important;
    text-indent: 0.5em;
    background: linear-gradient(180deg, var(--lx-gold-hi), var(--lx-gold) 55%, var(--lx-gold-lo));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--lx-gold) !important;
    text-shadow: none !important;
}

#game-status {
    font-family: var(--lx-sans) !important;
    font-size: 11px !important;
    letter-spacing: 0.3em !important;
    text-transform: uppercase;
    color: var(--lx-muted) !important;
}

.pyramid-3d__face {
    border: 1px solid var(--lx-gold) !important;
    filter: drop-shadow(0 0 3px rgba(174, 187, 208, 0.7)) !important;
    box-shadow: 0 0 6px rgba(174, 187, 208, 0.45) !important;
}

.game-header .game-logo .pyramid-3d__face--front,
.game-header .game-logo .pyramid-3d__face--right,
.game-header .game-logo .pyramid-3d__face--back,
.game-header .game-logo .pyramid-3d__face--left {
    background:
        linear-gradient(to bottom, transparent 0 24.5%, var(--lx-gold) 24.5% 25.5%, transparent 25.5% 49.5%, var(--lx-gold) 49.5% 50.5%, transparent 50.5% 74.5%, var(--lx-gold) 74.5% 75.5%, transparent 75.5% 100%),
        linear-gradient(160deg, #1b2a52, #09112a) !important;
}

.game-header .game-logo .pyramid-3d__face--right {
    filter: brightness(1.25) drop-shadow(0 0 3px rgba(174, 187, 208, 0.7)) !important;
}

.game-header .game-logo .pyramid-3d__face--left {
    filter: brightness(0.8) drop-shadow(0 0 3px rgba(174, 187, 208, 0.7)) !important;
}

/* ---------- Cards, modals, panels ---------- */

.card,
.modal-card {
    position: relative;
    background:
        linear-gradient(160deg, rgba(228, 236, 247, 0.06), transparent 40%),
        var(--lx-card) !important;
    backdrop-filter: blur(6px);
}

.card h2,
.modal-card h2,
.join-game-header h2,
.history-header h2,
.lobby-entry h2,
.lobby-roster h2 {
    font-family: var(--lx-caps) !important;
    font-weight: 700 !important;
    font-size: 1.35rem !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase;
    color: var(--lx-gold-hi) !important;
    text-shadow: 0 2px 14px rgba(174, 187, 208, 0.25);
}

.card h2::after,
.lobby-entry h2::after {
    content: "";
    width: 64px;
    height: 1px;
    margin: 10px 0 4px;
    background: linear-gradient(90deg, var(--lx-gold), transparent);
}

.card p,
.lobby-subtitle,
.lobby-hint,
.modal-card p,
.join-game-header p,
.history-header p {
    font-family: var(--lx-serif) !important;
    font-size: 1.08rem !important;
    line-height: 1.5;
    color: var(--lx-ivory) !important;
    opacity: 0.9;
}

.lobby-kicker,
.join-game-kicker,
.modal-kicker,
.login-kicker,
.quick-panel-label,
.lobby-player-count,
.lobby-population-status,
.lobby-pyramid-caption {
    font-family: var(--lx-sans) !important;
    font-weight: 500;
    letter-spacing: 0.32em !important;
    text-transform: uppercase;
    color: var(--lx-gold) !important;
}

.message,
.login-message,
.login-note {
    color: var(--lx-muted) !important;
    font-style: italic;
}

/* ---------- Inputs ---------- */

input[type="text"],
input[type="email"],
input[type="password"],
select {
    font-family: var(--lx-serif) !important;
    font-size: 1.15rem !important;
    color: var(--lx-ivory) !important;
    background: rgba(6, 10, 20, 0.6) !important;
}

input::placeholder {
    color: rgba(230, 235, 242, 0.45) !important;
    font-style: italic;
}

input:focus,
select:focus {
    border-color: var(--lx-gold-hi) !important;
}

/* ---------- Buttons ---------- */

button {
    font-family: var(--lx-sans) !important;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

#login-button,
#create-account-submit,
#host-game-button,
#join-game-button,
#enter-created-game-button,
#start-game-button,
#reveal-first-round-button,
#start-runoff-button,
#reveal-runoff-button,
#save-game-button,
#reset-game-button,
#confirm-voting-duration,
.join-game-select-button {
    color: #0d1522 !important;
    background: linear-gradient(180deg, var(--lx-gold-hi), var(--lx-gold) 55%, var(--lx-gold-lo)) !important;
    border: 1px solid var(--lx-gold-hi) !important;
    border-radius: 3px !important;
    box-shadow:
        0 8px 22px rgba(174, 187, 208, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.55) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

#reset-game-button {
    filter: saturate(0.55) brightness(0.85);
}

.secondary-button,
.login-secondary-button,
#cancel-voting-duration {
    color: var(--lx-gold-hi) !important;
    box-shadow: none !important;
}

.secondary-button:hover:not(:disabled),
.login-secondary-button:hover:not(:disabled) {
    background: rgba(174, 187, 208, 0.1) !important;
    border-color: var(--lx-gold) !important;
}

button:hover:not(:disabled) {
    filter: brightness(1.08);
}

button:disabled {
    opacity: 0.45;
}

.quick-nav-button,
.account-menu-button,
.quick-panel-close,
#pyramid-audio-control {
    color: var(--lx-gold-hi) !important;
    background: linear-gradient(145deg, #16233f, #070d1c) !important;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(228, 236, 247, 0.18) !important;
}

.account-menu,
.quick-panel {
    background: linear-gradient(180deg, #0f1930, #060b17) !important;
    color: var(--lx-ivory) !important;
}

.account-menu button,
.quick-panel-nav-button {
    color: var(--lx-ivory) !important;
}

/* ---------- Lobby ---------- */

.lobby-tier {
    stroke: rgba(174, 187, 208, 0.4) !important;
}

.lobby-tier.lit {
    fill: rgba(174, 187, 208, 0.38) !important;
    stroke: var(--lx-gold-hi) !important;
    filter: drop-shadow(0 0 7px rgba(228, 236, 247, 0.7)) !important;
}

@keyframes lobby-ready {
    0%, 100% {
        filter: drop-shadow(0 0 3px rgba(174, 187, 208, 0.35));
    }
    50% {
        filter: drop-shadow(0 0 18px rgba(228, 236, 247, 0.9));
    }
}

.lobby-roster {
    background: var(--lx-card) !important;
}

#player-list .lobby-player,
#player-list li,
#voting-player-list li {
    background: linear-gradient(90deg, rgba(174, 187, 208, 0.08), transparent) !important;
    color: var(--lx-ivory) !important;
}

.lobby-player-number {
    color: var(--lx-gold) !important;
    font-family: var(--lx-caps) !important;
}

.lobby-player-name {
    font-family: var(--lx-serif) !important;
    font-size: 1.15rem;
}

.lobby-player-tag {
    color: var(--lx-gold-hi) !important;
}

/* ---------- Voting and results ---------- */

.vote-player {
    font-family: var(--lx-serif) !important;
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    text-transform: none;
    color: var(--lx-ivory) !important;
    background: linear-gradient(145deg, rgba(60, 20, 38, 0.8), rgba(20, 8, 14, 0.9)) !important;
}

.vote-player:hover:not(:disabled) {
    border-color: var(--lx-gold) !important;
    transform: translateY(-1px);
}

.vote-player.selected {
    background: linear-gradient(145deg, rgba(174, 187, 208, 0.34), rgba(120, 70, 20, 0.35)) !important;
    border-color: var(--lx-gold-hi) !important;
    color: #fff7e4 !important;
}

.voting-timer,
.runoff-timer {
    font-family: var(--lx-caps) !important;
    color: var(--lx-gold-hi) !important;
    letter-spacing: 0.2em;
}

#vote-progress,
#runoff-progress {
    font-family: var(--lx-sans) !important;
    letter-spacing: 0.2em;
    color: var(--lx-gold) !important;
}

/* ---------- Misc ---------- */

.history-item h3 {
    font-family: var(--lx-caps) !important;
    color: var(--lx-gold-hi) !important;
    letter-spacing: 0.08em;
}

.global-message {
    font-family: var(--lx-sans) !important;
    color: var(--lx-gold-hi) !important;
    background: #101a30 !important;
}

.modal-backdrop {
    background: rgba(10, 4, 7, 0.78) !important;
}

::selection {
    background: var(--lx-gold);
    color: #0d1522;
}

/* Lobby nickname form: visible submit button */
#registration-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================================
   ALIGNMENT FIXES (v1.52)
   ============================================================
*/

.game-logo-frame {
    margin: 10px auto 6px !important;
}

.account-menu-wrapper {
    top: 14px !important;
    right: 14px !important;
}

.quick-nav-button {
    top: 14px !important;
    left: 14px !important;
}

/* icon buttons: cancel the wide letter-spacing that pushed glyphs off centre */
.account-menu-button,
.quick-panel-close {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    letter-spacing: 0 !important;
    text-indent: 0 !important;
    text-transform: none !important;
    font-family: Arial, Helvetica, sans-serif !important;
    line-height: 1 !important;
    text-align: center;
}

.account-menu-button {
    width: 38px !important;
    height: 38px !important;
    font-size: 20px !important;
}

.quick-nav-button {
    width: 38px !important;
    height: 38px !important;
}

.quick-panel-close {
    width: 38px !important;
    height: 38px !important;
    font-size: 24px !important;
    padding-bottom: 2px !important;
}

/* host / join: no big frame, sits lower */
.entry-card {
    background: none !important;
    backdrop-filter: none !important;
    margin-top: 40px !important;
    padding: 0 6px !important;
    text-align: center;
}

.entry-card h2::after {
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(90deg, transparent, var(--lx-gold), transparent);
}

.entry-card .entry-actions {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

/* lobby pyramid sits inside the same gilded frame as the other panels */
.lobby-chamber {
    padding: 24px 0 18px !important;
    background:
        radial-gradient(ellipse at 50% 52%, rgba(174, 187, 208, 0.14), transparent 68%),
        var(--lx-card) !important;
}

/* ============================================================
   LAYOUT FLAIR (v1.53): compact buttons, action rows, cards,
   menus, timer. Palette variables come from the theme above.
   ============================================================
*/

/* ---- compact buttons ---- */

#start-game-button,
#reveal-first-round-button,
#start-runoff-button,
#reveal-runoff-button,
#save-game-button,
#reset-game-button,
#confirm-voting-duration,
#cancel-voting-duration,
#host-game-button,
#join-game-button,
#enter-created-game-button,
.join-game-select-button {
    width: auto !important;
}

#host-controls button,
#voting-host-controls button,
#review-host-controls button,
#runoff-host-controls button,
#results-host-controls button {
    display: block;
    margin: 18px auto 0;
}

/* ---- host / join: description left, small button right ---- */

.entry-actions {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 18px;
    padding: 18px 20px;
    text-align: left;
    background: linear-gradient(100deg, rgba(174, 187, 208, 0.09), rgba(6, 10, 20, 0.35));
}

.action-copy {
    flex: 1 1 190px;
}

.action-copy h3 {
    margin: 0 0 5px;
    font-family: var(--lx-caps);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lx-gold-hi);
}

.action-copy p {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.35;
    opacity: 0.78;
}

.action-row button {
    flex: 0 0 auto;
}

/* ---- session cards (games you're in / available games) ---- */

.join-game-bucket-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--lx-sans) !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.34em !important;
    color: var(--lx-gold) !important;
}

.join-game-bucket-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--lx-line), transparent);
}

.join-game-card {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 16px 16px 22px !important;
    overflow: hidden;
    background: linear-gradient(100deg, rgba(174, 187, 208, 0.1), rgba(6, 10, 20, 0.4)) !important;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.join-game-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--lx-gold-hi), var(--lx-gold-lo));
}

.join-game-card:hover {
    transform: translateY(-2px);
    border-color: var(--lx-gold) !important;
}

.join-game-information {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 4px;
}

.join-game-section {
    font-family: var(--lx-caps);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--lx-gold-hi);
}

.join-game-number {
    font-family: var(--lx-sans);
    font-size: 0.66rem;
    letter-spacing: 0.3em;
    color: var(--lx-gold);
}

.join-game-players {
    font-style: italic;
    font-size: 1rem;
    color: var(--lx-muted);
}

.join-game-phase {
    width: max-content;
    margin-top: 4px;
    padding: 3px 11px;
    font-family: var(--lx-sans);
    font-size: 0.6rem;
    letter-spacing: 0.26em;
    color: var(--lx-gold-hi);
    background: rgba(174, 187, 208, 0.1);
}

/* ---- menu button, hamburger and dropdown ---- */

.account-menu-button,
.quick-nav-button {
    border-radius: 50% !important;
    border: 1px solid rgba(174, 187, 208, 0.5) !important;
    background: radial-gradient(circle at 35% 30%, #1d2e52, #080e1f) !important;
    box-shadow:
        0 0 0 3px rgba(6, 10, 20, 0.8),
        0 0 16px rgba(174, 187, 208, 0.22),
        inset 0 1px 0 rgba(228, 236, 247, 0.25) !important;
}

.quick-nav-button {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 0 0 0 10px !important;
}

.quick-nav-button span {
    display: block;
    width: 18px !important;
}

.quick-nav-button span:nth-child(2) {
    width: 13px !important;
}

.quick-nav-button span:nth-child(3) {
    width: 8px !important;
}

.account-menu {
    min-width: 200px;
}

.account-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 14px;
    width: 10px;
    height: 10px;
    transform: rotate(45deg);
    background: #16233f;
    border-left: 1px solid var(--lx-line);
    border-top: 1px solid var(--lx-line);
}

.account-menu button {
    width: 100%;
    text-align: left;
    font-size: 0.7rem !important;
    transition: padding-left 0.2s ease, background 0.2s ease;
}

.account-menu button:last-child {
    border-bottom: none !important;
}

.account-menu button:hover:not(:disabled) {
    padding-left: 20px !important;
}

/* ---- timer and progress ---- */

.voting-timer,
.runoff-timer {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 16px auto !important;
    padding: 10px 28px;
    font-size: 1.8rem !important;
    font-variant-numeric: tabular-nums;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(174, 187, 208, 0.16), rgba(6, 10, 20, 0.7));
}

.voting-timer:empty,
.runoff-timer:empty {
    display: none;
}

#vote-progress,
#runoff-progress {
    text-align: center;
    font-size: 0.72rem !important;
}

/* ---- cards: top glint, and a ribbon for host controls ---- */

.card::before,
.modal-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--lx-gold-hi), transparent);
    opacity: 0.7;
}

#host-controls,
#voting-host-controls,
#review-host-controls,
#runoff-host-controls,
#results-host-controls {
    text-align: center;
}

#host-controls h2::after,
#voting-host-controls h2::after,
#review-host-controls h2::after,
#runoff-host-controls h2::after,
#results-host-controls h2::after,
.modal-card h2::after {
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(90deg, transparent, var(--lx-gold), transparent);
}

/* ---- voting-time modal ---- */

.modal-card {
    text-align: center;
    padding: 28px 22px !important;
}

.modal-card h2 {
    font-size: 1.2rem !important;
}

div:has(>#confirm-voting-duration) {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}

#voting-duration-select {
    text-align: center;
    margin-top: 14px;
}

/* ---- side drawer ---- */

.quick-panel-nav-button {
    font-family: var(--lx-caps) !important;
    background: linear-gradient(100deg, rgba(174, 187, 208, 0.1), transparent) !important;
}

.quick-panel-drawer-title {
    font-family: var(--lx-caps) !important;
    letter-spacing: 0.3em;
    color: var(--lx-gold-hi) !important;
}

/* ============================================================
   APEX 1.52 — SIGN-IN DISCOVERY PAGE + SESSION MENU ACTIONS
   ============================================================
*/

#login-screen {
    position: relative !important;
    inset: auto !important;
    min-height: 100dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 0;
    padding: clamp(24px, 5vw, 58px) 18px 64px;
    overflow: visible;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(174, 187, 208, 0.14), transparent 45%),
        radial-gradient(ellipse at 100% 70%, rgba(30, 50, 98, 0.18), transparent 48%),
        #060a14 !important;
}

.login-card {
    flex: 0 0 auto;
    width: min(100%, 470px);
    min-height: 0;
    justify-content: flex-start;
    padding: 28px clamp(18px, 4vw, 36px) 32px;
    background: linear-gradient(155deg, rgba(18, 24, 37, 0.9), rgba(4, 7, 13, 0.92)) !important;
}

.login-brand {
    margin-bottom: 0;
}

.login-kicker {
    margin: 0;
}

#account-login-panel,
#account-create-panel {
    width: 100%;
}

.account-auth-form {
    width: 100%;
    display: grid;
    gap: 12px;
}

.account-auth-form input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: #edf1f6;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(174, 187, 208, 0.25);
    border-radius: 3px;
}

.account-auth-form input:focus {
    outline: 1px solid rgba(228, 236, 247, 0.7);
    border-color: rgba(228, 236, 247, 0.7);
}

#login-button,
#create-account-submit {
    font-family: "Oswald", sans-serif;
    font-weight: 600;
}

.login-secondary-button {
    margin-top: 10px;
}

.login-note {
    line-height: 1.55;
}

.login-showcase {
    width: min(100%, 1040px);
    margin: 58px auto 0;
    color: #e8edf4;
}

.showcase-heading {
    max-width: 720px;
    margin: 0 auto 42px;
    text-align: center;
}

.showcase-kicker {
    color: #9eafc5;
    font: 600 10px/1.5 "Oswald", sans-serif;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.showcase-heading h2 {
    margin: 12px 0;
    font: 700 clamp(28px, 5vw, 48px)/1.12 "Cinzel", Georgia, serif;
    letter-spacing: -0.025em;
}

.showcase-heading>p:last-child {
    max-width: 610px;
    margin: 0 auto;
    color: #a7b1c0;
    line-height: 1.7;
}

.showcase-results,
.showcase-faq,
.showcase-rules {
    margin-top: 34px;
    padding: clamp(20px, 4vw, 34px);
    background: linear-gradient(145deg, rgba(17, 24, 38, 0.8), rgba(6, 10, 18, 0.78));
}

.showcase-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 18px;
}

.showcase-section-heading h3 {
    margin: 5px 0 0;
    font: 700 clamp(21px, 3.4vw, 30px)/1.2 "Cinzel", Georgia, serif;
}

.example-badge {
    flex: 0 0 auto;
    padding: 6px 9px;
    color: #c8d3e2;
    font: 500 9px "Oswald", sans-serif;
    letter-spacing: 0.12em;
}

.showcase-disclaimer {
    margin: 0 0 20px;
    color: #9ca8b8;
    font-size: 13px;
    line-height: 1.6;
}

.result-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.result-snapshot {
    min-width: 0;
    padding: 20px;
    background: rgba(2, 4, 8, 0.4);
}

.snapshot-label {
    color: #8e9db1;
    font: 500 9px "Oswald", sans-serif;
    letter-spacing: 0.16em;
}

.result-snapshot h4 {
    margin: 8px 0 14px;
    font: 600 21px "Cinzel", Georgia, serif;
}

.snapshot-stats {
    display: flex;
    gap: 22px;
    margin-bottom: 16px;
    color: #9faaba;
    font-size: 12px;
}

.snapshot-stats strong {
    display: block;
    color: #f0f3f7;
    font: 600 21px "Oswald", sans-serif;
}

.snapshot-grade-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    color: #bdc6d3;
    font-size: 12px;
}

.snapshot-grade-row>strong {
    color: #8290a4;
    font: 500 9px "Oswald", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.grade {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    font: 700 16px "Oswald", sans-serif;
}

.snapshot-bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 7px;
    color: #b9c3d1;
    font-size: 12px;
}

.snapshot-bar-label span:last-child {
    color: #7e8b9d;
    font-size: 10px;
}

.snapshot-bar {
    height: 6px;
    background: rgba(174, 187, 208, 0.12);
}

.snapshot-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #697d98, #d6dfea);
}

.snapshot-footnote {
    color: #8f9caf;
    font-size: 12px;
    line-height: 1.6;
}

.apex-faq:last-child {
    border-bottom: 1px solid rgba(174, 187, 208, 0.18);
}

.apex-faq summary {
    position: relative;
    padding: 19px 28px 19px 0;
    cursor: pointer;
    list-style: none;
    color: #e7edf5;
    font: 500 16px "Oswald", sans-serif;
    letter-spacing: 0.035em;
}

.apex-faq summary::-webkit-details-marker {
    display: none;
}

.apex-faq summary::after {
    content: "+";
    position: absolute;
    right: 2px;
    top: 15px;
    color: #aab9cd;
    font-size: 23px;
}

.apex-faq[open] summary::after {
    content: "−";
}

.apex-faq p {
    max-width: 850px;
    margin: 0;
    padding: 0 22px 20px 0;
    color: #aab5c5;
    line-height: 1.75;
    font-size: 14px;
}

.showcase-rules>p {
    color: #aab5c5;
    line-height: 1.7;
}

.public-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.public-rules-grid article {
    padding: 18px;
    background: rgba(2, 4, 8, 0.28);
}

.public-rules-grid article>span {
    color: #9eafc5;
    font: 500 11px "Oswald", sans-serif;
    letter-spacing: 0.14em;
}

.public-rules-grid h4 {
    margin: 8px 0;
    font: 600 16px "Oswald", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.public-rules-grid p {
    margin: 0;
    color: #a7b2c1;
    font-size: 13px;
    line-height: 1.7;
}

.account-menu {
    z-index: 10001;
}

#back-to-lobby-menu-button {
    color: #dce5f0;
}

@media (max-width: 650px) {
    #login-screen {
        padding: 18px 12px 42px;
    }

    .login-card {
        padding: 24px 18px;
    }

    .login-showcase {
        margin-top: 42px;
    }

    .showcase-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-snapshot-grid,
    .public-rules-grid {
        grid-template-columns: 1fr;
    }

    .result-snapshot {
        padding: 16px;
    }

    .snapshot-grade-row {
        grid-template-columns: 32px minmax(0, 1fr) auto;
    }
}

/* ============================================================
   APEX AUTH LOADING FEEDBACK
   ============================================================
*/

.auth-progress[hidden],
.auth-status[hidden] {
    display: none !important;
}

#login-button.is-loading,
#create-account-submit.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--lx-gold-hi) !important;
    background: linear-gradient(180deg, #121c31, #0b1424) !important;
    border-color: rgba(228, 236, 247, 0.55) !important;
    box-shadow:
        0 0 18px rgba(174, 187, 208, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    text-shadow: none;
    opacity: 1;
    cursor: progress;
}

.auth-ring {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(174, 187, 208, 0.25);
    border-top-color: var(--lx-gold-hi);
    border-right-color: rgba(228, 236, 247, 0.6);
    box-shadow: 0 0 8px rgba(228, 236, 247, 0.25);
    animation: apexAuthSpin 0.8s linear infinite;
}

@keyframes apexAuthSpin {
    to {
        transform: rotate(360deg);
    }
}

.auth-progress {
    position: relative;
    height: 2px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(174, 187, 208, 0.14);
}

.auth-progress span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 38%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--lx-gold-hi), transparent);
    box-shadow: 0 0 8px rgba(228, 236, 247, 0.5);
    animation: apexAuthSlide 1.3s ease-in-out infinite;
}

@keyframes apexAuthSlide {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(263%);
    }
}

.auth-status {
    margin: 0;
    text-align: center;
    font: 500 11px/1.5 "Oswald", sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lx-muted);
    animation: apexAuthFade 0.25s ease;
}

.auth-status.is-success {
    color: var(--lx-gold-hi);
}

@keyframes apexAuthFade {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-ring {
        animation-duration: 2s;
    }

    .auth-progress span {
        animation: none;
        width: 100%;
        opacity: 0.6;
    }

    .auth-status {
        animation: none;
    }
}

/* ============================================================
   PASSWORD SHOW/HIDE + LIVE RULES CHECKLIST
   ============================================================
*/

.password-field {
    position: relative;
    width: 100%;
}

.password-field .password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    width: auto;
    margin: 0;
    padding: 0 12px;
    transform: translateY(-50%);
    font-family: "Oswald", sans-serif !important;
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--lx-gold) !important;
    border: 1px solid transparent !important;
    border-radius: 3px;
}

.password-field .password-toggle:hover:not(:disabled),
.password-field .password-toggle:focus-visible {
    color: var(--lx-gold-hi) !important;
    background: rgba(174, 187, 208, 0.1) !important;
    border-color: rgba(174, 187, 208, 0.4) !important;
}

.password-field .password-toggle:active {
    transform: translateY(-50%) scale(0.98);
}

.password-rules {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
}

.password-rules li {
    position: relative;
    padding-left: 20px;
    font: 500 11px/1.4 "Jost", sans-serif;
    letter-spacing: 0.06em;
    color: var(--lx-muted);
    transition: color 0.2s ease;
}

.password-rules li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(174, 187, 208, 0.45);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.password-rules li.is-met {
    color: var(--lx-gold-hi);
}

.password-rules li.is-met::before {
    background: var(--lx-gold-hi);
    border-color: var(--lx-gold-hi);
    box-shadow: 0 0 6px rgba(228, 236, 247, 0.4);
}

.pw-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   INVITE LINKS
   ============================================================
*/

.invite-banner {
    margin: 0;
    padding: 12px 14px;
    text-align: center;
    font: 500 11px/1.6 "Oswald", sans-serif;
    letter-spacing: 0.14em;
    color: var(--lx-gold-hi);
    background: rgba(174, 187, 208, 0.08);
}

.invite-block {
    display: grid;
    gap: 10px;
    width: 100%;
    margin: 14px 0;
    text-align: left;
}

.invite-label {
    font: 600 10px/1.5 "Oswald", sans-serif;
    letter-spacing: 0.22em;
    color: var(--lx-gold);
}

.invite-link-field {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
    letter-spacing: 0;
    text-overflow: ellipsis;
    user-select: all;
    -webkit-user-select: all;
}

.invite-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 10px;
}

.invite-actions button {
    min-height: 44px;
    margin-top: 0;
}

.invite-feedback {
    min-height: 1.2em;
    margin: 0;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--lx-gold-hi);
}

/* APEX 1.52 — compact host administration inside the navigation drawer */
.host-menu-game-name {
    margin: 0 0 16px;
    color: var(--pyramid-silver-muted);
    font-size: 13px;
    line-height: 1.5;
}

.host-menu-passkey {
    display: grid;
    gap: 8px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.025);
}

.host-menu-passkey strong {
    color: #fff;
    font-family: "Oswald", sans-serif;
    font-size: 22px;
    letter-spacing: 0.14em;
    overflow-wrap: anywhere;
}

.host-terminate-zone {
    margin-top: 28px;
    padding-top: 18px;
}

.host-terminate-zone>p:first-child {
    color: var(--pyramid-silver-muted);
    font-size: 12px;
    line-height: 1.6;
}

.host-terminate-button {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(220, 95, 95, 0.65) !important;
    letter-spacing: 0.12em;
}

.host-terminate-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   APEX 1.53 — POST-LOGIN VIEWPORT / MOBILE OVERSCROLL FIX
   ============================================================
*/

html {
    min-height: 100%;
    background-color: #060b17;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

.app {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.app>.screen {
    width: 100%;
    min-width: 0;
}

.card,
.modal-card,
.login-card,
.entry-card,
.lobby-chamber,
.lobby-roster,
.showcase-faq,
.showcase-results,
.showcase-rules,
.result-snapshot {
    border: 0 !important;
    border-radius: var(--soft-lg) !important;
    box-shadow: var(--soft-shadow) !important;
}

.join-game-card,
.history-item,
.apex-faq,
.public-rules-grid article,
.runoff-results-section,
.grade-result,
.grade-group,
.host-terminate-zone,
.host-menu-passkey,
.invite-banner,
.global-message,
.quick-panel-timer,
.voting-timer,
.runoff-timer,
.quick-panel-rules p,
.vote-player,
.quick-player-row,
.runoff-score-row,
.snapshot-grade-row,
.lobby-roster-header,
#player-list li,
#player-list .lobby-player,
#voting-player-list li,
.action-row {
    border: 0 !important;
    border-radius: var(--soft-md) !important;
    box-shadow: none !important;
    background-color: var(--soft-fill) !important;
}

.vote-player.selected {
    background-color: rgba(190, 206, 240, 0.22) !important;
    box-shadow: 0 0 0 2px rgba(200, 214, 242, 0.55) !important;
}

.grade,
.grade-group-badge,
.example-badge,
.lobby-player-tag,
.lobby-player-count,
.join-game-phase,
.quick-panel-nav-index,
.grade-progress-track,
.grade-progress-track>* {
    border: 0 !important;
    border-radius: 999px !important;
}

.card h2::after,
.lobby-entry h2::after,
.account-menu::before,
.game-header::before,
.card::before,
.modal-card::before {
    display: none !important;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
.invite-link-field,
.modal-card select {
    border: 0 !important;
    border-radius: var(--soft-md) !important;
    background-color: var(--soft-fill) !important;
    box-shadow: none !important;
    text-align: left !important;
    padding-left: 20px !important;
}

input:focus,
select:focus {
    outline: none !important;
    box-shadow: var(--soft-ring) !important;
}

.password-field input {
    padding-right: 84px !important;
}

button,
.secondary-button,
.login-secondary-button {
    border: 0 !important;
    border-radius: 24px !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25) !important;
}

button {
    background: rgba(160, 180, 220, 0.14);
}

.secondary-button,
.login-secondary-button,
#cancel-voting-duration {
    background: var(--soft-fill) !important;
}

.password-field .password-toggle {
    box-shadow: none !important;
    background: transparent !important;
}

.login-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}

.login-card>* {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.login-kicker {
    text-align: center;
}

.apex-hero-logo .pyramid-3d::after {
    width: calc(var(--hero) * 0.73);
    height: calc(var(--hero) * 0.12);
    bottom: calc(var(--hero) * -0.1);
}

/* Older rules that target elements by id */
#back-to-lobby-menu-button,
#cancel-voting-duration,
#confirm-voting-duration,
#create-account-submit,
#enter-created-game-button,
#host-game-button,
#join-game-button,
#login-button,
#pyramid-audio-control,
#register-player-button,
#reset-game-button,
#reveal-first-round-button,
#reveal-runoff-button,
#save-game-button,
#start-game-button,
#start-runoff-button {
    border: 0 !important;
    border-radius: 24px !important;
}

#create-email,
#create-password,
#create-password-confirm,
#create-username,
#login-password,
#login-username,
#review-duration-select,
#player-count {
    border: 0 !important;
    border-radius: var(--soft-md) !important;
    background-color: var(--soft-fill) !important;
    box-shadow: none !important;
    text-align: left !important;
    padding: 12px 20px !important;
}

#login-password,
#create-password,
#create-password-confirm {
    padding-right: 84px !important;
}

#login-username:focus,
#login-password:focus,
#create-username:focus,
#create-email:focus,
#create-password:focus,
#create-password-confirm:focus {
    box-shadow: var(--soft-ring) !important;
}

#account-login-panel,
#account-create-panel {
    padding-top: 6px;
}

/* APEX 1.54 SOFT UI (sign-in, lobby, profile, results, header).
   Keep this block LAST in style.css.
*/

:root {
    --soft-lg: 30px;
    --soft-md: 20px;
    --soft-fill: rgba(150, 170, 210, .10);
    --soft-shadow: 0 14px 40px rgba(0, 0, 0, .38);
    --tiers: linear-gradient(to bottom, transparent 0 24%, rgba(255,255,255,.2) 24% 25%, transparent 25% 49%, rgba(255,255,255,.2) 49% 50%, transparent 50% 74%, rgba(255,255,255,.2) 74% 75%, transparent 75%);
}

body {
    background:
        radial-gradient(900px 520px at 50% -8%, rgba(174, 187, 208, 0.12), transparent 62%),
        radial-gradient(720px 560px at 105% 105%, rgba(30, 50, 98, 0.30), transparent 62%),
        linear-gradient(180deg, #060b17, #02040a) !important;
    background-attachment: fixed !important;
}

body::after {
    opacity: 0.035;
}

/* Game shell never shows under the sign-in page */
#login-screen:not(.hidden)~.app {
    display: none !important;
}

/* Spinning pyramid */
@keyframes apex-logo-spin {
    from {
        transform: rotateX(-14deg) rotateY(0deg);
    }
    to {
        transform: rotateX(-14deg) rotateY(360deg);
    }
}

.pyramid-3d.game-logo {
    animation: apex-logo-spin 10s linear infinite !important;
}

:is(.apex-hero-logo,.game-logo-frame) .pyramid-3d.game-logo .pyramid-3d__face {
    top: calc(var(--pyramid-height) * -0.24);
    height: calc(var(--pyramid-height) * 1.24);
    border: 0 !important;
    box-shadow: none !important;
    filter: none !important;
}

:is(.apex-hero-logo,.game-logo-frame) .pyramid-3d.game-logo .pyramid-3d__face--front {
    background:
        var(--tiers),
        linear-gradient(165deg, #e2ebf8, #7d92ba) !important;
    transform: rotateY(0deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

:is(.apex-hero-logo,.game-logo-frame) .pyramid-3d.game-logo .pyramid-3d__face--right {
    background:
        var(--tiers),
        linear-gradient(165deg, #c6d4ec, #667ca6) !important;
    transform: rotateY(90deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

:is(.apex-hero-logo,.game-logo-frame) .pyramid-3d.game-logo .pyramid-3d__face--back {
    background:
        var(--tiers),
        linear-gradient(165deg, #9fb2d4, #4f6590) !important;
    transform: rotateY(180deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

:is(.apex-hero-logo,.game-logo-frame) .pyramid-3d.game-logo .pyramid-3d__face--left {
    background:
        var(--tiers),
        linear-gradient(165deg, #b4c5e4, #5a7099) !important;
    transform: rotateY(270deg) translateZ(calc(var(--pyramid-size) / 2)) rotateX(26.565deg);
}

@media (prefers-reduced-motion: reduce) {
    .pyramid-3d.game-logo {
        animation: none !important;
        transform: rotateX(-14deg) rotateY(28deg);
    }
}

/* Sign-in wordmark: the pyramid is the A */
.apex-hero {
    --word: clamp(52px, 17vw, 78px);
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
}

.apex-hero-logo {
    --hero: calc(var(--word) * .84);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--hero) * 1.4);
    height: calc(var(--hero) * 1.25);
    margin-right: calc(var(--word) * 0.02);
    perspective: 420px;
    filter: drop-shadow(0 8px 14px rgba(90, 120, 190, 0.4));
}

.apex-hero-logo .pyramid-3d.game-logo {
    --pyramid-size: var(--hero);
    --pyramid-height: calc(var(--hero) * .893);
}

.apex-hero-logo .pyramid-3d::after {
    display: none;
}

.login-brand .apex-hero-word {
    margin: 0 calc(var(--word) * -0.1) 0 0 !important;
    font-size: var(--word) !important;
    letter-spacing: 0.1em !important;
    text-indent: 0 !important;
    line-height: 1 !important;
}

/* Title bar */
.game-header {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 30;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    column-gap: 8px;
    margin: 0 0 18px !important;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: var(--soft-lg) !important;
    background: rgba(16, 26, 50, 0.66) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4) !important;
}

.game-header.hidden {
    display: none !important;
}

.game-header h1,
.game-header::before,
.account-menu::before {
    display: none !important;
}

.game-header .quick-nav-button {
    position: static;
    grid-column: 1;
    grid-row: 1;
}

.game-header .account-menu-wrapper {
    position: relative;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
}

.game-header .game-logo-frame {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: 56px;
    height: 48px;
    margin: 0;
    perspective: 260px;
    filter: drop-shadow(0 6px 10px rgba(90, 120, 190, 0.35));
}

.game-header .pyramid-3d.game-logo {
    --pyramid-size: 38px;
    --pyramid-height: 34px;
}

.game-header .pyramid-3d::after {
    display: none;
}

.game-header #game-status {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0;
    padding: 2px 0 6px;
    text-align: center;
}

.game-header #game-status:empty {
    display: none;
}

.game-header .quick-nav-button,
.game-header .account-menu-button {
    width: 44px !important;
    height: 44px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: rgba(160, 180, 220, 0.12) !important;
    box-shadow: none !important;
}

.game-header .quick-nav-button:hover:not(:disabled),
.game-header .account-menu-button:hover:not(:disabled) {
    background: rgba(160, 180, 220, 0.24) !important;
    color: var(--lx-ivory) !important;
}

.game-header .account-menu-button {
    font-size: 24px;
    color: var(--lx-ivory) !important;
}

.quick-nav-button {
    gap: 4px !important;
}

.quick-nav-button span {
    height: 2px !important;
    border-radius: 2px;
    background: var(--lx-ivory) !important;
}

.quick-nav-button span:nth-child(n) {
    width: 18px !important;
}

.quick-nav-button:hover:not(:disabled) span {
    background: var(--lx-ivory) !important;
}

.quick-nav-button[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.quick-nav-button[aria-expanded="true"] span:nth-child(4) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Dropdown menu and drawer */
.account-menu {
    top: calc(100% + 12px) !important;
    padding: 8px !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: rgba(14, 22, 42, 0.94) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55) !important;
}

.account-menu button,
.account-menu #back-to-lobby-menu-button {
    margin: 0 !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.account-menu button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.10) !important;
    color: var(--lx-ivory) !important;
}

.account-menu .account-menu-danger {
    border-top: 0 !important;
    color: #f1b4b4 !important;
}

.quick-panel {
    border: 0 !important;
    border-radius: 0 var(--soft-lg) var(--soft-lg) 0;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5) !important;
}

.quick-panel-nav-button {
    border: 0 !important;
    border-radius: var(--soft-md) !important;
}

.quick-panel-close {
    border: 0 !important;
    border-radius: 16px !important;
}

/* Soft styling, only on these screens (voting, review, runoff and timers excluded) */
:where(#login-screen,#game-entry-screen,#profile-screen,#personal-history-screen,#lobby-screen,#results-screen,.quick-panel) {
    & .card,
    & .modal-card,
    & .login-card,
    & .entry-card,
    & .lobby-chamber,
    & .lobby-roster,
    & .showcase-faq,
    & .showcase-results,
    & .showcase-rules,
    & .result-snapshot {
        border: 0 !important;
        border-radius: var(--soft-lg) !important;
        box-shadow: var(--soft-shadow) !important;
    }

    & .join-game-card,
    & .history-item,
    & .apex-faq,
    & .public-rules-grid article,
    & .grade-group,
    & .host-terminate-zone,
    & .host-menu-passkey,
    & .invite-banner,
    & .quick-panel-rules p,
    & .quick-player-row,
    & .snapshot-grade-row,
    & .lobby-roster-header,
    & #player-list li,
    & #player-list .lobby-player,
    & .action-row {
        border: 0 !important;
        border-radius: var(--soft-md) !important;
        box-shadow: none !important;
        background-color: var(--soft-fill) !important;
    }

    & .grade-result {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    & .grade,
    & .grade-group-badge,
    & .example-badge,
    & .lobby-player-tag,
    & .lobby-player-count,
    & .join-game-phase,
    & .quick-panel-nav-index {
        border: 0 !important;
        border-radius: 999px !important;
    }

    & .card h2::after,
    & .lobby-entry h2::after,
    & .card::before,
    & .modal-card::before {
        display: none !important;
    }

    & input[type="text"],
    & input[type="password"],
    & input[type="email"],
    & select,
    & .invite-link-field,
    & #login-username,
    & #login-password,
    & #create-username,
    & #create-email,
    & #create-password,
    & #create-password-confirm {
        border: 0 !important;
        border-radius: var(--soft-md) !important;
        background-color: var(--soft-fill) !important;
        box-shadow: none !important;
        text-align: left !important;
        padding: 12px 20px !important;
    }

    & input:focus,
    & select:focus {
        outline: none !important;
        box-shadow: var(--soft-ring) !important;
    }

    & .password-field input {
        padding-right: 84px !important;
    }

    & button,
    & .secondary-button,
    & .login-secondary-button,
    & #create-account-submit,
    & #enter-created-game-button,
    & #host-game-button,
    & #join-game-button,
    & #login-button,
    & #register-player-button,
    & #reset-game-button,
    & #save-game-button,
    & #start-game-button {
        border: 0 !important;
        border-radius: 24px !important;
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25) !important;
    }

    & button {
        background-color: rgba(160, 180, 220, 0.14);
    }

    & .secondary-button,
    & .login-secondary-button {
        background: var(--soft-fill) !important;
    }

    & #login-button,
    & #create-account-submit,
    & #host-game-button,
    & #join-game-button,
    & #start-game-button,
    & #register-player-button {
        box-shadow: 0 10px 26px rgba(110, 140, 200, 0.30) !important;
    }

    & .password-field .password-toggle {
        box-shadow: none !important;
        background: transparent !important;
    }

    & .host-terminate-button {
        background-color: rgba(190, 70, 70, 0.18) !important;
        border: 0 !important;
        border-radius: 24px !important;
    }

    & .login-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    & .login-card>* {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    & .login-kicker {
        text-align: center;
    }

    & #account-login-panel,
    & #account-create-panel {
        padding-top: 6px;
    }
}

/* Results: one color per grade */
.grade-group-a,
.grade-result-a {
    --g1: #ffd36b;
    --g2: #e39a14;
    --glow: rgba(255, 196, 64, .45);
}

.grade-group-e,
.grade-result-e {
    --g1: #c3a6ff;
    --g2: #8a5cf5;
    --glow: rgba(160, 120, 255, .40);
}

.grade-group-b,
.grade-result-b {
    --g1: #7db4ff;
    --g2: #3f78e6;
    --glow: rgba(90, 150, 255, .40);
}

.grade-group-c,
.grade-result-c {
    --g1: #5fe0bd;
    --g2: #1fae8a;
    --glow: rgba(60, 210, 170, .35);
}

.grade-group-d,
.grade-result-d {
    --g1: #a9b8cf;
    --g2: #6b7b93;
    --glow: rgba(150, 170, 200, .25);
}

.grade-group-f,
.grade-result-f {
    --g1: #ff7a86;
    --g2: #d02f48;
    --glow: rgba(255, 90, 110, .40);
}

.grade-a {
    color: #ffd36b;
    background: rgba(255, 196, 64, 0.14);
}

.grade-c {
    color: #5fe0bd;
    background: rgba(60, 210, 170, 0.14);
}

.grade-f {
    color: #ff7a86;
    background: rgba(255, 90, 110, 0.14);
}

.grade-group .grade-group-badge {
    background: linear-gradient(160deg, var(--g1), var(--g2)) !important;
    color: #0d1322 !important;
}

.grade-group .grade-group-title {
    color: var(--g1) !important;
}

.grade-group .grade-group-heading {
    background: transparent !important;
    border: 0 !important;
}

.grade-group .grade-player-name {
    color: var(--lx-ivory) !important;
}

.grade-group .grade-progress-track {
    height: 12px;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.grade-group .grade-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--g2), var(--g1));
    box-shadow: 0 0 14px var(--glow);
}

.grade-group .grade-vote-count,
.grade-group .grade-simple-votes,
.grade-group .grade-position {
    color: var(--g1) !important;
}

/* ---------- Voting: search, alphabetical rows, Vote button ---------- */

:where(#voting-screen) {
    & .card {
        border: 0 !important;
        border-radius: var(--soft-lg) !important;
        box-shadow: var(--soft-shadow) !important;
    }

    & .card::before,
    & .card h2::after {
        display: none !important;
    }

    & #reveal-first-round-button {
        border: 0 !important;
        border-radius: 24px !important;
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25) !important;
    }
}

#voting-search {
    width: 100%;
    min-height: 48px;
    padding: 12px 20px;
    border: 0 !important;
    border-radius: var(--soft-md) !important;
    background-color: var(--soft-fill) !important;
    box-shadow: none !important;
    color: var(--lx-ivory);
    font: inherit;
    text-align: left;
}

#voting-search:focus {
    outline: none;
    box-shadow: var(--soft-ring) !important;
}

.voting-search-status {
    min-height: 1.2em;
    margin: 8px 4px 12px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: left;
}

#voting-search-status.found {
    color: #5fe0bd !important;
}

#voting-search-status.not-found {
    color: #ff7a86 !important;
}

#voting-player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#voting-player-list li.vote-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 !important;
    padding: 10px 10px 10px 18px !important;
    border: 0 !important;
    border-radius: 22px !important;
    box-shadow: none !important;
    background: var(--soft-fill) !important;
}

#voting-player-list li.vote-row.hidden {
    display: none !important;
}

#voting-player-list li.vote-row:has(.vote-player.selected) {
    background: rgba(95, 224, 189, 0.12) !important;
}

#voting-player-list .vote-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    color: var(--lx-ivory);
    font-size: 16px;
}

#voting-player-list .vote-player {
    flex: 0 0 auto;
    width: auto;
    min-width: 96px;
    min-height: 40px;
    margin: 0;
    padding: 0 18px;
    border: 0 !important;
    border-radius: 999px !important;
    background: linear-gradient(180deg, #e4ecf7, #8da2c6) !important;
    color: #0d1322 !important;
    box-shadow: 0 8px 20px rgba(110, 140, 200, 0.28) !important;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#voting-player-list .vote-player:hover:not(:disabled) {
    filter: brightness(1.08);
}

#voting-player-list .vote-player:disabled {
    background: rgba(160, 180, 220, 0.12) !important;
    color: rgba(237, 241, 246, 0.45) !important;
    box-shadow: none !important;
    opacity: 1;
}

#voting-player-list .vote-player.selected,
#voting-player-list .vote-player.selected:disabled {
    background: linear-gradient(160deg, #5fe0bd, #1fae8a) !important;
    color: #0d1322 !important;
    box-shadow: 0 8px 20px rgba(60, 210, 170, 0.28) !important;
    opacity: 1;
}

#voting-player-list .vote-player.selected::before {
    content: "\2713\00a0";
}

/* ============================================================
   APEX 1.55 FRONT-END AUDIT FIXES
   Palette comes from the game's own grade scale (amber, teal,
   violet, coral) on the existing navy base. Buttons are smaller.
   Appended last so it wins over the earlier layered patches.
   ============================================================
*/

:root {
    --apex-amber: #f0b44c;
    --apex-amber-hi: #ffd079;
    --apex-teal: #3fd0b0;
    --apex-violet: #a995ff;
    --apex-coral: #ff7a86;
    --apex-ink: #0a0f1c;

    /* The old "gold" variables held blue-grey; make them match their names. */
    --lx-gold: var(--apex-amber);
    --lx-gold-lo: #b9822c;
    --lx-line: rgba(174, 187, 208, .26);
    --soft-ring: 0 0 0 3px rgba(240, 180, 76, .38);
}

/* Keyboard focus that is always visible */
button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--apex-teal);
    outline-offset: 2px;
}

/* ---- Primary actions: amber ---- */

#login-button,
#create-account-submit,
#host-game-button,
#join-game-button,
#enter-created-game-button,
#start-game-button,
#register-player-button,
.join-game-select-button {
    background: linear-gradient(180deg, var(--apex-amber-hi), var(--apex-amber)) !important;
    color: var(--apex-ink) !important;
    box-shadow: 0 8px 22px rgba(240, 180, 76, 0.26) !important;
}

/* ---- Host advance / confirm actions: teal ---- */

#confirm-voting-duration,
#reveal-first-round-button,
#start-runoff-button,
#reveal-runoff-button {
    background: linear-gradient(180deg, #7be8cf, var(--apex-teal)) !important;
    color: var(--apex-ink) !important;
    box-shadow: 0 8px 22px rgba(63, 208, 176, 0.24) !important;
}

/* ---- Save and replay: violet ---- */

#save-game-button {
    background: linear-gradient(180deg, #c6b9ff, var(--apex-violet)) !important;
    color: var(--apex-ink) !important;
    box-shadow: 0 8px 22px rgba(169, 149, 255, 0.26) !important;
}

/* ---- Destructive: coral ---- */

.host-terminate-button {
    background: rgba(255, 122, 134, 0.14) !important;
    color: var(--apex-coral) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 122, 134, 0.55) !important;
}

@media (hover: hover) {
    #login-button:hover:not(:disabled),
    #create-account-submit:hover:not(:disabled),
    #host-game-button:hover:not(:disabled),
    #join-game-button:hover:not(:disabled),
    #enter-created-game-button:hover:not(:disabled),
    #start-game-button:hover:not(:disabled),
    #register-player-button:hover:not(:disabled),
    .join-game-select-button:hover:not(:disabled) {
        background: linear-gradient(180deg, #ffe3a8, var(--apex-amber-hi)) !important;
        color: var(--apex-ink) !important;
    }

    #confirm-voting-duration:hover:not(:disabled),
    #reveal-first-round-button:hover:not(:disabled),
    #start-runoff-button:hover:not(:disabled),
    #reveal-runoff-button:hover:not(:disabled) {
        background: linear-gradient(180deg, #a2f2de, #5fdfc2) !important;
        color: var(--apex-ink) !important;
    }

    #save-game-button:hover:not(:disabled) {
        background: linear-gradient(180deg, #dcd3ff, #bcaeff) !important;
        color: var(--apex-ink) !important;
    }

    .host-terminate-button:hover:not(:disabled) {
        background: rgba(255, 122, 134, 0.26) !important;
        color: #ffd2d6 !important;
    }
}

/* ---- Sizes: sign-in, account creation and join ---- */

#login-button,
#create-account-submit,
#register-player-button {
    width: min(100%, 340px) !important;
    margin-inline: auto !important;
    min-height: 42px !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    letter-spacing: 0.14em !important;
}

.login-secondary-button {
    width: min(100%, 340px) !important;
    margin-inline: auto !important;
    min-height: 38px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    letter-spacing: 0.14em !important;
}

.password-field .password-toggle {
    min-height: 40px;
}

/* ---- Sizes: host controls and join list ---- */

#start-game-button,
#reveal-first-round-button,
#start-runoff-button,
#reveal-runoff-button,
#save-game-button,
#reset-game-button,
#confirm-voting-duration,
#cancel-voting-duration,
#host-game-button,
#join-game-button,
#enter-created-game-button,
.join-game-select-button {
    min-width: 112px;
    min-height: 40px;
    padding: 10px 20px !important;
    font-size: 0.78rem !important;
    letter-spacing: 0.14em !important;
}

#profile-back-button,
#personal-history-back-button {
    width: auto !important;
    align-self: flex-start;
    min-height: 36px;
    padding: 8px 16px !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.14em !important;
}

.account-menu button {
    padding: 10px 14px !important;
    letter-spacing: 0.18em !important;
}

.quick-panel-nav-button {
    min-height: 52px;
    padding: 12px 16px !important;
    font-size: 0.82rem !important;
    letter-spacing: 0.16em !important;
}

.quick-panel-nav-button small {
    font-size: 11px;
}

/* Laptops and wider get a little more room */
@media (min-width: 900px) {
    #login-button,
    #create-account-submit,
    #register-player-button {
        width: min(100%, 360px) !important;
        min-height: 44px !important;
        font-size: 14px !important;
    }

    #start-game-button,
    #reveal-first-round-button,
    #start-runoff-button,
    #reveal-runoff-button,
    #save-game-button,
    #reset-game-button,
    #confirm-voting-duration,
    #cancel-voting-duration,
    #host-game-button,
    #join-game-button,
    #enter-created-game-button,
    .join-game-select-button {
        min-height: 42px;
        font-size: 0.82rem !important;
    }
}

/* ---- Profile, history and join-list states (these classes had no styles) ---- */

.profile-card,
.history-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-header {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
}

.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--lx-line);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.profile-stat {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 14px 10px;
    border-radius: 20px;
    background: var(--soft-fill);
}

.profile-stat span {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--apex-amber-hi);
}

.profile-stat small {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--lx-muted);
}

.history-list,
.history-loading,
.history-message,
.history-empty,
.join-game-loading,
.join-game-message {
    text-align: center;
    color: var(--lx-muted);
    font-size: 0.85rem;
    padding: 10px 0;
}


/* ===== Join Game: invitation-based discovery ===== */
.join-options { display: grid; gap: 12px; margin: 16px 0 8px; }
.join-option { border-radius: 16px; overflow: hidden; background: rgba(174, 187, 208, 0.06); border: 1px solid rgba(174, 187, 208, 0.18); }
.join-option-toggle { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 14px 18px; background: transparent !important; border: 0 !important; box-shadow: none !important; font-family: var(--lx-caps); font-weight: 600; letter-spacing: 0.2em; color: var(--lx-gold-hi); cursor: pointer; }
.join-option-sign::before { content: "+"; }
.join-option-toggle[aria-expanded="true"] .join-option-sign::before { content: "\2212"; }
.join-option-body { display: grid; gap: 12px; padding: 4px 16px 18px; }
.join-option-body.hidden { display: none; }
.join-option-label { font-family: var(--lx-sans); font-size: 0.62rem; letter-spacing: 0.28em; color: var(--lx-gold); text-align: center; }
.join-option-body input[type="text"] { width: 100%; min-height: 48px; text-align: center; }
.join-game-result { margin: 14px 0 4px; display: grid; gap: 14px; }
.join-game-result.hidden { display: none; }
.join-found-card { position: relative; display: grid; justify-items: center; gap: 6px; padding: 22px 18px; text-align: center; border-radius: 18px; background: linear-gradient(160deg, rgba(174, 187, 208, 0.12), rgba(6, 10, 20, 0.45)); border: 1px solid rgba(174, 187, 208, 0.22); }
.join-found-kicker { font-family: var(--lx-sans); font-size: 0.62rem; letter-spacing: 0.34em; color: var(--lx-gold); margin-bottom: 4px; }
.join-found-card .join-game-section { font-size: 1.3rem; }
.join-found-actions { display: grid; gap: 10px; }
.join-back-button { width: 100%; margin-top: 10px; }
.join-game-message { min-height: 1.2em; letter-spacing: 0.08em; }

.join-nickname-input { width: 100%; min-height: 48px; text-align: center; }

/* APEX redesign: compact title-bar navigation and consistent join actions */
.game-start-visual, .game-start-title { display: none !important; }
.game-start-transition { gap: 0 !important; }
.game-start-transition::before {
    content: ""; width: 48px; height: 48px; border-radius: 50%;
    border: 3px solid rgba(210,220,235,.16); border-top-color: var(--lx-gold-hi, #d6bd82);
    animation: apex-loading-spin .8s linear infinite;
}
@keyframes apex-loading-spin { to { transform: rotate(360deg); } }

/* The left title-bar control opens a compact dropdown, not a side drawer. */
.quick-panel-backdrop { display: none !important; }
.quick-panel {
    position: fixed !important; top: calc(max(8px, env(safe-area-inset-top)) + 66px) !important;
    left: max(12px, env(safe-area-inset-left)) !important; right: auto !important;
    width: min( min(360px, calc(100vw - 24px)), 360px) !important;
    height: auto !important; max-height: min(76vh, 680px) !important;
    overflow-y: auto !important; transform: none !important;
    opacity: 0; visibility: hidden; pointer-events: none;
    border-radius: 20px !important; background: rgba(10,16,30,.97) !important;
    border: 1px solid rgba(174,187,208,.16) !important;
    box-shadow: 0 20px 55px rgba(0,0,0,.58) !important;
    z-index: 100 !important;
}
.quick-panel.open, .quick-panel.active, .quick-panel[aria-hidden="false"] {
    opacity: 1; visibility: visible; pointer-events: auto;
}
.quick-panel-inner { padding: 16px !important; }
.quick-panel-head { margin-bottom: 10px !important; }
.quick-panel-nav { display: grid; gap: 7px; }
.quick-panel-nav-button { min-height: 52px; text-align: left !important; }
#quick-panel-nav > button[id="back-to-lobby-menu-button"],
#quick-panel-nav > button[id="personal-history-menu-button"] {
    display: flex !important; width: 100%; align-items: center; justify-content: flex-start;
    padding: 14px 16px; color: var(--lx-ivory); background: rgba(160,180,220,.07);
    border-radius: 14px; border: 1px solid rgba(174,187,208,.12);
}
#quick-panel-nav > button.hidden { display: none !important; }
#quick-panel-rules, [data-panel="rules"] { display: none !important; }

/* Join methods now use the same horizontal action-card hierarchy as Host/Join. */
.join-options { gap: 12px !important; }
.join-option { border-radius: 16px !important; background: rgba(174,187,208,.045) !important; }
.join-option-toggle {
    min-height: 76px !important; justify-content: flex-start !important;
    padding: 14px 18px !important; text-align: left !important; gap: 14px !important;
}
.join-option-sign { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
    border-radius: 11px; background: rgba(190,166,112,.12); font-size: 1.25rem; }
.join-option-copy { display: grid; gap: 4px; text-align: left; }
.join-option-copy strong { color: var(--lx-ivory); font-family: var(--lx-caps); font-size: .9rem; letter-spacing: .08em; }
.join-option-copy small { color: var(--lx-muted); font: 400 .76rem/1.4 var(--lx-sans); letter-spacing: 0; }
.join-option-body { padding: 4px 18px 18px !important; }

@media (min-width: 700px) {
    .join-options { grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; }
    .join-option-toggle { min-height: 88px !important; }
    .quick-panel { width: 360px !important; }
}
@media (max-width: 699px) {
    .game-header { grid-template-columns: 48px 1fr 48px !important; }
    .quick-panel { left: 10px !important; width: min(340px, calc(100vw - 20px)) !important; }
}

/* ============================================================
   APEX RIBBON / RESPONSIVE ICON ALIGNMENT / PAGE-TURN TRANSITION
   ============================================================ */
.game-header.apex-ribbon {
    position: sticky;
    top: max(6px, env(safe-area-inset-top));
    z-index: 100;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: clamp(8px, 2vw, 22px) !important;
    width: 100%;
    min-height: 68px;
    margin: 0 0 20px !important;
    padding: 8px clamp(10px, 2vw, 20px) !important;
    border: 1px solid rgba(190,205,230,.13) !important;
    border-radius: 13px !important;
    background: rgba(9,13,22,.94) !important;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 28px rgba(0,0,0,.28) !important;
}
.game-header.apex-ribbon .ribbon-brand {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    gap: 10px;
}
.game-header.apex-ribbon .game-logo-frame {
    display: flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0;
    perspective: 260px;
}
.game-header.apex-ribbon .pyramid-3d.game-logo {
    --pyramid-size: 32px;
    --pyramid-height: 29px;
}
.ribbon-brand-copy { display:flex; flex-direction:column; min-width:0; gap:2px; text-align:left; }
.ribbon-brand-copy strong { color:#f0f2f6; font:600 13px/1.1 "Oswald",sans-serif; letter-spacing:.22em; }
.game-header.apex-ribbon #game-status { margin:0; padding:0; max-width:220px; overflow:hidden; color:rgba(225,232,244,.62); font:10px/1.3 "Oswald",sans-serif; letter-spacing:.08em; text-align:left; text-overflow:ellipsis; white-space:nowrap; }
.game-header.apex-ribbon .ribbon-actions { display:flex; align-items:stretch; justify-content:center; flex:1 1 auto; gap:5px; min-width:0; }
.ribbon-action {
    display:inline-flex !important;
    flex:0 1 auto;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    width:auto !important;
    min-width:66px;
    min-height:48px;
    margin:0 !important;
    padding:5px 12px !important;
    border:1px solid rgba(180,198,226,.13) !important;
    border-radius:8px !important;
    background:rgba(145,165,202,.07) !important;
    color:#e9edf5 !important;
    box-shadow:none !important;
    font:500 9px/1 "Oswald",sans-serif !important;
    letter-spacing:.1em;
    text-transform:uppercase;
}
.ribbon-action svg, .account-menu-button svg {
    display:block;
    width:19px;
    height:19px;
    flex:0 0 19px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.65;
    stroke-linecap:round;
    stroke-linejoin:round;
}
.ribbon-action span { display:block; line-height:1; white-space:nowrap; }
.ribbon-action:hover:not(:disabled) { background:rgba(180,198,226,.16) !important; color:#fff !important; border-color:rgba(210,222,244,.28) !important; }
.game-header.apex-ribbon .account-menu-wrapper { position:relative !important; inset:auto !important; flex:0 0 44px; margin:0 !important; }
.game-header.apex-ribbon .account-menu-button {
    display:flex !important; align-items:center; justify-content:center;
    width:44px !important; height:44px !important; margin:0 !important; padding:0 !important;
    border:1px solid rgba(190,205,230,.17) !important; border-radius:9px !important;
    background:rgba(145,165,202,.10) !important; color:#edf1f8 !important; box-shadow:none !important;
}
.game-header.apex-ribbon .account-menu-button svg { width:22px; height:22px; flex-basis:22px; }
.game-header.apex-ribbon .account-menu { top:calc(100% + 9px); right:0; z-index:120; min-width:168px; padding:6px; border:1px solid rgba(190,205,230,.16); border-radius:10px; background:#101725; box-shadow:0 14px 36px rgba(0,0,0,.45); }
.game-header.apex-ribbon .account-menu button { width:100% !important; min-height:40px; margin:0 !important; padding:10px 12px !important; border:0 !important; border-radius:6px !important; text-align:left; font-size:12px; }
.game-header.apex-ribbon .account-menu .account-menu-danger { color:#f0a1a1 !important; }

/* The old left-side drawer is no longer a navigation surface. The host panel
   is retained as a compact ribbon popover so existing host actions still work. */
#quick-nav-button, #quick-panel-backdrop, #quick-panel .quick-panel-head,
#quick-panel .quick-panel-nav, #quick-panel-players { display:none !important; }
#quick-panel {
    position:fixed !important;
    top:calc(max(6px, env(safe-area-inset-top)) + 78px) !important;
    left:auto !important;
    right:clamp(10px, 2vw, 20px) !important;
    bottom:auto !important;
    z-index:110 !important;
    width:min(360px, calc(100vw - 24px)) !important;
    max-height:min(72vh, 620px);
    overflow-y:auto;
    border:1px solid rgba(190,205,230,.18);
    border-radius:12px;
    background:#0d1421;
    box-shadow:0 18px 44px rgba(0,0,0,.48);
    transform:translateY(-8px) scale(.985) !important;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .18s ease, transform .18s ease, visibility .18s ease;
}
#quick-panel.open { transform:translateY(0) scale(1) !important; opacity:1; visibility:visible; pointer-events:auto; }
#quick-panel .quick-panel-inner { padding:18px; }
#quick-panel-host { display:block; }
#quick-panel-host.hidden { display:none !important; }
#quick-panel-host .quick-panel-label { margin:0 0 6px; }
#quick-panel-host h2 { margin:0 0 12px; }
#quick-panel-host .host-terminate-zone { margin-top:16px; }

/* Profile picture controls */
.profile-header { display:flex; flex-direction:column; align-items:center; }
.profile-avatar { display:block; width:112px; height:112px; flex:0 0 112px; object-fit:cover; object-position:center; border-radius:50%; border:2px solid rgba(210,220,240,.3); background:#101725; }
.avatar-edit-controls { display:flex; flex-direction:column; align-items:center; gap:7px; width:100%; margin:12px 0 8px; }
.avatar-edit-button { width:auto !important; min-width:142px; margin:0 !important; padding:9px 15px !important; font-size:11px !important; }
.profile-avatar-message { min-height:14px; margin:0; color:rgba(225,232,244,.58); font-size:10px; text-align:center; }

/* Page-turn entrance: a restrained book-page movement, not a full-screen flip. */
.screen-enter {
    transform-origin:left center;
    backface-visibility:hidden;
    animation:apex-page-turn 420ms cubic-bezier(.22,.72,.2,1) both !important;
}
@keyframes apex-page-turn {
    from { opacity:0; transform:perspective(1100px) rotateY(-7deg) translateX(12px); }
    65% { opacity:1; transform:perspective(1100px) rotateY(1deg) translateX(-1px); }
    to { opacity:1; transform:perspective(1100px) rotateY(0) translateX(0); }
}
@media (max-width:650px) {
    .game-header.apex-ribbon { min-height:60px; gap:6px !important; padding:6px 8px !important; }
    .game-header.apex-ribbon .ribbon-brand { gap:6px; }
    .game-header.apex-ribbon .game-logo-frame { flex-basis:32px; width:32px; height:36px; }
    .game-header.apex-ribbon .pyramid-3d.game-logo { --pyramid-size:27px; --pyramid-height:24px; }
    .ribbon-brand-copy strong { font-size:11px; }
    .game-header.apex-ribbon #game-status { max-width:105px; font-size:8px; }
    .game-header.apex-ribbon .ribbon-actions { gap:3px; }
    .ribbon-action { min-width:42px; min-height:42px; padding:4px 6px !important; gap:3px; font-size:8px !important; }
    .ribbon-action svg { width:17px; height:17px; flex-basis:17px; }
    .game-header.apex-ribbon .account-menu-wrapper { flex-basis:38px; }
    .game-header.apex-ribbon .account-menu-button { width:38px !important; height:38px !important; }
    .game-header.apex-ribbon .account-menu-button svg { width:20px; height:20px; flex-basis:20px; }
    #quick-panel { top:calc(max(6px, env(safe-area-inset-top)) + 68px) !important; right:8px !important; }
}
@media (max-width:380px) {
    .ribbon-brand-copy { display:none; }
    .game-header.apex-ribbon .game-logo-frame { flex-basis:30px; width:30px; }
    .ribbon-action { min-width:39px; padding-inline:4px !important; }
}
@media (prefers-reduced-motion:reduce) {
    .screen-enter { animation:none !important; }
    #quick-panel { transition:none !important; }
}


/* Configurable game tiers */
.game-config-label {
    display: block;
    margin: 1.1rem 0 0.45rem;
    color: var(--lx-muted);
    font-family: var(--lx-sans);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
#game-population-category,
#game-voting-mode {
    display: block;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(190, 199, 211, 0.22);
    border-radius: 0.35rem;
}
.game-config-note,
.lobby-game-config {
    color: var(--lx-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}
.lobby-game-config {
    margin: 0.6rem auto 0;
    max-width: 32rem;
    text-align: center;
    letter-spacing: 0.04em;
}


/* My Games list on the Join Game panel */
.my-games-section { display: grid; gap: 12px; margin: 18px 0 22px; }
.my-games-section.hidden { display: none; }
.my-games-list { display: grid; gap: 10px; }
.my-game-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(160deg, rgba(174,187,208,0.12), rgba(6,10,20,0.45)); border: 1px solid rgba(174,187,208,0.22); }
.my-game-info { display: grid; gap: 4px; min-width: 0; text-align: left; }
.my-game-title { font-size: 1.05rem; overflow-wrap: anywhere; }
.my-game-meta, .my-game-role { font-family: var(--lx-sans); font-size: 0.62rem; letter-spacing: 0.2em; color: var(--lx-gold); }
.my-game-role { color: var(--lx-muted); }
.my-games-empty { text-align: center; letter-spacing: 0.1em; color: var(--lx-muted); }
.my-game-card .join-game-select-button { flex: 0 0 auto; width: auto; padding-inline: 16px; }


/* APEX v2: structured game form, Candidate Shield, session fields */
.game-config-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 0;
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: pointer;
}
.game-config-check input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
  flex: 0 0 auto;
}
.game-config-review {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(190, 198, 214, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.shield-panel {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(190, 198, 214, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.shield-panel-title {
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  opacity: 0.85;
}
.shield-panel select,
.shield-panel button {
  width: 100%;
  margin-top: 8px;
}


/* APEX v3: grouped host controls and sessions */
.host-menu-phase {
  margin: 0 0 10px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  opacity: 0.75;
}
.host-group-title {
  margin: 18px 0 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(190, 198, 214, 0.2);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  opacity: 0.85;
}
.host-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}
.host-action-button {
  width: 100%;
}
.host-action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.host-action-danger:not(:disabled) {
  border-color: rgba(255, 120, 120, 0.55);
}
.host-action-hint {
  display: block;
  margin-top: 4px;
  min-height: 0;
  font-size: 0.76rem;
  opacity: 0.7;
}
.host-action-hint:empty {
  display: none;
}
.host-modifier-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(190, 198, 214, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.host-modifier-row small {
  font-size: 0.8rem;
  opacity: 0.8;
}
.host-extend-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.host-extend-row.hidden {
  display: none;
}
.session-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}
.session-chip {
  padding: 3px 9px;
  border: 1px solid rgba(190, 198, 214, 0.35);
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.session-details {
  margin: 8px 0;
}
.session-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}
.session-result-row {
  padding: 4px 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.session-log {
  padding-top: 4px;
}


/* Terms, tutorial, simplified host controls */
.terms-card { width: min(680px, 100%); max-height: min(88vh, 780px); display: flex; flex-direction: column; }
.terms-version { margin: 0; font-size: 12px; opacity: 0.65; }
.terms-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 12px 0 4px; padding-right: 10px; font-size: 14px; line-height: 1.65; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.terms-body h3 { margin: 22px 0 8px; color: #fff; font-family: "Oswald", sans-serif; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }
.terms-body h3:first-child { margin-top: 4px; }
.terms-body p { margin: 0 0 10px; opacity: 0.88; }
.terms-actions-single { grid-template-columns: 1fr; }
.terms-link { display: inline; width: auto !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; color: inherit; font: inherit; letter-spacing: normal !important; text-transform: none !important; text-decoration: underline; cursor: pointer; }
.terms-link-center { display: block; margin: 14px auto 0 !important; font-size: 12px; opacity: 0.8; }
.terms-check { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0; font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer; }
.terms-check input { width: auto; margin-top: 2px; flex: 0 0 auto; }
.tutorial-text { margin: 0; line-height: 1.6; }
.tutorial-dots { display: flex; justify-content: center; gap: 8px; margin: 16px 0 2px; }
.tutorial-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(190, 198, 214, 0.3); }
.tutorial-dot.active { background: #fff; }


/* Signup terms acceptance: compact link and readable, bounded document modal */
.signup-terms-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 12px 0 16px;
    text-align: left;
}
.signup-terms-link {
    display: inline-block !important;
    padding: 9px 0 !important;
    color: var(--lx-gold-hi, #d7dce5) !important;
    font-family: "Oswald", sans-serif !important;
    font-size: 12px !important;
    letter-spacing: 0.12em !important;
    text-align: left;
}
.signup-terms-status {
    font-size: 11px;
    line-height: 1.4;
    color: rgba(220, 226, 236, 0.62);
}
.signup-terms-status.accepted {
    color: #b8d8c1;
}
#terms-modal {
    z-index: 10050; /* above #login-screen (10000) so it opens on the create-account screen */
    overflow-y: auto;
    align-items: center;
    -webkit-overflow-scrolling: touch;
}
#terms-modal .terms-card {
    width: min(720px, calc(100vw - 32px));
    max-height: min(84dvh, 760px);
    min-height: 0;
    padding: 22px 24px !important;
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow: hidden;
}
#terms-modal .terms-card > .modal-kicker,
#terms-modal .terms-card > h2,
#terms-modal .terms-version {
    flex: 0 0 auto;
}
#terms-modal .terms-card > h2 {
    margin: 5px 0 7px;
    text-align: center;
    font-size: 1.15rem !important;
}
#terms-modal .terms-version {
    text-align: center;
    font-size: 11px !important;
}
#terms-modal .terms-body {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 62dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 8px 4px 0;
    margin: 10px 0 8px;
    text-align: left;
    font-family: var(--lx-serif, Georgia, serif);
    font-size: 13px;
    line-height: 1.55;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
#terms-modal .terms-body p {
    margin: 0 0 11px;
    background: none;
    font-size: 13px !important;
    line-height: 1.55;
    text-align: left;
    opacity: 0.9;
}
#terms-modal .terms-body h3 {
    margin: 18px 0 7px;
    font-size: 12px;
    text-align: left;
}
#terms-modal .modal-actions {
    flex: 0 0 auto;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(190, 198, 214, 0.16);
}
#terms-modal .terms-actions-single {
    grid-template-columns: 1fr;
}
@media (max-width: 520px) {
    #terms-modal {
        padding: 10px;
        align-items: center;
    }
    #terms-modal .terms-card {
        width: 100%;
        max-height: 88dvh;
        padding: 17px 16px !important;
        border-radius: 12px;
    }
    #terms-modal .terms-body {
        max-height: 67dvh;
        font-size: 12px;
    }
}

/* ============================================================
   APEX HOST SETUP: SPACED, GROUPED CONFIGURATION
   ============================================================ */
#host-game-panel { width: min(760px, 100%); margin-inline: auto; padding: clamp(20px, 4vw, 34px) !important; }
#host-game-panel > h2 { margin: 0 0 22px; }
.host-setup-form { display: grid; gap: 18px; }
.host-setup-section { display: grid; gap: 16px; padding: 20px; border: 1px solid rgba(190,205,230,.14); border-radius: 13px; background: rgba(130,150,190,.045); }
.host-setup-heading { display: flex; align-items: flex-start; gap: 13px; padding-bottom: 12px; border-bottom: 1px solid rgba(190,205,230,.11); }
.host-setup-heading > span { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border: 1px solid rgba(205,185,135,.35); border-radius: 8px; color: #d4bd88; font: 600 12px/1 "Oswald",sans-serif; }
.host-setup-heading h3 { margin: 0 0 4px; color: #edf0f6; font: 600 16px/1.2 "Oswald",sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.host-setup-heading p { margin: 0; color: rgba(225,232,244,.58); font: 12px/1.5 system-ui,sans-serif; }
.host-field { display: grid; gap: 8px; min-width: 0; color: #e7ebf3; font: 600 12px/1.35 system-ui,sans-serif; letter-spacing: .025em; }
.host-field > span { color: rgba(232,237,247,.88); }
.host-field input, .host-field select { box-sizing: border-box; width: 100% !important; min-height: 48px !important; margin: 0 !important; padding: 11px 14px !important; border: 1px solid rgba(180,198,226,.22) !important; border-radius: 8px !important; background: #0b1220 !important; color: #f0f2f7 !important; font: 400 14px/1.4 system-ui,sans-serif !important; }
.host-field small { color: rgba(218,226,240,.52); font: 11px/1.5 system-ui,sans-serif; letter-spacing: 0; }
.host-fields-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.host-create-submit { width: 100%; min-height: 52px !important; margin: 0 !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 600px) {
  #host-game-panel { padding: 16px !important; }
  .host-setup-section { padding: 15px; gap: 14px; }
  .host-fields-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   LEFT-SIDE MORE TAB AND MISCELLANEOUS DRAWER
   ============================================================ */
#quick-nav-button {
  display: inline-flex !important; position: fixed !important; z-index: 9003 !important;
  top: 46%; left: 0 !important; right: auto !important; transform: translateY(-50%);
  width: 38px !important; min-width: 38px !important; height: 86px !important;
  margin: 0 !important; padding: 7px 4px !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important; gap: 7px !important;
  border: 1px solid rgba(190,205,230,.22) !important; border-left: 0 !important;
  border-radius: 0 9px 9px 0 !important; background: rgba(12,19,32,.96) !important;
  color: #e9edf5 !important; box-shadow: 5px 8px 24px rgba(0,0,0,.3) !important;
}
#quick-nav-button .more-tab-icon { font-size: 18px; line-height: 1; }
#quick-nav-button .more-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 9px/1 "Oswald",sans-serif; letter-spacing: .16em; }
#quick-nav-button:hover { background: #18243a !important; }
#quick-panel-backdrop { display: block !important; position: fixed !important; inset: 0 !important; z-index: 9000 !important; background: rgba(0,0,0,.48) !important; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
#quick-panel-backdrop.visible { opacity: 1; pointer-events: auto; }
#quick-panel {
  display: block !important; position: fixed !important; inset: 0 auto 0 0 !important; z-index: 9002 !important;
  width: min(340px, 88vw) !important; height: 100dvh !important; max-height: 100dvh !important;
  overflow-y: auto !important; border: 0 !important; border-right: 1px solid rgba(190,205,230,.16) !important;
  border-radius: 0 16px 16px 0 !important; background: #0b1220 !important;
  box-shadow: 16px 0 44px rgba(0,0,0,.42) !important; transform: translateX(-105%) !important;
  opacity: 1 !important; visibility: visible !important; pointer-events: none !important;
  transition: transform .24s ease !important;
}
#quick-panel.open { transform: translateX(0) !important; pointer-events: auto !important; }
#quick-panel .quick-panel-head, #quick-panel .quick-panel-nav { display: flex !important; }
#quick-panel .quick-panel-head { align-items: center; margin: 0 0 22px !important; }
#quick-panel .quick-panel-nav { display: grid !important; gap: 8px !important; margin: 0 0 24px !important; }
#quick-panel .quick-panel-nav-button { display: grid !important; min-height: 58px !important; }
#quick-panel .quick-panel-section { padding: 8px 0 24px; }
#quick-panel .quick-panel-section.hidden { display: none !important; }
#quick-panel-misc h2 { margin: 0 0 18px; }
.misc-actions { display: grid; gap: 9px; }
.misc-actions button { display: grid !important; gap: 5px; width: 100% !important; min-height: 58px; margin: 0 !important; padding: 12px 14px !important; border: 1px solid rgba(190,205,230,.14) !important; border-radius: 9px !important; background: rgba(145,165,202,.07) !important; color: #edf1f8 !important; text-align: left !important; font: 600 13px/1.25 system-ui,sans-serif !important; }
.misc-actions button span, .misc-info-row span { color: rgba(225,232,244,.55); font: 11px/1.4 system-ui,sans-serif; }
.misc-info-row { display: grid; gap: 5px; padding: 13px 14px; color: #edf1f8; border-top: 1px solid rgba(190,205,230,.12); }
#back-to-lobby-menu-button.hidden { display: none !important; }
@media (max-width: 600px) { #quick-nav-button { top: 52%; } }


/* The floating MORE tab is replaced by the "More" button in the ribbon.
   Kept in the DOM (hidden) because the drawer logic still references it. */
.game-header #quick-nav-button { display: none !important; }

/* Five ribbon buttons (Host, Sessions, History, Lobby, More) must fit on phones */
@media (max-width: 650px) {
    .ribbon-action { letter-spacing: 0.02em; min-width: 36px; padding-inline: 3px !important; font-size: 7px !important; }
    .game-header.apex-ribbon .ribbon-actions { gap: 2px; }
}


/* Results review and host publication */
.results-publish-status {
  margin: 12px 0 4px;
  color: rgba(220, 230, 245, .72);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
#publish-results-button {
  width: 100%;
  min-height: 50px;
  letter-spacing: .12em;
}
#publish-results-button:disabled { opacity: .65; cursor: wait; }
.results-awaiting-publication {
  min-height: 210px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 30px 18px;
  border: 1px solid rgba(170, 190, 225, .16);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(105, 125, 165, .09), rgba(4, 7, 13, .5));
  text-align: center;
}
.results-awaiting-kicker, .results-processing-label {
  color: rgba(190, 205, 230, .58);
  font: 600 10px/1.2 system-ui, sans-serif;
  letter-spacing: .24em;
}
.results-awaiting-publication h3 { margin: 4px 0; font-size: clamp(17px, 4vw, 22px); }
.results-awaiting-publication p { max-width: 340px; margin: 0; color: rgba(220, 230, 245, .62); font-size: 13px; line-height: 1.5; }
.results-processing {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  overflow: hidden;
}
.results-processing-fragments {
  width: min(310px, 90%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}
.results-processing-bit {
  display: grid;
  place-items: center;
  width: 18px; height: 22px;
  border: 1px solid rgba(180, 200, 230, .13);
  background: rgba(145, 165, 200, .07);
  color: rgba(220, 230, 245, .72);
  font: 600 10px/1 monospace;
  animation: results-fragment-sort .78s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--fragment-index) * 13ms);
}
@keyframes results-fragment-sort {
  0% { opacity: 0; transform: translate3d(calc((var(--fragment-index) - 12) * 2px), 14px, 0) scale(.65); filter: blur(2px); }
  55% { opacity: 1; transform: translate3d(0, -3px, 0) scale(1.05); filter: blur(0); }
  100% { opacity: .55; transform: translate3d(0, 0, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .results-processing-bit { animation: none; opacity: .7; transform: none; filter: none; }
}


/* Cinematic player-facing results reveal */
.results-cinematic {
  position: relative;
  display: grid;
  gap: 0;
  padding-top: 8px;
  perspective: 900px;
}
.results-cinematic-kicker {
  margin: 0 0 7px;
  color: rgba(196, 207, 226, .64);
  font: 700 9px/1.3 system-ui, sans-serif;
  letter-spacing: .28em;
  text-align: center;
}
.results-cinematic-title {
  margin: 0;
  color: #f0f2f6;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(20px, 5vw, 27px);
  font-weight: 600;
  letter-spacing: .035em;
  text-align: center;
  text-shadow: 0 2px 18px rgba(180, 195, 220, .16);
}
.results-cinematic-copy {
  margin: 8px 0 17px;
  color: rgba(205, 215, 232, .56);
  font-size: 11px;
  letter-spacing: .045em;
  text-align: center;
}
.results-reveal-skip {
  justify-self: center;
  min-height: 32px;
  margin: 0 0 18px;
  padding: 5px 13px;
  border: 1px solid rgba(190, 205, 230, .3);
  border-radius: 3px;
  background: rgba(130, 145, 170, .08);
  color: rgba(230, 236, 246, .8);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}
.results-stone-slab {
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(190, 202, 220, .24);
  border-top-color: rgba(230, 236, 246, .36);
  background:
    linear-gradient(112deg, rgba(255,255,255,.055), transparent 22%, rgba(0,0,0,.22) 68%, rgba(255,255,255,.025)),
    linear-gradient(180deg, #171b21 0%, #0a0d12 100%);
  box-shadow: 0 9px 22px rgba(0, 0, 0, .27), inset 0 1px rgba(255,255,255,.055), inset 0 -2px rgba(0,0,0,.4);
  transform-origin: 50% 0;
  animation: apex-stone-slab-reveal .62s cubic-bezier(.18,.76,.22,1) both;
  animation-delay: calc(var(--slab-index) * 310ms);
}
.results-stone-slab::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: .25;
  pointer-events: none;
  background: repeating-linear-gradient(176deg, transparent 0 13px, rgba(210,220,235,.035) 14px, transparent 15px 27px);
}
.results-stone-slab .grade-group-heading {
  background: linear-gradient(90deg, rgba(210,220,235,.08), rgba(20,24,31,.8));
  border-bottom-color: rgba(210,220,235,.23) !important;
}
.results-stone-slab .grade-group-badge {
  border: 1px solid rgba(220,230,245,.3);
  background: linear-gradient(145deg, #303844, #10141a);
  box-shadow: inset 0 1px rgba(255,255,255,.16), 0 2px 5px rgba(0,0,0,.4);
}
.results-stone-slab .grade-result {
  animation: apex-result-row-arrive .36s ease both;
  animation-delay: calc(var(--slab-index) * 310ms + 170ms);
}
.results-cinematic.reveal-complete .results-stone-slab,
.results-cinematic.reveal-complete .results-stone-slab .grade-result {
  animation: none;
  opacity: 1;
  transform: none;
  filter: none;
}
.results-cinematic.reveal-complete .results-reveal-skip { display: none; }
@keyframes apex-stone-slab-reveal {
  0% { opacity: 0; transform: translateY(24px) rotateX(-9deg) scale(.985); filter: brightness(1.7) blur(2px); }
  65% { opacity: 1; transform: translateY(-2px) rotateX(1deg) scale(1); filter: brightness(1.12) blur(0); }
  100% { opacity: 1; transform: translateY(0) rotateX(0) scale(1); filter: brightness(1); }
}
@keyframes apex-result-row-arrive {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .results-stone-slab,
  .results-stone-slab .grade-result { animation: none; opacity: 1; transform: none; filter: none; }
}

/* Step 13: persistent top-level environment navigation. */
.apex-environment-nav {
    display:flex;
    align-items:stretch;
    gap:8px;
    width:min(760px, 100%);
    margin:0 auto 22px;
    padding:5px;
    border:1px solid rgba(190,205,230,.13);
    border-radius:10px;
    background:rgba(9,13,22,.76);
}
.apex-environment-tab {
    display:flex !important;
    align-items:center;
    justify-content:center;
    gap:9px;
    flex:1 1 0;
    min-width:0;
    min-height:42px;
    margin:0 !important;
    padding:8px 12px !important;
    border:1px solid transparent !important;
    border-radius:7px !important;
    background:transparent !important;
    color:rgba(225,232,244,.66) !important;
    box-shadow:none !important;
    font:600 10px/1 "Oswald",sans-serif !important;
    letter-spacing:.16em;
}
.apex-environment-tab:hover:not(:disabled) { background:rgba(180,198,226,.08) !important; color:#fff !important; }
.apex-environment-tab.is-active {
    border-color:rgba(190,205,230,.22) !important;
    background:linear-gradient(180deg,rgba(160,180,215,.15),rgba(100,120,155,.07)) !important;
    color:#f5f7fb !important;
}
.environment-tab-index { color:rgba(190,205,230,.42); font-size:9px; letter-spacing:.08em; }
.environment-tab-status { color:rgba(190,205,230,.42); font-size:7px; letter-spacing:.08em; }
.apex-chat-placeholder {
    display:flex;
    flex-direction:column;
    align-items:center;
    max-width:620px;
    min-height:390px;
    margin:clamp(20px,7vh,70px) auto;
    padding:clamp(28px,6vw,56px) !important;
    text-align:center;
}
.chat-placeholder-mark { margin:0 0 20px; color:rgba(205,216,236,.72); font-size:44px; line-height:1; }
.apex-chat-placeholder h2 { margin:8px 0 12px; color:#f0f2f6; font:500 clamp(23px,4vw,32px)/1.15 "Cinzel",serif; }
.chat-placeholder-lead { max-width:420px; color:rgba(225,232,244,.72); font-size:14px; line-height:1.7; }
.chat-placeholder-rule { width:72px; height:1px; margin:22px 0; background:rgba(190,205,230,.28); }
.chat-placeholder-status { margin:0 0 8px; color:#c4ccd9; font:600 10px/1.4 "Oswald",sans-serif; letter-spacing:.18em; }
.chat-placeholder-detail { max-width:430px; margin:0 0 24px; color:rgba(225,232,244,.48); font-size:11px; line-height:1.7; }
@media (max-width:520px) {
    .apex-environment-nav { gap:3px; margin-bottom:16px; padding:4px; }
    .apex-environment-tab { gap:5px; min-height:40px; padding:7px 5px !important; font-size:9px !important; letter-spacing:.1em; }
    .environment-tab-index { display:none; }
    .environment-tab-status { font-size:6px; }
}

/* Step 14: full Home dashboard. */
.app:has(#home-dashboard:not(.hidden)) { max-width: 1240px; padding-left: clamp(14px, 3vw, 34px); padding-right: clamp(14px, 3vw, 34px); }
.home-dashboard { width:100%; display:flex; flex-direction:column; gap:18px; color:#f2eee5; }
.home-hero {
  position:relative; isolation:isolate; overflow:hidden; min-height:390px; display:flex; align-items:center;
  padding:clamp(26px,5vw,58px); border:1px solid rgba(208,169,91,.25); border-radius:13px;
  background-image:linear-gradient(90deg,rgba(3,5,8,.98) 0%,rgba(3,5,8,.88) 29%,rgba(3,5,8,.28) 63%,rgba(3,5,8,.05) 100%),linear-gradient(0deg,rgba(3,5,8,.45),transparent 48%),url("images/apex-home-pyramid.webp");
  background-size:cover; background-position:center 48%; box-shadow:0 22px 60px rgba(0,0,0,.38);
}
.home-hero::after { content:""; position:absolute; inset:0; z-index:-1; border-radius:inherit; background:linear-gradient(135deg,rgba(255,255,255,.035),transparent 42%); pointer-events:none; }
.home-hero-copy { position:relative; z-index:1; max-width:520px; }
.home-eyebrow { margin:0 0 24px; color:rgba(236,215,174,.82); font:600 10px/1.4 "Oswald",sans-serif; letter-spacing:.27em; }
.home-hero h1 { margin:0; color:#f6f0e5; font:500 clamp(58px,9vw,108px)/.98 "Cinzel",serif; letter-spacing:.055em; text-shadow:0 5px 26px rgba(0,0,0,.7); }
.home-hero-kicker { margin:12px 0 15px; color:#d6ad63; font:500 clamp(15px,2vw,22px)/1.2 "Cinzel",serif; letter-spacing:.22em; }
.home-hero-description { margin:0; color:rgba(245,241,233,.78); font-size:14px; line-height:1.75; }
.home-hero-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:27px; }
.home-primary-action,.home-secondary-action { min-height:46px; padding:0 20px; border:1px solid rgba(224,183,101,.86); border-radius:4px; color:#f5d38f; background:rgba(7,8,10,.78); font:600 11px/1 "Oswald",sans-serif; letter-spacing:.12em; text-transform:uppercase; cursor:pointer; }
.home-primary-action { min-width:190px; display:flex; align-items:center; justify-content:space-between; gap:28px; background:linear-gradient(115deg,rgba(155,112,43,.3),rgba(7,8,10,.88)); box-shadow:0 0 24px rgba(190,144,65,.12); }
.home-primary-action span { font-size:22px; line-height:0; }
.home-secondary-action { border-color:rgba(220,220,220,.2); color:rgba(246,240,230,.8); }
.home-primary-action:hover,.home-secondary-action:hover { background-color:rgba(178,133,60,.24); transform:translateY(-1px); }
.home-hero-caption { position:absolute; right:24px; bottom:18px; display:flex; align-items:center; gap:12px; color:rgba(245,230,201,.62); font:500 8px/1 "Oswald",sans-serif; letter-spacing:.2em; }
.home-hero-caption i { width:42px; height:1px; background:#c49b58; }
.home-dashboard-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.home-panel { min-width:0; padding:19px 20px; border:1px solid rgba(205,177,126,.2); border-radius:9px; background:linear-gradient(145deg,rgba(19,20,21,.94),rgba(7,8,10,.96)); box-shadow:0 14px 34px rgba(0,0,0,.2); }
.home-panel-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:13px; border-bottom:1px solid rgba(207,177,123,.14); }
.home-panel-heading h2 { margin:0; color:#e9d7b8; font:600 11px/1.2 "Oswald",sans-serif; letter-spacing:.18em; }
.home-text-action { padding:5px 0; border:0; background:none; color:#d5ad67; font:600 9px/1 "Oswald",sans-serif; letter-spacing:.1em; cursor:pointer; white-space:nowrap; }
.home-profile-summary { display:flex; align-items:center; gap:14px; padding:18px 0 16px; }
.home-avatar { width:56px; height:56px; flex:0 0 56px; object-fit:cover; border:1px solid rgba(210,174,103,.5); border-radius:50%; background:#101114; }
.home-profile-copy { display:flex; min-width:0; flex-direction:column; gap:5px; }
.home-profile-copy strong { overflow:hidden; color:#f3eee5; font:500 18px/1.2 "Cinzel",serif; text-overflow:ellipsis; white-space:nowrap; }
.home-profile-copy span { color:rgba(230,224,212,.52); font-size:11px; }
.home-stat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); padding-top:13px; border-top:1px solid rgba(207,177,123,.14); }
.home-stat-grid div { display:flex; flex-direction:column; gap:7px; padding:0 10px; border-right:1px solid rgba(207,177,123,.13); }
.home-stat-grid div:first-child { padding-left:0; }
.home-stat-grid div:last-child { padding-right:0; border:0; }
.home-stat-grid span { color:rgba(225,214,194,.48); font:500 8px/1.3 "Oswald",sans-serif; letter-spacing:.13em; }
.home-stat-grid strong { color:#e5bd76; font:500 24px/1 "Cinzel",serif; }
.home-panel-mark { color:#d5aa60; font-size:19px; }
.home-quick-panel { padding-bottom:9px; }
.home-quick-action { display:flex; width:100%; align-items:center; gap:12px; min-height:58px; padding:8px 0; border:0; border-bottom:1px solid rgba(207,177,123,.1); color:inherit; background:transparent; text-align:left; cursor:pointer; }
.home-quick-action:last-child { border-bottom:0; }
.home-action-icon { display:grid; width:34px; height:34px; flex:0 0 34px; place-items:center; border:1px solid rgba(205,166,94,.26); border-radius:5px; color:#d9b16e; font-size:19px; }
.home-quick-action>span:nth-child(2) { display:flex; min-width:0; flex:1; flex-direction:column; gap:4px; }
.home-quick-action strong { color:#e8e3da; font-size:12px; font-weight:600; }
.home-quick-action small { color:rgba(225,220,209,.46); font-size:10px; }
.home-quick-action>b { color:#cba05a; font-size:21px; font-weight:400; }
.home-quick-action:hover strong { color:#f0c879; }
.home-activity-list,.home-session-list { display:flex; flex-direction:column; }
.home-activity-row { display:flex; align-items:center; gap:12px; min-height:62px; padding:9px 0; border-bottom:1px solid rgba(207,177,123,.1); }
.home-activity-row:last-child,.home-session-row:last-child { border-bottom:0; }
.home-activity-marker { display:grid; width:31px; height:31px; flex:0 0 31px; place-items:center; border:1px solid rgba(203,162,90,.24); border-radius:50%; color:#d6ae6a; font:500 9px "Oswald",sans-serif; }
.home-activity-copy,.home-session-copy { display:flex; min-width:0; flex:1; flex-direction:column; gap:4px; }
.home-activity-copy strong,.home-session-copy strong { overflow:hidden; color:#e8e3da; font-size:11px; font-weight:600; text-overflow:ellipsis; white-space:nowrap; }
.home-activity-copy span,.home-session-copy span { color:rgba(225,220,209,.45); font:500 8px/1.3 "Oswald",sans-serif; letter-spacing:.1em; }
.home-activity-date { color:rgba(225,220,209,.48); font-size:9px; white-space:nowrap; }
.home-session-row { display:flex; align-items:center; gap:13px; min-height:67px; padding:10px 0; border-bottom:1px solid rgba(207,177,123,.1); }
.home-session-emblem { display:grid; width:44px; height:44px; flex:0 0 44px; place-items:center; border:1px solid rgba(204,165,97,.28); border-radius:6px; color:#d4ad6c; background:radial-gradient(circle,rgba(185,139,65,.14),transparent 70%); font-size:23px; }
.home-empty-state { display:flex; min-height:130px; align-items:center; justify-content:center; flex-direction:column; gap:7px; text-align:center; }
.home-empty-mark { color:#c69b58; font-size:25px; }
.home-empty-state strong { color:#e9e0d2; font:500 14px "Cinzel",serif; }
.home-empty-state span:last-child { max-width:280px; color:rgba(225,220,209,.44); font-size:10px; line-height:1.5; }
.home-loading,.home-error { margin:18px 0; color:rgba(225,220,209,.5); font-size:11px; text-align:center; }
.home-error { color:#d89a8e; }
.home-footer-banner { display:flex; min-height:70px; align-items:center; justify-content:space-between; gap:16px; padding:18px 24px; border:1px solid rgba(205,177,126,.2); border-radius:7px; background:linear-gradient(90deg,rgba(14,15,16,.98),rgba(34,26,17,.88)); }
.home-footer-banner span { color:#d7b477; font:500 11px "Cinzel",serif; letter-spacing:.22em; }
.home-footer-banner small { color:rgba(229,214,188,.48); font:500 8px "Oswald",sans-serif; letter-spacing:.2em; }
.home-panel-back { align-self:flex-start; margin:0 0 10px; padding:8px 0; border:0; color:#d2aa68; background:transparent; font:600 10px "Oswald",sans-serif; letter-spacing:.13em; cursor:pointer; }
@media (max-width:720px) {
  .app:has(#home-dashboard:not(.hidden)) { max-width:100%; padding-left:12px; padding-right:12px; }
  .home-hero { min-height:365px; align-items:flex-end; padding:25px 20px 30px; background-position:58% center; }
  .home-hero-copy { max-width:100%; }
  .home-hero h1 { font-size:clamp(54px,16vw,78px); }
  .home-hero-description { max-width:270px; font-size:12px; }
  .home-eyebrow { margin-bottom:18px; font-size:8px; }
  .home-hero-caption { right:14px; bottom:10px; font-size:7px; }
  .home-dashboard-grid { grid-template-columns:1fr; }
  .home-panel { padding:16px; }
  .home-footer-banner { align-items:flex-start; flex-direction:column; gap:8px; }
}
@media (max-width:380px) {
  .home-hero { min-height:340px; padding:20px 15px 27px; }
  .home-hero-actions { gap:8px; }
  .home-primary-action { min-width:165px; }
  .home-stat-grid span { font-size:7px; letter-spacing:.08em; }
  .home-stat-grid strong { font-size:21px; }
}
@media (prefers-reduced-motion:reduce) {
  .home-primary-action:hover,.home-secondary-action:hover { transform:none; }
}
.home-session-open { padding:7px 0 7px 8px; border:0; color:#d2a85e; background:transparent; font:600 8px "Oswald",sans-serif; letter-spacing:.1em; cursor:pointer; white-space:nowrap; }
.home-session-open:hover { color:#ffe0a0; }

/* Step 15: independent Home and Game pages with persistent environment drawer. */
.home-screen { width:100%; }
.app:has(#home-screen:not(.hidden)) { max-width:1240px; padding-left:clamp(14px,3vw,34px); padding-right:clamp(14px,3vw,34px); }
.home-dashboard { gap:22px; }
.home-hero { min-height:min(62vh,560px); }
.home-quick-panel-compact { width:min(760px,100%); align-self:center; padding:18px 22px 12px; }
.home-quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 26px; }
.home-quick-grid .home-quick-action { min-height:58px; }
.home-quick-grid .home-quick-action small { display:none; }
.environment-drawer-toggle { display:flex; width:42px; height:42px; flex:0 0 42px; flex-direction:column; justify-content:center; align-items:center; gap:5px; margin:0 14px 0 4px; padding:0; border:1px solid rgba(205,169,103,.3); border-radius:7px; background:rgba(8,9,11,.78); cursor:pointer; }
.environment-drawer-toggle span { display:block; width:18px; height:1.5px; background:#e2c184; transition:transform .18s ease,opacity .18s ease; }
.environment-drawer-toggle:hover { border-color:rgba(222,184,111,.75); background:rgba(157,115,48,.16); }
.environment-drawer-backdrop { position:fixed; inset:0; z-index:12000; background:rgba(0,0,0,.62); opacity:0; pointer-events:none; transition:opacity .22s ease; backdrop-filter:blur(4px); }
.environment-drawer-backdrop.visible { opacity:1; pointer-events:auto; }
.environment-drawer { position:fixed; z-index:12001; top:0; bottom:0; left:0; width:min(310px,84vw); padding:calc(22px + env(safe-area-inset-top)) 20px 24px; border-right:1px solid rgba(203,164,91,.28); background:linear-gradient(160deg,#11100e,#070809 72%); box-shadow:22px 0 55px rgba(0,0,0,.55); transform:translateX(-105%); transition:transform .24s ease; visibility:hidden; }
.environment-drawer.open { transform:translateX(0); visibility:visible; }
.environment-drawer-heading { display:flex; align-items:center; justify-content:space-between; padding:0 0 22px; border-bottom:1px solid rgba(205,169,103,.2); color:#e4c17f; font:600 20px/1 "Cinzel",serif; letter-spacing:.2em; }
.environment-drawer-heading button { width:34px; height:34px; border:1px solid rgba(205,169,103,.22); border-radius:6px; color:#e9d8b8; background:transparent; font-size:23px; cursor:pointer; }
.environment-drawer-links { display:flex; flex-direction:column; gap:8px; padding-top:22px; }
.environment-drawer-link { display:flex !important; align-items:center; gap:15px; width:100%; min-height:54px; margin:0 !important; padding:0 15px !important; border:1px solid transparent !important; border-radius:6px !important; color:rgba(239,232,218,.72) !important; background:transparent !important; box-shadow:none !important; text-align:left; font:500 13px/1 "Jost",sans-serif !important; cursor:pointer; }
.environment-drawer-link svg { width:21px; height:21px; flex:0 0 21px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.environment-drawer-link:hover { background:rgba(201,159,82,.09) !important; color:#fff0d2 !important; }
.environment-drawer-link.is-active { border-color:rgba(207,168,94,.24) !important; background:linear-gradient(90deg,rgba(172,126,51,.22),rgba(172,126,51,.035)) !important; color:#e9c77f !important; }
@media(max-width:720px) {
  .game-header.apex-ribbon { position:sticky; top:0; z-index:1100; }
  .environment-drawer-toggle { width:38px; height:38px; flex-basis:38px; margin-right:8px; }
  .ribbon-brand-copy span { display:none; }
  .home-hero { min-height:58vh; min-height:min(65svh,520px); background-position:62% center; }
  .home-quick-panel-compact { padding:14px 15px 8px; }
  .home-quick-grid { grid-template-columns:1fr; gap:0; }
}
@media(prefers-reduced-motion:reduce) { .environment-drawer,.environment-drawer-backdrop,.environment-drawer-toggle span { transition:none; } }

/* Shared APEX palette: Game screens now use the Home black, ivory and gold system. */
:root {
  --lx-gold-hi:#f1d59e;
  --lx-ivory:#f0ece4;
  --lx-muted:#aaa39a;
  --lx-card:rgba(12,11,10,.92);
  --pyramid-panel:#100f0d;
  --pyramid-silver:var(--lx-ivory);
  --pyramid-silver-muted:var(--lx-muted);
  --apex-teal:#d8ad62;
  --soft-fill:rgba(201,160,91,.09);
  --soft-ring:0 0 0 3px rgba(216,173,98,.32);
  --lx-line:rgba(207,171,111,.23);
}
body {
  background:radial-gradient(900px 520px at 50% -8%,rgba(171,125,53,.10),transparent 62%),linear-gradient(180deg,#090807,#020202) !important;
  background-attachment:fixed !important;
}
button:focus-visible,a:focus-visible { outline-color:#e5bd76; }
.game-header.apex-ribbon { position:sticky; top:0; z-index:1100; background:rgba(5,5,5,.94); border-bottom:1px solid rgba(207,171,111,.18); backdrop-filter:blur(16px); }

/* ============================================================
   PUBLIC APEX LANDING PAGE + AUTH / FAQ DIALOGS (Step 16)
   ============================================================ */
#login-screen.public-home {
  position:relative; z-index:1; display:block; width:100%; min-height:100vh; margin:0; padding:0;
  overflow:visible; color:#f2eee5; background:#050607;
}
.public-home-header { position:relative; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:18px; min-height:76px; padding:14px clamp(18px,5vw,76px); border-bottom:1px solid rgba(215,177,108,.2); background:rgba(4,5,7,.9); }
.public-brand { display:flex; align-items:center; gap:10px; color:#f1dfbd; text-decoration:none; font:600 24px/1 "Cinzel",serif; letter-spacing:.17em; }
.public-brand-mark { color:#d9ae62; font-size:34px; text-shadow:0 0 18px rgba(222,170,75,.55); }
.public-auth-actions { display:flex; align-items:center; gap:10px; }
.public-text-button,.public-gold-button,.public-outline-button { min-height:42px; padding:0 17px; border:1px solid rgba(218,177,103,.62); border-radius:4px; color:#efd29a; background:rgba(8,9,11,.82); font:600 10px/1 "Oswald",sans-serif; letter-spacing:.14em; cursor:pointer; }
.public-gold-button { color:#17120a; border-color:#e4bb6e; background:linear-gradient(135deg,#f0d69f,#b98236); box-shadow:0 0 24px rgba(204,153,68,.15); }
.public-gold-button:hover,.public-outline-button:hover,.public-text-button:hover { filter:brightness(1.12); transform:translateY(-1px); }
.public-home-content { width:min(100%,1440px); margin:0 auto; padding:0 clamp(16px,4vw,56px) 48px; }
.public-home-hero { position:relative; isolation:isolate; display:flex; min-height:min(690px,76vh); align-items:center; overflow:hidden; padding:clamp(30px,7vw,90px); border-bottom:1px solid rgba(217,174,98,.22); background-image:linear-gradient(90deg,rgba(3,5,8,.97) 0%,rgba(3,5,8,.83) 34%,rgba(3,5,8,.24) 72%,rgba(3,5,8,.08) 100%),linear-gradient(0deg,rgba(3,4,6,.55),transparent 48%),url("images/apex-public-pyramid.webp"); background-size:cover; background-position:center 52%; }
.public-home-hero::after { content:""; position:absolute; z-index:-1; inset:0; pointer-events:none; background:radial-gradient(ellipse at 76% 43%,rgba(242,173,62,.13),transparent 34%); animation:apex-apex-glow 7s ease-in-out infinite alternate; }
@keyframes apex-apex-glow { from { opacity:.45; } to { opacity:1; } }
.public-home-copy { position:relative; z-index:1; max-width:560px; }
.public-eyebrow { margin:0 0 17px; color:#d6b77e; font:600 10px/1.5 "Oswald",sans-serif; letter-spacing:.28em; }
.public-home-copy h1 { margin:0; color:#f2eadb; font:500 clamp(64px,11vw,132px)/.86 "Cinzel",serif; letter-spacing:.055em; text-shadow:0 6px 34px #000; }
.public-home-copy h1 span { color:#d5ad68; font-size:.43em; letter-spacing:.25em; }
.public-home-tagline { margin:26px 0 12px; color:#dcb879; font:500 clamp(12px,2vw,17px)/1.3 "Cinzel",serif; letter-spacing:.22em; }
.public-home-description { max-width:430px; margin:0; color:rgba(244,239,229,.78); font-size:14px; line-height:1.8; }
.public-home-actions { display:flex; flex-wrap:wrap; gap:11px; margin-top:30px; }
.public-main-cta { min-width:190px; display:flex; align-items:center; justify-content:space-between; }
.public-main-cta span,.public-bottom-cta button span { font-size:23px; line-height:0; }
.public-outline-button { min-width:115px; }
.public-pyramid-caption { position:absolute; right:clamp(18px,4vw,54px); bottom:22px; display:flex; align-items:center; gap:12px; color:rgba(241,218,177,.64); font:500 8px "Oswald",sans-serif; letter-spacing:.2em; }
.public-pyramid-caption i { width:42px; height:1px; background:#c99d58; }
.public-info-section { padding:clamp(48px,7vw,86px) 0 30px; }
.public-section-heading { max-width:700px; margin:0 auto 30px; text-align:center; }
.public-section-heading h2,.public-bottom-cta h2 { margin:0 0 10px; color:#f1e7d5; font:500 clamp(27px,4.4vw,43px)/1.15 "Cinzel",serif; }
.public-section-heading>p:last-child { margin:0; color:rgba(230,222,208,.58); font-size:13px; line-height:1.7; }
.public-faq-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; max-width:960px; margin:0 auto; }
.public-faq-button { display:flex; min-height:62px; align-items:center; gap:13px; padding:12px 15px; border:1px solid rgba(202,169,111,.2); border-radius:4px; color:#e8e0d2; background:linear-gradient(115deg,rgba(23,23,22,.94),rgba(8,9,10,.96)); text-align:left; cursor:pointer; }
.public-faq-button>span { color:#c99f5d; font:500 10px "Oswald",sans-serif; letter-spacing:.12em; }
.public-faq-button strong { flex:1; font:500 13px/1.35 "Jost",sans-serif; }
.public-faq-button>b { color:#d8b16e; font-size:18px; font-weight:400; }
.public-faq-button:hover { border-color:rgba(224,181,105,.65); background:linear-gradient(115deg,rgba(48,37,22,.85),rgba(10,10,10,.98)); }
.public-bottom-cta { margin:35px 0 0; padding:42px 20px; border:1px solid rgba(211,172,103,.22); border-radius:6px; background:radial-gradient(ellipse at 50% 0%,rgba(160,111,43,.15),transparent 70%),#090a0b; text-align:center; }
.public-bottom-cta .public-eyebrow { margin-bottom:9px; }
.public-bottom-cta h2 { margin-bottom:20px; }
.public-bottom-cta button { display:inline-flex; align-items:center; gap:25px; }
.public-home-footer { display:flex; min-height:68px; align-items:center; justify-content:space-between; gap:16px; padding:14px clamp(18px,5vw,76px); border-top:1px solid rgba(215,177,108,.15); color:rgba(231,218,195,.48); background:#040506; font:500 9px "Oswald",sans-serif; letter-spacing:.16em; }
.public-home-footer button { border:0; color:#cda866; background:none; font:inherit; letter-spacing:inherit; cursor:pointer; }
.public-modal-open { overflow:hidden; }
.public-modal-backdrop { position:fixed; z-index:12000; inset:0; display:flex; align-items:center; justify-content:center; overflow-y:auto; padding:20px; background:rgba(0,0,0,.82); backdrop-filter:blur(9px); }
.public-modal-backdrop.hidden { display:none !important; }
.public-auth-dialog,.public-faq-dialog { position:relative; width:min(100%,460px); max-height:min(92vh,900px); overflow-y:auto; border:1px solid rgba(218,177,103,.4); border-radius:9px; background:linear-gradient(145deg,#171614,#08090a 70%); box-shadow:0 28px 90px rgba(0,0,0,.7),0 0 35px rgba(194,145,62,.1); }
.public-auth-dialog { padding:30px 25px 24px; }
.public-auth-dialog .login-card { width:100%; max-width:none; margin:0; padding:0; border:0; box-shadow:none; background:transparent; }
.public-auth-dialog .login-brand { margin-bottom:8px; }
.public-modal-close { position:sticky; z-index:2; top:0; float:right; display:grid; width:34px; height:34px; place-items:center; margin:-14px -12px 0 0; border:1px solid rgba(218,177,103,.25); border-radius:50%; color:#e8d2a8; background:#111; font-size:23px; cursor:pointer; }
.public-faq-dialog { padding:30px clamp(22px,4vw,36px); }
.public-faq-dialog h2 { clear:both; margin:4px 0 15px; color:#f1e7d5; font:500 clamp(24px,4vw,32px)/1.2 "Cinzel",serif; }
.public-faq-content { color:rgba(238,232,220,.78); font-size:14px; line-height:1.85; }
.public-faq-dialog #public-faq-terms-link { margin-top:24px; }
@media(max-width:650px) {
  .public-home-header { min-height:64px; padding:10px 15px; }
  .public-brand { font-size:19px; }
  .public-brand-mark { font-size:27px; }
  .public-auth-actions { gap:7px; }
  .public-text-button,.public-gold-button,.public-outline-button { min-height:39px; padding:0 11px; font-size:9px; }
  .public-home-content { padding:0 0 28px; }
  .public-home-hero { min-height:590px; align-items:flex-end; padding:30px 22px 48px; background-position:62% center; }
  .public-home-hero::before { content:""; position:absolute; inset:0; z-index:0; background:linear-gradient(0deg,rgba(2,3,5,.96),rgba(2,3,5,.34) 65%,rgba(2,3,5,.06)); }
  .public-home-copy { max-width:100%; }
  .public-home-copy h1 { font-size:clamp(62px,17vw,92px); }
  .public-home-description { max-width:330px; font-size:13px; }
  .public-pyramid-caption { bottom:14px; right:16px; font-size:7px; }
  .public-info-section { padding:44px 16px 18px; }
  .public-faq-grid { grid-template-columns:1fr; gap:7px; }
  .public-faq-button { min-height:56px; }
  .public-bottom-cta { margin-top:20px; padding:34px 15px; }
  .public-home-footer { flex-wrap:wrap; justify-content:center; text-align:center; font-size:8px; }
  .public-modal-backdrop { align-items:flex-end; padding:10px; }
  .public-auth-dialog,.public-faq-dialog { max-height:94dvh; border-radius:12px; }
  .public-auth-dialog { padding:25px 18px 20px; }
}
@media(prefers-reduced-motion:reduce) { .public-home-hero::after { animation:none; } }
/* Terms must sit above the new authentication dialog when opened from signup. */
#terms-modal { z-index:13000 !important; }

/* Step 17: compact persistent navigation rail. The body gutter always matches
   the rail's actual width so the rail cannot sit over page content. */
:root { --apex-rail-width: 40px; --apex-rail-expanded: 168px; }
body { box-sizing:border-box; padding-left:var(--apex-rail-width); overflow-x:hidden; transition:padding-left .22s ease; }
body.apex-nav-expanded { padding-left:var(--apex-rail-expanded); }
#login-screen.public-home, .app { width:100%; margin-left:0; }
.environment-drawer {
  box-sizing:border-box; position:fixed; z-index:13000; inset:0 auto 0 0; width:var(--apex-rail-width); height:100dvh;
  display:flex; flex-direction:column; align-items:stretch; gap:16px; padding:calc(10px + env(safe-area-inset-top)) 5px 12px;
  overflow:hidden; border:0; border-right:1px solid rgba(205,169,103,.22); border-radius:0;
  background:linear-gradient(180deg,rgba(13,13,12,.98),rgba(5,6,7,.99));
  box-shadow:5px 0 20px rgba(0,0,0,.20); transform:none; visibility:visible;
  transition:width .22s ease; }
.environment-drawer.expanded { width:var(--apex-rail-expanded); }
.environment-drawer-toggle {
  display:flex; width:32px; height:34px; flex:0 0 34px; flex-direction:column; justify-content:center; align-items:center; gap:4px;
  margin:0 auto 8px; padding:0; border:1px solid rgba(205,169,103,.22); border-radius:6px;
  background:rgba(255,255,255,.025); cursor:pointer;
}
.environment-drawer-toggle span { display:block; width:15px; height:1.5px; background:#dfbd7d; transition:transform .18s ease; }
.environment-drawer.expanded .environment-drawer-toggle { width:100%; justify-content:flex-start; align-items:flex-start; padding-left:13px; }
.environment-drawer-links { display:flex; flex-direction:column; gap:7px; padding:0; }
.environment-drawer-link {
  display:flex !important; align-items:center; justify-content:flex-start; gap:12px; width:100%; min-width:0; height:42px; min-height:42px;
  margin:0 !important; padding:0 8px !important; overflow:hidden; border:1px solid transparent !important; border-radius:6px !important;
  color:rgba(239,232,218,.72) !important; background:transparent !important; box-shadow:none !important; text-align:left;
  font:500 12px/1 "Jost",sans-serif !important; white-space:nowrap; cursor:pointer;
}
.environment-drawer-link svg { display:block; width:19px; height:19px; min-width:19px; flex:0 0 19px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.environment-drawer-link span { opacity:0; width:0; transition:opacity .12s ease; }
.environment-drawer.expanded .environment-drawer-link span { opacity:1; width:auto; }
.environment-drawer-link.is-active { border-color:rgba(207,168,94,.24) !important; background:linear-gradient(90deg,rgba(172,126,51,.22),rgba(172,126,51,.035)) !important; color:#e9c77f !important; }
.environment-drawer-link:hover { color:#fff0d2 !important; background:rgba(201,159,82,.09) !important; }
.public-user-actions { display:flex; align-items:center; gap:9px; color:#d9bc83; font:600 9px/1 "Oswald",sans-serif; letter-spacing:.12em; }
.public-user-actions.hidden { display:none !important; }
.public-member-welcome { align-self:center; margin:0; color:#e3c58e; font:500 12px/1.5 "Cinzel",serif; letter-spacing:.08em; }
#public-bottom-cta.hidden { display:none !important; }
@media(max-width:650px) {
  :root { --apex-rail-width:38px; --apex-rail-expanded:156px; }
  .environment-drawer { padding-left:4px; padding-right:4px; }
  .environment-drawer-toggle { width:30px; height:32px; flex-basis:32px; }
  .environment-drawer-link { height:40px; min-height:40px; padding:0 6px !important; gap:10px; }
  .environment-drawer-link svg { width:18px; height:18px; min-width:18px; flex-basis:18px; }
  .public-home-header { gap:8px; }
  .public-user-actions { flex-wrap:wrap; justify-content:flex-end; }
  .public-user-actions #public-welcome-name { display:none; }
}
@media(prefers-reduced-motion:reduce) { body,.environment-drawer,.environment-drawer-toggle span,.environment-drawer-link span { transition:none !important; } }


/* Signed-out navigation notice. Kept outside the hidden game application. */
.apex-public-notice {
  position:fixed; z-index:15000; left:50%; bottom:calc(22px + env(safe-area-inset-bottom));
  width:max-content; max-width:calc(100vw - 32px); padding:13px 18px;
  border:1px solid rgba(205,169,103,.42); border-radius:5px;
  color:#f1dfbd; background:rgba(12,13,15,.97);
  box-shadow:0 10px 34px rgba(0,0,0,.42); text-align:center;
  font:500 12px/1.45 "Jost",sans-serif; letter-spacing:.025em;
  opacity:0; transform:translate(-50%,10px); pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
}
.apex-public-notice.visible { opacity:1; transform:translate(-50%,0); }
@media(prefers-reduced-motion:reduce) { .apex-public-notice { transition:none; } }

/* Step 18: bottom taskbar navigation and consistent control alignment. */
:root {
  --apex-taskbar-height: 66px;
  --apex-taskbar-gap: 8px;
}
html { scroll-padding-bottom: calc(var(--apex-taskbar-height) + 28px + env(safe-area-inset-bottom)); }
body,
body.apex-nav-expanded {
  padding-left: 0 !important;
  padding-bottom: calc(var(--apex-taskbar-height) + 26px + env(safe-area-inset-bottom)) !important;
}
.environment-drawer,
.environment-drawer.expanded {
  position: fixed !important;
  z-index: 11000 !important;
  inset: auto auto calc(10px + env(safe-area-inset-bottom)) 50% !important;
  transform: translateX(-50%) !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--apex-taskbar-gap) !important;
  width: min(420px, calc(100vw - 24px)) !important;
  height: var(--apex-taskbar-height) !important;
  min-height: var(--apex-taskbar-height) !important;
  padding: 7px 9px !important;
  overflow: visible !important;
  border: 1px solid rgba(205,169,103,.3) !important;
  border-radius: 13px !important;
  background: linear-gradient(180deg, rgba(19,19,18,.98), rgba(7,8,9,.99)) !important;
  box-shadow: 0 10px 34px rgba(0,0,0,.48), 0 0 22px rgba(190,145,65,.07) !important;
  visibility: visible !important;
  transition: none !important;
}
.environment-drawer-toggle { display: none !important; }
.environment-drawer-links {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  gap: 6px !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}
.environment-drawer-link,
.environment-drawer.expanded .environment-drawer-link {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 5px 4px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  text-align: center !important;
  line-height: 1 !important;
}
.environment-drawer-link svg {
  display: block !important;
  width: 19px !important;
  height: 19px !important;
  min-width: 19px !important;
  flex: 0 0 19px !important;
  margin: 0 auto !important;
}
.environment-drawer-link span,
.environment-drawer.expanded .environment-drawer-link span {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  opacity: 1 !important;
  color: inherit !important;
  font: 600 9px/1.1 "Oswald", sans-serif !important;
  letter-spacing: .12em !important;
  text-align: center !important;
  white-space: nowrap !important;
}
.environment-drawer-link.is-active {
  border-color: rgba(207,168,94,.3) !important;
  background: linear-gradient(180deg, rgba(172,126,51,.2), rgba(172,126,51,.07)) !important;
}
/* The fixed taskbar must never sit on top of the FAQ rows or footer. */
#login-screen.public-home { padding-bottom: 0 !important; }
.public-home-content { padding-bottom: 34px; }
.public-home-footer { margin-bottom: 0; }
/* Keep related public controls on a common center line and consistent height. */
.public-auth-actions,
.public-user-actions,
.public-home-actions {
  align-items: center !important;
  justify-content: center;
}
.public-home-actions { flex-wrap: wrap; }
.public-home-actions > button,
.public-auth-actions > button,
.public-user-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.public-faq-button { min-width: 0; }
.public-faq-button > span,
.public-faq-button > strong,
.public-faq-button > b { align-self: center; }
.public-faq-button > strong { text-align: left; }
/* Center paired action groups without stretching individual labels unevenly. */
.public-bottom-cta { display: flex; flex-direction: column; align-items: center; }
.public-bottom-cta button { justify-content: center; }
@media (max-width: 650px) {
  :root { --apex-taskbar-height: 62px; }
  body,
  body.apex-nav-expanded {
    padding-left: 0 !important;
    padding-bottom: calc(var(--apex-taskbar-height) + 22px + env(safe-area-inset-bottom)) !important;
  }
  .environment-drawer,
  .environment-drawer.expanded {
    width: min(360px, calc(100vw - 20px)) !important;
    padding: 6px 7px !important;
    border-radius: 12px !important;
  }
  .environment-drawer-links { gap: 5px !important; }
  .environment-drawer-link,
  .environment-drawer.expanded .environment-drawer-link { padding: 4px 3px !important; }
  .environment-drawer-link svg { width: 18px !important; height: 18px !important; min-width: 18px !important; flex-basis: 18px !important; }
  .environment-drawer-link span,
  .environment-drawer.expanded .environment-drawer-link span { font-size: 8px !important; }
  .public-auth-actions { gap: 6px; }
  .public-auth-actions > button,
  .public-user-actions > button { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .environment-drawer, .environment-drawer-link, .environment-drawer-link span { transition: none !important; }
}

.apex-chat-panel{max-width:720px;margin:1rem auto;padding:1rem;display:grid;gap:12px}.apex-chat-panel [hidden]{display:none!important}.apex-chat-panel select,.apex-chat-panel textarea{width:100%;box-sizing:border-box;background:#101318;color:#eee;border:1px solid #505963;border-radius:5px;padding:10px;font:inherit}.apex-chat-panel label{display:block;margin:10px 0 4px}.chat-warning{font-size:.78rem;color:#e7bd80;line-height:1.5}.chat-actions{display:flex;gap:8px;margin:8px 0}.chat-actions button{flex:1}#chat-messages{max-height:45vh;overflow:auto;display:grid;gap:8px;margin:12px 0}.chat-message{padding:10px;border:1px solid #404650;border-radius:8px;background:#101318;overflow-wrap:anywhere}.chat-mine{border-color:#777e89;margin-left:12%}.chat-message small{color:#b2b7c0}.chat-message p{white-space:pre-wrap;margin:6px 0}.chat-message button{font-size:.75rem;padding:4px 8px;min-height:0;width:auto}.apex-chat-panel #chat-compose button{margin-top:8px}
