/* Theme Variables */
:root {
    --bg: #f7f9fb;
    --text: #333;
    --primary: #463743;
    --primary-hover: #357ab8;
    --card-bg: #fff;
    --word-bg: #f1f3f5;
    --word-hover: #e8eefc;
    --border: #ccc;
    --header-overlay: rgba(0,0,0,.45);
    /* tweak to taste */
}

body.dark {
    --header-overlay: rgba(0,0,0,.6);
    --bg: #1c1c1e;
    --text: #f5f5f5;
    --primary: #303336;
    --primary-hover: #5c9df5;
    --card-bg: #2c2c2e;
    --word-bg: #3a3a3c;
    --word-hover: #505050;
    --border: #555;
}

/* Base */
body {
    margin: 0;
    font-family: "ivysoft-variable",sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 6.25rem);
}

/* Sticky header */
header {
    position: sticky;
    /* top: 0; */
    z-index: 1000;
    height: 75px;
    background: var(--primary);
    color: white;
    padding: 1rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: background 0.3s;
    font-family: "black-pack-vf", sans-serif;
    /* font-family: "bc-vajgar", sans-serif; */
    font-weight: 400;
    background-color: var(--primary);
    background-image: linear-gradient(var(--header-overlay), var(--header-overlay)), url("../assets/images/header_img.png");
    background-size: cover;
    background-position: center;
    /* background-repeat: no-repeat; */
}

.content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    text-align: center;
}

/* Sticky footer */
footer {
    bottom: 0;
    z-index: 1000;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 0.75rem;
    margin-top: auto;
    font-size: 1.5rem;
    transition: background 0.3s;
    /*font-family: "bc-vajgar", sans-serif;*/
}

.blocks {
    /* padding:1rem; */
}

/* Buttons */
button {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 2rem;
    padding: 1rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin: 0.5rem;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-btn {
    /* display: flex; */
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem auto 1rem;
    padding: 0.5rem 0.75rem;
    width: fit-content;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 900;
    color: black;
    font-family: 'ivysoft-variable';
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.action-btn-label {
    font-weight: 800;
    font-size: 0.95rem;
}

.action-btn-dots {
    display: flex;
    gap: 0.45rem;
}

.action-btn-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d93025;
    background: transparent;
    box-sizing: border-box;
}

.action-btn-dot.used {
    background: #d93025;
}

body.dark .action-btn {
    background: rgba(31, 38, 50, 0.92);
    color: #fff;
}

/* Config container */
#configContainer {
    text-align: center;
    margin: 1.5rem 0;
}

select, input[type="file"] {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 0.5rem;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s, border 0.3s;
}

/* Game grid */
#gameContainer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 90%;
    max-width: 500px;
    margin: 0 auto 2rem auto;
}

.word {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--word-bg);
    font-weight: 600;
    font-family: sans-serif;
    font-size: 1rem;
    transition: transform 0.2s, background 0.3s, border 0.3s;
    padding: 0.5rem;
    cursor: pointer;
    user-select: none;
    color: var(--text);
    overflow: hidden;
    /* Prevent text overflow */
    white-space: nowrap;
    /* Keep text in one line */
    min-width: 50px;
    /* Set a fixed width */
    min-height: 75px;
    /* Set a fixed height */
}

.word:hover {
    transform: scale(1.05);
    background: var(--word-hover);
}

.selected {
    background: #ffd966;
    border-color: #f1c232;
}

/* Grouped words */
.group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 10px auto;
    padding: 12px;
    border-radius: 12px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 500px;
    background: var(--card-bg);
}

.group.show {
    opacity: 1;
    transform: scale(1);
}

.category-title {
    font-weight: bold;
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
    color: var(--text);
}

/* Messages */
#messageBox {
    text-align: center;
    font-size: 1.1rem;
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 500px;
    transition: background 0.3s, color 0.3s;
    color: var(--text);
}

/* Animations */
.shake {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }
}

.hidden {
    display: none;
}

.fade-in {
    display: block;
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.fade-out {
    animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Dark mode toggle button */
#darkToggle {
    background: transparent;
    color: white;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.2s;
}

#darkToggle:hover {
    transform: rotate(15deg);
}

#gameContainer, #groupContainer {
    width: 90%;
    max-width: 500px;
    margin: 0 auto;
    margin-top: 2rem    ;
}

.group {
    /* back to your compact spacing */
    margin: 10px auto;
    padding: 8px;
    border-radius: 12px;
    box-sizing: border-box;
    /* layout */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}


.category-title {
    font-weight: bold;
    margin: 0 0 6px 0;
    /* only space below title */
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
}

.group .word {
    /* override the grid chip styles so grouped chips are compact */
    margin: 0;
    border: none;
    padding: 4px 8px;
    min-height: auto;
    /* overrides .word { min-height: 90px } */
    border-radius: 6px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Overlay element for gradient effect;
 placed between image and content */
.overlay-jarallax {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* background: linear-gradient(rgba(255,140,0,0.95), rgba(0,140,0,0.65));*/
    z-index: 0;
    pointer-events: none;
    /* Prevents the overlay from interfering with interactions */
}

.jarallax {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* Jarallax image stays behind everything */
.jarallax-img {
    z-index: 0;
}

/* Your dark/transparent overlay */
.overlay-jarallax {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* background: linear-gradient(rgba(255,22,0,0.95), rgba(0,140,0,0.65));*/
    pointer-events: none;
}

/* Intro text and game UI sit above image + overlay */
.jarallax .content, .jarallax #gameSetup, .jarallax .blocks, .jarallax .action-area {
    position: relative;
    z-index: 2;
}

.action-area {
    text-align: center;
    position: relative;
    z-index: 2;
    /* margin: 1rem auto 2rem; */
}

/* Optional: make game area readable */
#gameSetup.blocks {
    /* width: min(1100px, 94vw);*/
    /* width: min(98vw, 1700px); */
    /* margin: 2rem auto; */
    /* padding: 1rem; */
}

/* If cards need extra contrast over the image */
.setup-card {
    position: relative;
    z-index: 3;
}

.img-box {
    /* the parent can be any size */
    width: 100%;
    max-width: 600px;
    /* optional */
}

.img-box img {
    width: 100%;
    height: auto;
    /* keep aspect ratio */
    display: block;
    /* removes inline-gap */
}

/* stack title + tagline vertically */
header .brand {
    display: flex;
    flex-direction: column;
}

/* tagline smaller & slightly softer */
header .tagline {
    margin: 0px 0 0;
    font-weight: bolder;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    /* smaller than h1 */
    line-height: 1.2;
    opacity: 0.9;
    color: rgba(255,255,255,0.9);
    /* readable on your header bg */
    /* font-family: "Inter", "Verdana", sans-serif; /* contrast with your h1 font */
    /* if you prefer the same header font, swap to:*/
    font-family: "bc-vajgar", sans-serif;
}

.hidden {
    display: none !important;
}

body.shared-solo-mode #sourceChooser, body.shared-solo-mode #dbConfigContainer, body.shared-solo-mode #csvConfigContainer, body.shared-solo-mode #startButton, body.shared-solo-mode #showFiltersButton, body.shared-solo-mode #shareSoloButton, body.shared-solo-mode #useDbButton, body.shared-solo-mode #useCsvButton {
    display: none !important;
}

.hidden {
    display: none !important;
}

.teacher-setup {
    max-width: 980px;
    margin: 1.5rem auto;
    padding: 1rem;
}

.source-chooser, .setup-panel {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

body.dark .source-chooser, body.dark .setup-panel {
    background: rgba(30, 34, 42, 0.95);
}

.setup-subtitle, .setup-hint {
    color: #666;
    margin-top: -0.25rem;
}

body.dark .setup-subtitle, body.dark .setup-hint {
    color: #cfcfcf;
}

.mode-card-grid, .choice-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.mode-card, .choice-card {
    border: 2px solid transparent;
    border-radius: 22px;
    padding: 1rem;
    background: #fff;
    color: #222;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    text-align: center;
}

.mode-card:hover, .choice-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(0,0,0,0.12);
}

.mode-card.selected, .choice-card.selected {
    border-color: #4f8cff;
    background: #eef5ff;
}

body.dark .mode-card, body.dark .choice-card {
    background: #222936;
    color: #fff;
}

body.dark .mode-card.selected, body.dark .choice-card.selected {
    background: #233a5f;
    border-color: #85c1e9;
}

.mode-emoji, .choice-emoji {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mode-title, .choice-title {
    display: block;
    font-weight: 800;
    font-size: 1.5rem;
}

.mode-desc, .choice-desc {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    opacity: 0.78;
    font-family: 'ivysoft-variable',sans-serif;
}

.setup-step {
    margin-top: 1.5rem;
}

.category-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.builder-actions {
    text-align: center;
    margin: 1.25rem auto;
}

.primary-action, .secondary-action {
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1.25rem;
    margin: 0.35rem;
    font-weight: 800;
    cursor: pointer;
}

.primary-action {
    background: #4f8cff;
    color: white;
}

.secondary-action {
    background: #f0f2f5;
    color: #222;
}

body.dark .secondary-action {
    background: #2d3442;
    color: #fff;
}

.setup-card {
    /* max-width: 900px; */
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    width: min(1080px, calc(98% - 32px));
    margin: 2rem auto 1.5rem;
    padding: clamp(1rem, 2vw, 2rem);
}

.chooser-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.chooser-header h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.chooser-header p {
    margin: 0.5rem 0 0;
    opacity: 0.75;
}

.mode-card-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 1rem;
}

.mode-card {
    border: 2px solid transparent;
    border-radius: 22px;
    padding: 1.5rem 1rem;
    background: #f7f9fc;
    color: #222;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #9dd9f3;
}

.mode-emoji {
    display: block;
    font-size: 2.3rem;
    margin-bottom: 0.55rem;
}

.mode-title {
    display: block;
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 0.35rem;
    font-family: 'ivysoft-variable', sans-serif;
}

.mode-desc {
    display: block;
    font-size: 0.92rem;
    opacity: 0.78;
}

body.dark .setup-card {
    background: #1f2632;
    color: #fff;
}

body.dark .mode-card {
    background: #2a3241;
    color: #fff;
}

body.dark .mode-card:hover {
    border-color: #85c1e9;
}

@media (max-width: 700px) {
    .mode-card-row {
        grid-template-columns: 1fr;
    }
}

.csv-upload-row {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.csv-upload-card {
    display: block;
    width: min(100%, 360px);
    border: 2px dashed #9dd9f3;
    border-radius: 22px;
    padding: 1.25rem;
    background: #f7f9fc;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.csv-upload-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #4f8cff;
}

.visually-hidden {
    position: absolute;
    left: -9999px;
}

.csv-filter-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
    align-items: start;
}

.library-filter-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
    align-items: start;
}

.filter-card {
    background: #f7f9fc;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.filter-card label {
    display: block;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.filter-card select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #ccd3df;
    padding: 0.55rem;
    background: #fff;
}

.filter-card select[multiple] {
    min-height: 10rem;
}

.filter-card-wide {
    grid-column: 1 / -1;
}

.filter-help {
    grid-column: 1 / -1;
    opacity: 0.75;
    text-align: center;
}

.gamehut-word {
    font-size: 1.75rem;
    font-family: "baudot", sans-serif;
    font-weight: 900;
    font-style: normal;
    color: white;
}

body.dark .filter-card {
    background: #2a3241;
    color: #fff;
}

body.dark .filter-card select {
    background: #1f2632;
    color: #fff;
    border-color: #445066;
}

@media (max-width: 800px) {
    .library-filter-controls {
        grid-template-columns: 1fr;
    }

    .filter-card-wide {
        grid-column: auto;
    }
}

.filter-card {
    background: #f7f9fc;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.filter-card label {
    display: block;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.filter-card select {
    width: 100%;
    min-height: 2rem;
    border-radius: 12px;
    border: 1px solid #ccd3df;
    padding: 0.4rem;
}

.filter-help {
    grid-column: 1 / -1;
    opacity: 0.75;
    text-align: center;
}

body.dark .csv-upload-card, body.dark .filter-card {
    background: #2a3241;
    color: #fff;
}

body.dark .filter-card select {
    background: #1f2632;
    color: #fff;
    border-color: #445066;
}

@media (max-width: 800px) {
    .csv-filter-controls {
        grid-template-columns: 1fr;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    width: min(92vw, 460px);
    background: #ffffff;
    color: #222;
    border-radius: 24px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalPop 0.18s ease-out;
}

.modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.85rem;
    border: none;
    background: transparent;
    font-size: 1.7rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.modal-close:hover {
    opacity: 1;
}

.modal-icon {
    font-size: 2.4rem;
    margin-bottom: 0.5rem;
}

.modal-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
}

.modal-card p {
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.modal-ok {
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.4rem;
    font-weight: 800;
    background: #000000;
    color: white;
    cursor: pointer;
}

.modal-ok:hover {
    filter: brightness(0.95);
}

body.dark .modal-card {
    background: #1f2632;
    color: #fff;
}

@keyframes modalPop {
    from {
        transform: scale(0.94);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#gameContainer.connections-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.35rem, 1.5vw, 1.25rem);
    width: min(96vw, 1180px);
    margin: 1.25rem auto;
}

#gameContainer.connections-grid .word {
    min-height: clamp(70px, 14vw, 140px);
    padding: clamp(0.35rem, 1.4vw, 1.15rem);
    border-radius: clamp(12px, 2vw, 22px);
    font-size: clamp(0.75rem, 2.2vw, 1.65rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: normal;
}

#gameContainer.connections-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.4rem, 1vw, 1.1rem);
    /* Wider on desktop */
    width: min(98vw, 1500px);
    margin: 1.5rem auto;
}

#gameContainer.connections-grid .word {
    /* Keep height controlled */
    min-height: clamp(68px, 8vw, 100px);
    padding: clamp(0.35rem, 1vw, 0.9rem);
    border-radius: clamp(12px, 1.5vw, 20px);
    font-size: clamp(0.75rem, 1.4vw, 1.35rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

@media (min-width: 1200px) {
    #gameContainer.connections-grid {
        width: min(96vw, 1650px);
    }

    #gameContainer.connections-grid .word {
        min-height: 100px;
        /* not too tall */
    }
}

#gameContainer {
    scroll-margin-top: 90px;
}

.mistake-meter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem auto 1rem;
    padding: 0.5rem 0.75rem;
    width: fit-content;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.mistake-label {
    font-weight: 800;
    font-size: 0.95rem;
}

.mistake-dots {
    display: flex;
    gap: 0.45rem;
}

.mistake-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d93025;
    background: transparent;
    box-sizing: border-box;
}

.mistake-dot.used {
    background: #d93025;
}

body.dark .mistake-meter {
    background: rgba(31, 38, 50, 0.92);
    color: #fff;
}

.hidden {
    display: none !important;
}

#gameSetup.blocks {
    /* background-image: url(
    
    "https://img.freepik.com/free-vector/white-background-with-blue-tech-hexagon_1017-19366.jpg?semt=ais_hybrid&w=740&q=80");*/
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/*FLIP*/
.word.fly-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    margin: 0;
    transition: transform 1150ms cubic-bezier(0.22, 1, 0.36, 1), opacity 1150ms ease;
    will-change: transform, opacity;
    box-sizing: border-box;
}

#gameContainer .word.reflowing {
    transition: transform 950ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.group.pending-group {
    opacity: 0;
    transform: translateY(8px);
}

.group.pending-group.show {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 420ms ease, transform 420ms ease;
}

/* Make the solved category words spread out instead of mushing together */
#groupContainer .group {
    /* width: min(90vw, 1500px);*/
    /* margin: 1rem auto;*/
    /* padding: 1rem; */
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    /* gap: 0.75rem; */
    align-items: stretch;
}

#groupContainer .group .category-title {
    grid-column: 1 / -1;
    text-align: center;
    font-weight: 900;
    margin-bottom: 0.35rem;
}

#groupContainer .group .word {
    /* min-height: clamp(64px, 7vw, 115px); */
    /* padding: 0.75rem; */
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.modal-dont-show {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.5rem 0 1rem;
    font-size: 0.95rem;
    opacity: 0.85;
    cursor: pointer;
}

.modal-dont-show input {
    transform: scale(1.1);
}

.confetti-piece {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    border-radius: 3px;
    opacity: 0.95;
    animation: confettiUpThenDown 2600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.confetti-piece {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    border-radius: 3px;
    opacity: 0.95;
    will-change: transform, opacity;
}

/*@keyframes confettiUpThenDown {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }

  /* Fast upward burst 
  40% {
    transform: translate3d(var(--up-x), var(--up-y), 0) rotate(calc(var(--rot) * 0.35));
    opacity: 1;
  }

  /* Slow floating fall 
  70% {
    opacity: 1;
  }

  100% {
    transform: translate3d(var(--down-x), var(--down-y), 0) rotate(var(--rot));
    opacity: 0;
  }
}*/
/*---------play css-------*/
.play-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.play-card {
    border: 2px solid transparent;
    border-radius: 22px;
    padding: 1.25rem 1rem;
    background: #f7f9fc;
    color: #222;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.play-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #9dd9f3;
}

.play-card .card-emoji {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.45rem;
}

.play-card .card-title {
    display: block;
    font-weight: 900;
    font-size: 1.05rem;
}

.play-card .card-count {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    opacity: 0.75;
}

.play-option-section {
    margin-top: 1.4rem;
}

.play-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.secondary-action {
    background: #f0f2f5;
    color: #222;
}

body.dark .play-card {
    background: #2a3241;
    color: #fff;
}

body.dark .play-card:hover {
    border-color: #85c1e9;
}

body.dark .secondary-action {
    background: #2d3442;
    color: #fff;
}

@media (min-width: 1000px) {
    .play-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

#loadingOverlay.hidden {
    display: none;
}

#loadingOverlay .spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--orange);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/*-----------------AVATAR STYLING------------*/
.avatar {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-content: center;
}

/* full-screen black backdrop */
.rooms-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 2rem 2rem;
    /* or whatever size you want */
}

header {
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header {
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.avatar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-button {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: inherit;
}

.avatar-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.avatar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar.hidden {
    display: none;
}

.avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.toast-box {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 99999;
    max-width: min(420px, calc(100vw - 40px));
    padding: 14px 16px;
    background: #1f2937;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    font-size: 0.95rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-box.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-box.success {
    background: #166534;
}

.toast-box.error {
    background: #991b1b;
}

.toast-box.warning {
    background: #92400e;
}

.toast-box.info {
    background: #1f2937;
}

.toast-box {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 99999;
    max-width: min(420px, calc(100vw - 40px));
    padding: 14px 16px;
    background: #1f2937;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    font-size: 0.95rem;
    line-height: 1.35;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-box.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.shared-games-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.62);
}

.shared-games-modal-backdrop.hidden {
    display: none !important;
}

.shared-games-modal {
    width: min(700px, 100%);
    max-height: min(80vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}

.shared-games-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 22px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.shared-games-header h2 {
    margin: 0 0 5px;
    color: #111827;
    font-size: 1.3rem;
}

.shared-games-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
}

.shared-games-close {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.shared-games-close:hover {
    color: #111827;
}

.shared-games-list {
    overflow-y: auto;
    padding: 14px;
}

.shared-game-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
}

.shared-game-info {
    min-width: 0;
}

.shared-game-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.shared-game-info h3 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
}

.shared-game-info p {
    margin: 0;
    color: #64748b;
    font-size: 0.84rem;
}

.shared-game-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.shared-game-status.active {
    color: #166534;
    background: #dcfce7;
}

.shared-game-status.expired {
    color: #991b1b;
    background: #fee2e2;
}

.shared-game-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.shared-game-play {
    text-decoration: none;
}

.shared-game-expired-note {
    color: #64748b;
    font-size: 0.86rem;
}

.shared-games-empty {
    padding: 36px 22px;
    text-align: center;
    color: #475569;
}

.shared-games-empty p {
    margin: 0 0 9px;
}

@media (max-width: 600px) {
    .shared-game-card {
        flex-direction: column;
        align-items: stretch;
    }

    .shared-game-actions {
        width: 100%;
    }

    .shared-game-actions .action-btn {
        flex: 1;
        justify-content: center;
    }
}

.share-details-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.share-details-overlay.hidden {
    display: none !important;
}

.share-details-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.66);
    backdrop-filter: blur(3px);
}

.share-details-panel {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    overflow: hidden;
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 26px 80px rgba(15, 23, 42, 0.38);
}

.share-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 22px 17px;
    border-bottom: 1px solid #e5e7eb;
}

.share-details-header h2 {
    margin: 0 0 5px;
    color: #111827;
    font-size: 1.35rem;
}

.share-details-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.45;
}

.share-details-close {
    border: 0;
    background: transparent;
    padding: 0 2px;
    color: #64748b;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.share-details-close:hover {
    color: #111827;
}

.share-details-form {
    padding: 20px 22px 22px;
}

.share-field {
    display: block;
    margin-bottom: 16px;
}

.share-field span {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
}

.share-field input, .share-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    padding: 11px 12px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
}

.share-field input:focus, .share-field select:focus {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
    border-color: #6366f1;
}

.share-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.share-details-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.secondary-btn {
    background: #e2e8f0;
    color: #0f172a;
}

body.share-details-open {
    overflow: hidden;
}

@media (max-width: 560px) {
    .share-details-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .share-details-panel {
        border-radius: 22px 22px 16px 16px;
    }

    .share-field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .share-details-actions {
        flex-direction: column-reverse;
    }

    .share-details-actions .action-btn {
        width: 100%;
        justify-content: center;
    }
}

.shared-game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 6px !important;
}

.shared-game-meta span {
    padding: 3px 7px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 600;
}

.shared-game-delete {
    background: #fee2e2;
    color: #991b1b;
}

.shared-game-delete:hover {
    background: #fecaca;
}

.shared-game-actions {
    flex-wrap: wrap;
}

.editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.editor-modal {
    width: min(96vw, 1150px);
    max-height: 92vh;
    overflow: auto;
    background: #ffffff;
    color: #222;
    border-radius: 28px;
    padding: 1.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.editor-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    border: none;
    background: transparent;
    font-size: 2rem;
    cursor: pointer;
    color: inherit;
}

.editor-header {
    text-align: center;
    margin-bottom: 1rem;
}

.editor-header h2 {
    margin: 0;
}

.editor-header p {
    margin: 0.4rem 0 0;
    opacity: 0.75;
}

.editor-title-row {
    max-width: 520px;
    margin: 0 auto 1.25rem;
}

.editor-title-row label, .editor-category label {
    display: block;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.editor-title-row input, .editor-category input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccd3df;
    border-radius: 14px;
    padding: 0.75rem;
    font: inherit;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 1rem;
}

.editor-category {
    background: #f7f9fc;
    border-radius: 22px;
    padding: 1rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.editor-category-name {
    font-weight: 900;
    background: #eef5ff;
    margin-bottom: 0.75rem;
}

.editor-word {
    margin-top: 0.55rem;
}

.editor-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

body.dark .editor-modal {
    background: #1f2632;
    color: #fff;
}

body.dark .editor-category {
    background: #2a3241;
}

body.dark .editor-category-name {
    background: #233a5f;
    color: #fff;
}

body.dark .editor-title-row input, body.dark .editor-category input {
    background: #1f2632;
    color: #fff;
    border-color: #445066;
}

@media (max-width: 950px) {
    .editor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

.hidden {
    display: none !important;
}

.credits-btn {
    border: none;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-weight: 800;
    cursor: pointer;
    background: #f0f2f5;
    color: #222;
}

.credits-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.credits-modal {
    width: min(92vw, 480px);
    background: #fff;
    color: #222;
    border-radius: 22px;
    padding: 1.5rem;
    position: relative;
    text-align: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.credits-modal h2 {
    margin: 0 0 0.75rem;
}

.credits-modal p {
    margin: 0;
    line-height: 1.5;
}

.credits-close {
    position: absolute;
    top: 0.6rem;
    right: 0.85rem;
    border: none;
    background: transparent;
    font-size: 1.7rem;
    cursor: pointer;
    color: inherit;
}

body.dark .credits-modal {
    background: #1f2632;
    color: #fff;
}

body.dark .credits-btn {
    background: #2d3442;
    color: #fff;
}

.thredzy-hero {
    width: min(1080px, calc(98% - 32px));
    margin: 2rem auto 1.5rem;
    padding: clamp(1rem, 2vw, 2rem);
    display: grid;
    grid-template-columns: minmax(0, 1.1505fr) minmax(320px, 0.95fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    border-radius: 12px;
    background: radial-gradient(circle at top left, rgba(255, 221, 135, 0.45), transparent 34%), radial-gradient(circle at bottom right, rgba(128, 190, 255, 0.35), transparent 34%), linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,250,252,0.84));
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.hero-kicker {
    margin: 0 0 0.8rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: none;
    color: #7c3aed;
}

.thredzy-hero h2 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.055em;
    color: #111827;
}

.hero-lead {
    max-width: 680px;
    margin: 1.2rem 0 1.5rem;
    font-size: clamp(1.02rem, 1.5vw, 1.2rem);
    line-height: 1.65;
    color: #374151;
}

.hero-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1.5rem 0;
}

.hero-benefit {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.hero-benefit span {
    display: inline-flex;
    font-size: 1.4rem;
    margin-bottom: 0.45rem;
}

.hero-benefit strong {
    display: block;
    font-size: 0.95rem;
    color: #111827;
    margin-bottom: 0.3rem;
}

.hero-benefit p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #4b5563;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.4rem;
}

.hero-primary-btn {
    text-decoration: none;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.85);
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.14);
}

.thredzy-hero-visual {
    position: relative;
    min-height: 480px;
}

.hero-image-card {
    position: relative;
    width: min(440px, 100%);
    margin-left: auto;
    border-radius: 34px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
    transform: rotate(2deg);
    background: #f8fafc;
}

.hero-image-card img {
    display: block;
    width: 100%;
    height: 430px;
    object-fit: cover;
}

.floating-word-card {
    position: absolute;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.card-one {
    left: 18px;
    top: 24px;
}

.card-two {
    right: 22px;
    top: 90px;
}

.card-three {
    left: 26px;
    bottom: 90px;
}

.card-four {
    right: 24px;
    bottom: 28px;
}

.hero-mini-board {
    position: absolute;
    left: 0;
    bottom: 0;
    width: min(360px, 92%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.45rem;
    padding: 0.75rem;
    border-radius: 24px;
    background: rgba(17, 24, 39, 0.92);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(12px);
}

.hero-mini-board div {
    min-height: 48px;
    display: grid;
    place-items: center;
    padding: 0.4rem;
    border-radius: 14px;
    background: #fff;
    color: #111827;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.dark .thredzy-hero, body.dark .thredzy-hero {
    background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.28), transparent 34%), radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.24), transparent 34%), linear-gradient(135deg, rgba(17,24,39,0.95), rgba(31,41,55,0.9));
    border-color: rgba(255, 255, 255, 0.08);
}

.dark .thredzy-hero h2, body.dark .thredzy-hero h2, .dark .hero-benefit strong, body.dark .hero-benefit strong {
    color: #f9fafb;
}

.dark .hero-lead, body.dark .hero-lead, .dark .hero-benefit p, body.dark .hero-benefit p {
    color: #d1d5db;
}

.dark .hero-benefit, body.dark .hero-benefit {
    background: rgba(17, 24, 39, 0.68);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .secondary-btn, body.dark .secondary-btn {
    background: rgba(17, 24, 39, 0.75);
    color: #f9fafb;
    border-color: rgba(255, 255, 255, 0.16);
}

@media (max-width: 900px) {
    .thredzy-hero {
        grid-template-columns: 1fr;
    }

    .thredzy-hero-visual {
        min-height: auto;
    }

    .hero-image-card {
        margin: 0 auto;
    }

    .hero-mini-board {
        position: relative;
        margin: -2.5rem auto 0;
        left: auto;
        bottom: auto;
    }

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

@media (max-width: 560px) {
    .thredzy-hero {
        width: min(95% - 20px, 1180px);
        padding: 1.2rem;
        border-radius: 12px;
    }

    .hero-image-card img {
        height: 310px;
    }

    .floating-word-card {
        font-size: 0.8rem;
    }

    .hero-mini-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.35rem;
        padding: 0.55rem;
    }

    .hero-mini-board div {
        min-height: 40px;
        font-size: 0.68rem;
        border-radius: 10px;
    }
}

.hero-mini-board div {
    transition: background 0.35s ease, color 0.35s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.hero-mini-board.is-shuffled div {
    transform: rotate(var(--tilt, 0deg));
}

.hero-mini-board.is-solved div {
    animation: tilePop 0.45s ease both;
}

@keyframes tilePop {
    0% {
        transform: scale(1);
    }

    55% {
        transform: scale(1.06);
    }

    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-mini-board div {
        transition: none;
        animation: none !important;
    }
}

.role-choice-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(10px);
}

.role-choice-overlay.hidden {
    display: none;
}

.role-choice-modal {
    width: min(520px, 100%);
    padding: 2rem;
    border-radius: 28px;
    background: #fff;
    color: #111827;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.role-choice-modal h2 {
    margin: 0 0 0.65rem;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
}

.role-choice-modal p {
    margin: 0 auto 1.5rem;
    max-width: 420px;
    color: #4b5563;
    line-height: 1.5;
}

.role-choice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.role-choice-btn {
    cursor: pointer;
    border: 0;
    border-radius: 22px;
    padding: 1.1rem;
    min-height: 120px;
    font-size: 1.05rem;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.role-choice-btn span {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.92;
}

.role-choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.24);
}

.student-btn {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.teacher-btn {
    background: linear-gradient(135deg, #16a34a, #0f766e);
}

body.dark .role-choice-modal, .dark .role-choice-modal {
    background: #111827;
    color: #f9fafb;
}

body.dark .role-choice-modal p, .dark .role-choice-modal p {
    color: #d1d5db;
}

@media (max-width: 560px) {
    .role-choice-actions {
        grid-template-columns: 1fr;
    }

    .role-choice-modal {
        padding: 1.4rem;
        border-radius: 22px;
    }

    .role-choice-btn {
        min-height: 96px;
    }
}

body.shared-solo-mode.show-play-more #playMoreButton {
    display: inline-flex !important;
}

.thredzy-modes {
    width: min(1080px, calc(98% - 32px));
    margin: 2rem auto 1.5rem;
    padding: clamp(1rem, 2vw, 2rem);
    display: grid;
    /* grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); */
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    border-radius: 12px;
    background: radial-gradient(circle at top left, rgba(255, 221, 135, 0.45), transparent 34%), radial-gradient(circle at bottom right, rgba(128, 190, 255, 0.35), transparent 34%), linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,250,252,0.84));
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    overflow: hidden;
}

.modes-heading {
    max-width: 760px;
    margin-bottom: 2rem;
}

.modes-kicker {
    margin: 0 0 0.7rem;
    color: #c4b5fd;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.thredzy-modes h2 {
    margin: 0;
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.modes-intro {
    margin: 1rem 0 0;
    max-width: 700px;
    color: #d1d5db;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.65;
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.mode-showcase-card {
    position: relative;
    min-height: 280px;
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.mode-showcase-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.24);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.2);
}

.mode-featured {
    grid-column: span 2;
    background: linear-gradient( 135deg, rgba(124, 58, 237, 0.44), rgba(37, 99, 235, 0.3) );
}

.mode-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 1.2rem;
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 1.7rem;
}

.mode-label {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: #c4b5fd;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mode-card-copy h3 {
    margin: 0 0 0.55rem;
    color: #fff;
    font-size: 1.35rem;
}

.mode-card-copy p {
    margin: 0;
    color: #d1d5db;
    font-size: 0.93rem;
    line-height: 1.55;
}

.mode-card-link {
    display: inline-flex;
    margin-top: 1rem;
    color: #ddd6fe;
    font-weight: 800;
    text-decoration: none;
}

.mode-card-link:hover {
    color: #fff;
}

.modes-bottom-banner {
    margin-top: 1.2rem;
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.modes-bottom-banner > div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mode-banner-icon {
    font-size: 2rem;
}

.modes-bottom-banner strong {
    display: block;
    margin-bottom: 0.2rem;
    color: #1c0101;
    font-size: 1.05rem;
}

.modes-bottom-banner p {
    margin: 0;
    color: #000;
    font-size: 0.9rem;
    line-height: 1.45;
}

.modes-cta {
    flex-shrink: 0;
    text-decoration: none;
}

@media (max-width: 900px) {
    .modes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mode-featured {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .thredzy-modes {
        /* width: min(100% - 20px, 1180px); */ padding: 1.2rem;
        border-radius: 24px;
    }

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

    .mode-featured {
        grid-column: span 1;
    }

    .mode-showcase-card {
        min-height: auto;
    }

    .modes-bottom-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .modes-cta {
        width: 100%;
        justify-content: center;
    }
}

.modes-kicker {
    margin: 0 0 0.7rem;
    color: #7c3aed;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.thredzy-modes h2 {
    margin: 0;
    color: #111827;
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.modes-intro {
    margin: 1rem 0 0;
    max-width: 700px;
    color: #374151;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.65;
}

.mode-showcase-card {
    position: relative;
    min-height: 280px;
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.mode-showcase-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(124, 58, 237, 0.22);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.14);
}

.mode-featured {
    grid-column: span 2;
    background: radial-gradient(circle at top left, rgba(196, 181, 253, 0.4), transparent 38%), linear-gradient( 135deg, rgba(237, 233, 254, 0.92), rgba(219, 234, 254, 0.88) );
}

.mode-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 1.2rem;
    border-radius: 17px;
    background: rgba(124, 58, 237, 0.1);
    font-size: 1.7rem;
}

.mode-label {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: #7c3aed;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mode-card-copy h3 {
    margin: 0 0 0.55rem;
    color: #111827;
    font-size: 1.35rem;
}

.mode-card-copy p {
    margin: 0;
    color: #4b5563;
    font-size: 0.93rem;
    line-height: 1.55;
}

.mode-card-link {
    display: inline-flex;
    margin-top: 1rem;
    color: #7c3aed;
    font-weight: 800;
    text-decoration: none;
}

.mode-card-link:hover {
    color: #5b21b6;
}

body.dark .thredzy-modes, .dark .thredzy-modes {
    background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.28), transparent 34%), radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.24), transparent 34%), linear-gradient(135deg, rgba(17,24,39,0.95), rgba(31,41,55,0.9));
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .thredzy-modes h2, .dark .thredzy-modes h2, body.dark .mode-card-copy h3, .dark .mode-card-copy h3, body.dark .modes-bottom-banner strong, .dark .modes-bottom-banner strong {
    color: #f9fafb;
}

body.dark .modes-intro, .dark .modes-intro, body.dark .mode-card-copy p, .dark .mode-card-copy p, body.dark .modes-bottom-banner p, .dark .modes-bottom-banner p {
    color: #d1d5db;
}

body.dark .mode-showcase-card, .dark .mode-showcase-card, body.dark .modes-bottom-banner, .dark .modes-bottom-banner {
    background: rgba(17, 24, 39, 0.68);
    border-color: rgba(255, 255, 255, 0.1);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    flex-shrink: 0;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.header-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

#darkToggle, .header-actions .action-btn, .header-actions .avatar-button {
    /* flex-shrink: 0; */
}

@media (max-width: 700px) {
    .site-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

@media (max-width: 700px) {
    .thredzy-modes {
        padding: 1.25rem;
        border-radius: 24px;
    }

    .modes-grid {
        display: flex;
        flex-direction: column;
        gap: 0.9rem;
    }

    .mode-showcase-card, .mode-showcase-card.mode-featured {
        /* width: 100%; */
        min-height: auto;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 1rem;
        padding: 1.1rem;
        /* Stop the featured card spanning columns */
        grid-column: auto;
    }

    .mode-icon {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        margin: 0;
        border-radius: 15px;
        font-size: 1.45rem;
    }

    .mode-card-copy {
        flex: 1;
        min-width: 0;
    }

    .mode-label {
        margin-bottom: 0.3rem;
        font-size: 0.67rem;
    }

    .mode-card-copy h3 {
        margin: 0 0 0.4rem;
        font-size: 1.15rem;
    }

    .mode-card-copy p {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .mode-card-link {
        margin-top: 0.65rem;
    }

    .modes-bottom-banner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.1rem;
    }

    .modes-bottom-banner > div {
        display: flex;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .modes-cta {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 75px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    flex-shrink: 0;
}

.brand h1, .brand .tagline {
    margin: 0;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.header-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.header-menu-button {
    display: none;
    width: 46px;
    height: 46px;
    padding: 11px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.header-menu-button span {
    display: block;
    width: 100%;
    height: 3px;
    margin: 4px 0;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 700px) {
    .site-header {
        height: auto;
        min-height: 75px;
        flex-wrap: wrap;
    }

    .header-menu-button {
        display: block;
        margin-left: auto;
    }

    .header-actions {
        width: 100%;
        max-height: 0;
        margin: 0;
        display: flex;
        flex-direction: initial;
        align-items: stretch;
        gap: 0.65rem;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
    }

    .header-actions.is-open {
        max-height: 400px;
        padding-top: 0.75rem;
        opacity: 1;
        pointer-events: auto;
    }

    .header-actions .action-btn, .header-actions .header-play-btn {
        width: 100%;
        justify-content: center;
    }

    .header-actions #darkToggle, .header-actions .avatar-button {
        /* align-self: flex-end; */
    }

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

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

    .header-menu-button[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}






html, body {
  min-height: 100%;
}

body {
  position: relative;
  margin: 0;
  /*background: url("./../assets/images/thredzy-bg-x.jpg") center center / cover no-repeat fixed;*/
}

/* soft overlay for readability */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;

  /*background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.78)),
    radial-gradient(circle at top left, rgba(255, 221, 135, 0.18), transparent 35%),
    radial-gradient(circle at bottom right, rgba(128, 190, 255, 0.18), transparent 35%);*/
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;

  display: flex;
  flex-direction: column;
}

header {
  flex-shrink: 0;
}

main {
  flex: 1 0 auto;

}

footer {
  flex-shrink: 0;

  margin-top: auto;
}





.shared-game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.shared-game-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  font-size: 0.85rem;
  font-weight: 600;
  color: black;
}
.play-card {
  overflow: hidden;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e9ecef;
}

.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;

  transition: transform 0.25s ease;
}

.play-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-title {
  display: block;
  padding: 12px 14px 3px;
  font-weight: 700;
}

.card-count {
  display: block;
  padding: 0 14px 12px;
  font-size: 0.85rem;
  opacity: 0.65;
}


/* Emoji cards, such as Levels */
.card-emoji {
  display: block;
  font-size: 2.3rem;
  padding: 18px 14px 5px;
}


.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  min-height: 115px;

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

  background:
    linear-gradient(
      135deg,
      #f1f3f5 0%,
      #e9ecef 100%
    );

  font-size: 2.5rem;
}

.card-thumb-placeholder span {
  opacity: 0.45;
}

.confetti {
  position: fixed;
  top: -30px;
  z-index: 9999;
  pointer-events: none;

  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;

  will-change: transform, opacity;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translate3d(0, 110vh, 0) rotate(720deg);
    opacity: 0;
  }
}
/* =========================================
   Thredzy Mode Showcase Thumbnails
========================================= */

.mode-showcase-card,
.mode-showcase-card.mode-featured {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* Thumbnail */
.mode-thumb,
.mode-showcase-card.mode-featured .mode-thumb {
  width: 100%;
  height: 150px;
  min-height: 0;
  overflow: hidden;
  background: #eef1f5;
  position: relative;
  flex-shrink: 0;
}

.mode-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;

  transition: transform 0.3s ease;
}


/* Slight image movement on desktop hover */
@media (hover: hover) {
  .mode-showcase-card:hover .mode-thumb img {
    transform: scale(1.04);
  }
}


/* Card text */
.mode-card-copy,
.mode-showcase-card.mode-featured .mode-card-copy {
  width: 100%;
  padding: 22px;
  flex: 1;
}


/* =========================================
   Missing Image Placeholder
========================================= */

.mode-thumb.thumb-missing {
  display: flex;
  align-items: center;
  justify-content: center;

  background:
    linear-gradient(
      135deg,
      #f2f4f7 0%,
      #e5e9ef 100%
    );
}

.mode-thumb.thumb-missing::after {
  content: "🧩";
  font-size: 3rem;
  opacity: 0.35;
}






.hero-video-card {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.thredzy-hero-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}


.hero-image-card .thredzy-hero-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* =========================================
   Mobile
========================================= */

@media (max-width: 650px) {

  .mode-showcase-card,
  .mode-showcase-card.mode-featured {
    display: flex;
    flex-direction: column;
    grid-column: auto;
  }

  .mode-thumb,
  .mode-showcase-card.mode-featured .mode-thumb {
    width: 100%;
    height: 150px;
    min-height: 0;
  }

  .mode-card-copy,
  .mode-showcase-card.mode-featured .mode-card-copy {
    width: 100%;
    padding: 20px;
  }
}
    .sr-only {
  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;
        
        
        
        
        