:root {
    --clr-accent: #121965;
    --clr-accent-hover: rgba(18, 25, 101, 0.6);
    --clr-accent2: #b51c65;
    --clr-bad: #ef4444;
    --clr-bg: #f8fafc;
    --clr-border: #3745af;
    --clr-good: #025048;
    --clr-note: #121965;
    --clr-surface: #ffffff;
    --clr-surface-light: #f1f5f9;
    --clr-text: #000000;
    --clr-text-muted: #3745af;
}


* {
    box-sizing: border-box;
}

body {
    background: var(--clr-bg);
    color: var(--clr-text);
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

button {
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

@media (max-width: 768px) {
    main {
        padding-bottom: 120px;
    }
}

/* Header Bar */
.header-bar {
    align-items: center;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 2rem 0.75rem .75rem .75rem;
}

.header-left {
    align-items: center;
    display: flex;
    gap: 1rem;
    min-width: 0;
}

.header-logo {
    flex-shrink: 0;
    height: 32px;
    width: auto;
}

.header-puzzle {
    color: var(--clr-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.header-center {
    align-items: center;
    display: flex;
    font-size: 0.875rem;
    gap: 1.5rem;
    width: 450px;
}

.header-stat {
    align-items: center;
    color: var(--clr-accent-hover);
    display: flex;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    gap: 0.35rem;
    white-space: nowrap;

}

.header-stat-label {
    color: var(--clr-text-muted);
}

.header-stat-value {
    color: var(--clr-accent);
    font-weight: 600;
}

.header-right {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 0.5rem;
}

.icon-btn {
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    display: flex;
    justify-content: center;
    padding: 0.5rem;
    transition: all 0.2s;
}

.icon-btn:disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    opacity: 0.4;
}

.icon-btn:hover {
    background: var(--clr-surface-light);
    color: var(--clr-text);
}

/* Main Game Area */
.game-container {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    justify-content: center;
    padding: 2rem 1rem 7rem 1rem;
}

.difficulty-badge {
    color: var(--clr-accent-hover);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Grid */
.grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, 1fr);
    margin: 0 auto;
    touch-action: none;
}

.tile {
    align-items: center;
    background: linear-gradient(160deg, #fbfcff, #edf4ff);
    border: 1px solid #cfd9ff;
    border-radius: 12px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 -2px 6px rgba(0, 0, 0, 0.08) inset,
        0 6px 12px rgba(18, 36, 66, 0.18);
    color: var(--clr-note);
    cursor: pointer;
    display: flex;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    height: 6rem;
    justify-content: center;
    padding: 0.35rem;
    position: relative;
    text-align: center;
    transform: translateZ(0);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    width: 6rem;
}

.tile::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

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

.tile-dragging {
    opacity: 0.8;
    transform: scale(1.03);
}

.tile-empty {
    background: linear-gradient(135deg, #f3f9ff, #e9f0ff);
    border: 2px dashed #cecedb;
    color: var(--clr-text-muted);
    font-style: italic;
}

.tile.selected {
    border-color: var(--clr-accent);
    transform: scale(1.05);

}

.tile-correct {
    background: linear-gradient(135deg, #5ee4a3, #2e5411);
    border: 1px solid #cfd9ff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), /* main shadow */ 0 4px 8px rgba(0, 0, 0, 0.08); /* softer second shadow */
    color: #fff;
    transform: translateZ(0);
    transition: box-shadow 0.15s ease, transform 0.15s ease;

}

.tile-wrong {
    background: linear-gradient(135deg, #ffbfcf, #c70707);
    border: 1px solid #cfd9ff;
    border-color: rgba(255, 80, 80, 0.6);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), /* main shadow */ 0 4px 8px rgba(0, 0, 0, 0.08); /* softer second shadow */
    color: #fff;
    transform: translateZ(0);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tile-hover {
    border-color: var(--clr-accent);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25),
    0 6px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);

}

/* Word Bank */
.word-bank {
    display: flex;
    flex-wrap: wrap;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    gap: 0.5rem;
    justify-content: center;
    max-width: 32rem;
}

.btn.choice-btn {
    background: var(--clr-accent);
    border: 2px solid var(--clr-border);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    touch-action: none;
}

.btn.choice-btn:hover:not(:disabled) {
    background: var(--clr-accent-hover);
    border-color: var(--clr-accent);
}

.btn.choice-btn:disabled {
    background-color: #cecece;
    cursor: not-allowed;
    opacity: 0.5;
}

.word-btn.selected {
    background: var(--clr-accent);
    border-color: var(--clr-accent);
    color: white;
}


.drag-ghost {
    background: var(--clr-accent);
    border: 2px solid var(--clr-border);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    opacity: 0.7;
}


.hint-btn {
    align-items: center;
    background: rgba(245, 158, 11);
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    cursor: pointer;
    display: none;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

@media (max-width: 768px) {
    .hint-btn {
        order: 1;
    }
}

.hint-btn:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.3);
    color: var(--clr-accent-hover);
}

.hint-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.hint-display {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.5rem;
    color: var(--clr-text);
    font-size: 0.875rem;
    max-width: 32rem;
    padding: 0.75rem 1rem;
    text-align: center;
}
.hint-display[hidden] {
    display: none;
}

.hint-display-header {
    align-items: center;
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    text-align: left;
}

.hint-body {
    text-align: left;
}

.hint-close-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.2rem 0.3rem;
}

.hint-close-btn:focus-visible {
    outline: 2px solid var(--clr-accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--clr-accent);
    border: none;
    border-radius: 0.75rem;
    color: white;
    cursor: pointer;
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem;
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--clr-accent-hover);
}

.btn-secondary {
    background: var(--clr-surface-light);
    border: none;
    border-radius: 0.75rem;
    color: var(--clr-text);
    cursor: pointer;
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem;
    transition: all 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    background: #969fb6;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Message */
#message {
    color: var(--clr-text-muted);
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

#message.start {
    color: var(--clr-note);
    font-size: 1.3rem;
}

#message.note {
    color: var(--clr-note);
}

#message.good {
    color: var(--clr-good);
}

#message.bad {
    color: var(--clr-bad);
}

/* Modal */
.modal {
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 100;
}

.modal.show {
    display: flex;
}

.modal-body {
    background: var(--clr-surface);
    border-radius: 1rem;
    color: var(--clr-text);
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-height: 90vh;
    max-width: 480px;
    overflow-y: auto;
    padding: 1.5rem;
    width: 100%;
}

.modal-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0 !important;
}

.modal h3 {
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--clr-text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
}

.close-btn:hover {
    color: var(--clr-text);
}

/* Persona Grid */
.persona-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 1rem;
}

.persona-card {
    align-items: center;
    background: var(--clr-surface-light);
    border: 2px solid var(--clr-border);
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    gap: 0.5rem;
    padding: 0.75rem;
    transition: all 0.2s;
}

.persona-card:hover {
    background: #3f4f5f;
    border-color: var(--clr-accent);
}

.persona-avatar-img {
    border-radius: 50%;
    height: 48px;
    width: 48px;
}

.persona-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Persona Display in Header */
.persona-display {
    align-items: center;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: var(--clr-surface-light);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    gap: 8px;
    padding: 8px 14px;
    transition: all 0.2s;
}

.persona-display:hover {
    background: var(--clr-accent);
}

.persona-display:hover .persona-name-small {
    color: #fff;
}

.persona-avatar-small {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
    height: 28px;
    object-fit: cover;
    width: 28px;
}

.persona-name-small {
    color: var(--clr-accent);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .persona-display {
        padding: 0.2rem 0.2rem 0.2rem 0.5rem;
    }

    .persona-name-small {
        font-size: 0.7rem;
    }
}

/* Leaderboard */
.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    background: var(--clr-surface-light);
    border: none;
    border-radius: 0.5rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    flex: 1;
    font-weight: 500;
    padding: 0.5rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--clr-accent);
    color: white;
}

/* Splash Screen */
.splash {
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 200;
}

.splash.show {
    display: flex;
}

.splash-card {
    background: var(--clr-surface);
    border-radius: 1rem;
    max-width: 360px;
    padding: 2rem;
    text-align: center;
    width: 90%;
}

.splash-logo {
    margin-bottom: 1rem;
    max-width: 200px;
}

.splash-tagline {
    color: var(--clr-accent);
    font-size: 1rem;
    margin: 0 0 1.5rem;
}

.splash-day {
    color: var(--clr-note);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.splash-streak {
    color: var(--clr-note);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    white-space: pre-line;
}


button#splashPlay {
    width: 100%;
}

.splash-instructions {
    background: var(--clr-surface-light);
    font-family: 'DM SANS', sans-serif;
    margin: 1.5rem 0;
    padding: 1rem;
}

.splash-instructions h4 {
    COLOR: var(--clr-accent);
    font-size: 1.1rem;
    font-weight: bold;
    text-align: left;
}

.splash-instructions li {
    color: var(--clr-text);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0.5rem 0;
    text-align: left;
}


.splash-instructions p:first-child {
    margin-top: 0;
}

.splash-instructions p:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .header-bar {
        flex-wrap: wrap;
        font-family: "DM Sans", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        padding: 0.5rem 0.75rem;
    }

    .header-left {
        flex: 1;
        gap: 0.5rem;
        min-width: 0;
    }

    .header-logo {
        height: 30px;
    }

    .header-puzzle {
        font-size: 0.7rem;
    }

    .header-center {
        border-top: 1px solid var(--clr-border);
        font-size: 0.8rem;
        gap: 1rem;
        justify-content: center;
        margin-left: 0;
        margin-top: 0.5rem;
        order: 3;
        padding-top: 0.5rem;
        width: 100%;
    }

    .header-right {
        gap: 0.25rem;
        order: 2;
    }

    .icon-btn {
        padding-left: 0;
        padding-right: 0.4rem;
    }

    .icon-btn .material-symbols-outlined {
        font-size: 1.25rem;
    }

    .tile {
        font-size: 0.85rem;
        height: 6rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 6rem;
        touch-action: none;
    }

    .game-container {
        gap: 1.5rem;
        padding: 1rem 0.75rem 5rem;
    }

    .action-bar {
        background: var(--clr-surface);
        border-top: 1px solid var(--clr-border);
        bottom: 0;
        left: 0;
        padding: 1rem;
        position: fixed;
        right: 0;
    }

    .word-bank {
        gap: 0.4rem;
    }

    .word-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    /* Reorder hint UI above the grid on mobile */
    .game-container #difficulty {
        order: 0;
    }

    .game-container #hintBtn {
        order: 1;
    }

    .game-container #hintText {
        order: 2;
    }

    .game-container #grid {
        order: 3;
    }

    .game-container #choices {
        order: 5;
    }

    .game-container #message {
        order: 4;
    }

    .game-container #hintText {
        align-self: stretch;
    }
}

/* Hidden elements */
[hidden] {
    display: none !important;
}

.persona-bar {
    display: none;
}

/* Action Bar - default positioning for desktop */
.action-bar {
    background: transparent;
    border-top: none;
    bottom: auto;
    left: auto;
    padding: 1rem;
    position: relative;
    right: auto;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 0 auto;
    max-width: 32rem;
}

/* Only fix to bottom on mobile */
@media (max-width: 768px) {
    .action-bar {
        background: var(--clr-surface);
    }

    .game-container {
        padding-bottom: 3rem;
    }
}

/* On desktop, no extra padding needed */
@media (min-width: 769px) {
    .game-container {
        padding: 2rem 1rem;
    }
}

.game-footer {
    border-top: 1px solid var(--clr-border);
    color: var(--clr-text-muted);
    font-size: 0.75rem;
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
}

@media (max-width: 768px) {
    .game-footer {
        background: var(--clr-surface);
        border-top: 1px solid var(--clr-border);
        bottom: 0;
        font-size: 0.7rem;
        left: 0;
        padding: 0.5rem;
        position: fixed;
        right: 0;
        z-index: 5; /* Below action bar which should be z-index: 10 */
    }

    .action-bar {
        bottom: 2rem; /* Height of footer */
        z-index: 10;
    }
}

/* Animation for the entire message */
.completion-celebration {
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Performance-based styling */
.message.perfect {
    border-color: var(--clr-good);
}

.message.perfect .completion-title {
    color: var(--clr-good);
}

.message.perfect .completion-score-value {
    color: var(--clr-good);
}

.message.good {
    border-color: var(--clr-accent);
}

.message.okay {
    border-color: var(--clr-border);
}


/* Slide in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .completion-celebration {
        padding: 1.25rem 0.75rem;
    }

    .completion-emoji {
        font-size: 1.5rem;
    }

    .completion-title {
        font-size: 1.5rem;
    }

    .completion-header {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .completion-score-value {
        font-size: 1.75rem;
    }

    .completion-details {
        font-size: 0.95rem;
        gap: 0.65rem;
    }

    .completion-ranks {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .completion-title {
        font-size: 1.1rem;
    }

    .completion-emoji {
        font-size: 1.3rem;
    }
}

/* Retry button section */
.incomplete-retry-section {
    border-top: 1px solid var(--clr-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.inline-retry-btn {
    align-items: center;
    background: var(--clr-accent);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
    cursor: pointer;
    display: inline-flex;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    width: 100%;
}

.inline-retry-btn:hover {
    background: var(--clr-accent-hover);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.inline-retry-btn:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.incomplete-final {
    padding: 0.5rem;
}

.no-retries {
    color: var(--clr-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Message container styling for incomplete state */
.message.incomplete {
    background: var(--clr-surface);
    border-color: var(--clr-accent);
}

/* Animation */
.incomplete-message {
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .incomplete-message {
        padding: 1.25rem 0.75rem;
    }

    .incomplete-title {
        font-size: 1.1rem;
    }

    .incomplete-emoji {
        font-size: 1.3rem;
    }

    .incomplete-accuracy {
        font-size: 1rem;
    }
}

/* SHARE BUTTON STYLES FOR COMPLETION MESSAGE */

.completion-share-prompt {
    border-top: 1px solid var(--clr-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.share-prompt-btn {
    align-items: center;
    background: var(--clr-accent);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
    cursor: pointer;
    display: inline-flex;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
}

.share-prompt-btn:hover {
    background: var(--clr-accent-hover);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.share-prompt-btn:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.share-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.share-text {
    line-height: 1;
}

.share-icons-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.share-icons-row a {
    align-items: center;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    margin: 0 15px 0 0;
    width: 45px;
}

/* Animation for the share button appearing */
.completion-share-prompt {
    animation: slideUp 0.4s ease 0.3s both;
}

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

/* Success state for share button */
.share-prompt-btn.copied {
    background: var(--clr-good);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .share-prompt-btn {
        font-size: 0.95rem;
        padding: 0.65rem 1.25rem;
    }

    .completion-share-prompt {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }
}

/* INTEGRATED SHARE PANEL STYLES */
/* Add this to your existing CSS */

.completion-share-section {
    border-top: 1px solid var(--clr-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.share-toggle-btn {
    align-items: center;
    background: var(--clr-accent);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.share-toggle-btn:hover {
    background: var(--clr-accent-hover);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.share-toggle-btn:active {
    transform: translateY(0);
}

.share-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.share-text {
    flex: 1;
    text-align: center;
}

.share-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.share-options-panel {
    animation: slideDown 0.3s ease;
    margin-top: 0.75rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.share-options-content {
    background: var(--clr-surface-light);
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    padding: 1rem;
}

.share-instructions {
    color: var(--clr-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 0.75rem 0;
    text-align: center;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-link {
    align-items: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.65rem 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
}

.share-x {
    background: #000000;
    color: white;
}

.share-x:hover {
    background: #333333;
    transform: translateY(-2px);
}

.share-fb {
    background: #1877f2;
    color: white;
}

.share-fb:hover {
    background: #166fe5;
    transform: translateY(-2px);
}

.share-native {
    background: var(--clr-accent);
    border: 2px solid var(--clr-accent);
    border-radius: 999px;
    color: var(--clr-accent);
    transition: all 0.2s ease;
}

.share-native:hover {
    background: #6AA0B6FF;
    border: 2px solid #6AA0B6FF;
    color: #fff;
    transform: translateY(-2px);
}

.share-panel-status {
    color: var(--clr-text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.share-panel-status.show {
    opacity: 1;
}

.share-panel-status.error {
    color: var(--clr-bad, #d9534f);
}

.leaderboard-pending-note {
    color: var(--clr-note);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

.result-pending-note {
    color: var(--clr-note);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

.completion-note {
    color: var(--clr-text-muted);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    text-align: center;
}

.share-toast {
    background: rgba(5, 8, 22, 0.9);
    border-radius: 999px;
    color: #fff;
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
    position: fixed;
    right: 0.85rem;
    top: calc(4.25rem + env(safe-area-inset-top, 0px));
    transform: translateY(-10px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

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

.share-toast.error {
    background: rgba(217, 83, 79, 0.95);
}

@media (max-width: 640px) {
    .share-toast {
        top: calc(3.5rem + env(safe-area-inset-top, 0px));
        right: 0.5rem;
    }
}

/* Animation for the share section appearing */
.completion-share-section {
    animation: slideUp 0.4s ease 0.3s both;
}

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

/* Mobile responsive */
@media (max-width: 640px) {
    .share-toggle-btn {
        font-size: 0.95rem;
        padding: 0.65rem 1rem;
    }

    .completion-share-section {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .share-options-content {
        padding: 0.75rem;
    }

    .share-link {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }
}

/* Desktop: show buttons side by side if there's room */
@media (min-width: 500px) {
    .share-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .share-link {
        flex: 1;
        min-width: 150px;
    }
}


.incomplete-message {
    padding: 1.5rem 1rem;
    text-align: center;
}

.incomplete-header {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.incomplete-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.incomplete-title {
    color: var(--clr-accent);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.incomplete-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.incomplete-accuracy {
    color: var(--clr-text);
    font-size: 1.1rem;
    font-weight: 600;
}

.incomplete-missed {
    color: var(--clr-bad);
    font-size: 0.95rem;
    font-weight: 500;
}

.incomplete-tip {
    color: var(--clr-text);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Retry button section */
.incomplete-retry-section {
    border-top: 1px solid var(--clr-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.inline-retry-btn {
    align-items: center;
    background: var(--clr-accent);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white;
    cursor: pointer;
    display: inline-flex;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    width: 100%;
}

.inline-retry-btn:hover {
    background: var(--clr-accent-hover);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.inline-retry-btn:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.incomplete-final {
    padding: 0.5rem;
}

.no-retries {
    color: var(--clr-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Message container styling for incomplete state */
.message.incomplete {
    background: var(--clr-surface);
    border-color: var(--clr-accent);
}

/* Animation */
.incomplete-message {
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .incomplete-message {
        padding: 1.25rem 0.75rem;
    }

    .incomplete-title {
        font-size: 1.1rem;
    }

    .incomplete-emoji {
        font-size: 1.3rem;
    }

    .incomplete-accuracy {
        font-size: 1rem;
    }
}

.lb-avatar {
    border-radius: 50%;
    flex-shrink: 0;
    height: 32px;
    object-fit: cover;
    width: 32px;
}


#leaderboardList {
    list-style: none;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

#leaderboardList::-webkit-scrollbar {
    width: 8px;
}

#leaderboardList::-webkit-scrollbar-track {
    background: var(--clr-surface-light);
    border-radius: 4px;
}

#leaderboardList::-webkit-scrollbar-thumb {
    background: var(--clr-border);
    border-radius: 4px;
}

#leaderboardList::-webkit-scrollbar-thumb:hover {
    background: var(--clr-text-muted);
}

#leaderboardList li {
    align-items: center;
    border-bottom: 1px solid var(--clr-border);
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    transition: background 0.2s ease;
}

#leaderboardList li:hover {
    background: var(--clr-surface-light);
}

/* Adjust existing leaderboard styles */
.lb-rank {
    color: var(--clr-accent);
    flex-shrink: 0;
    font-weight: 700;
    min-width: 2rem;
}

.lb-name {
    color: var(--clr-text);
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    color: var(--clr-accent);
    flex-shrink: 0;
    font-weight: 700;
    min-width: 4rem;
    text-align: right;
}

/* Current user highlight */
.lb-current {
    background: var(--clr-surface-light);
    border-left: 4px solid var(--clr-accent);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .lb-avatar {
        height: 28px;
        width: 28px;
    }

    #leaderboardList li {
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
    }

    .lb-rank {
        font-size: 0.9rem;
        min-width: 1.75rem;
    }

    .lb-name {
        font-size: 0.95rem;
    }

    .lb-score {
        font-size: 0.95rem;
        min-width: 3.5rem;
    }
}


.completion-ranks {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.completion-rank {
    color: var(--clr-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .completion-ranks {
        flex-direction: column;
        gap: 0.25rem;
    }
}

.feedback-section {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: 0.75rem;
    margin: 2rem auto;
    max-width: 500px;
    padding: 1.5rem;
}

.feedback-section h3 {
    color: var(--clr-accent);
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
}

/* Honeypot - completely hidden */
.honeypot {
    height: 1px;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.feedback-field {
    margin-bottom: 1rem;
    position: relative;
}

.feedback-field label {
    color: var(--clr-text);
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-field textarea {
    border: 2px solid var(--clr-border);
    border-radius: 0.5rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    min-height: 100px;
    padding: 0.75rem;
    resize: vertical;
    transition: border-color 0.2s;
    width: 100%;
}

.feedback-field textarea:focus {
    border-color: var(--clr-accent);
    outline: none;
}

.char-count {
    color: var(--clr-text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    text-align: right;
}

.feedback-submit-btn {
    background: var(--clr-accent);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s;
    width: 100%;
}

.feedback-submit-btn:hover:not(:disabled) {
    background: var(--clr-accent-hover);
    transform: translateY(-1px);
}

.feedback-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.feedback-status {
    border-radius: 0.5rem;
    display: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 0.75rem;
    text-align: center;
}

.feedback-status.success {
    background: rgba(2, 80, 72, 0.1);
    border: 1px solid var(--clr-good);
    color: var(--clr-good);
    display: block;
}

.feedback-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--clr-bad);
    color: var(--clr-bad);
    display: block;
}

#feedbackModal .modal-header {
    justify-content: flex-end;
    margin-bottom: 0;
}

.game-footer a {
    cursor: pointer;
}

@media (max-width: 640px) {
    .feedback-section {
        margin: 1rem;
        padding: 1rem;
    }
}
