:root {
    --primary: #f218e6;
    /* Neon Pink from OG Image */
    --primary-hover: #d915cc;
    --secondary: #6ed9ff;
    /* Electric Blue from Favicon */
    --secondary-hover: #5cc0e6;
    --bg-color: #fef7e0;
    /* Warm Cream from OG Image */
    --text-main: #2d3748;
    --text-muted: #718096;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(242, 24, 230, 0.08);
    /* Pink shadow */
    --pill-bg: #FFFFFF;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #fff0fb, transparent 40%),
        radial-gradient(circle at bottom left, #e8fbff, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

header {
    text-align: center;
    margin-top: 10px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-link {
    display: block;
    text-decoration: none;
}

.header-logo-img {
    height: 15rem;
    /* Adjusted for a full wordmark logo */
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(242, 24, 230, 0.3));
    /* Pink glow applied directly to image */
}

.glow-text {
    text-shadow: 0 0 10px rgba(242, 24, 230, 0.4);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 20px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.textarea-wrapper {
    display: flex;
    background: transparent;
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    height: 156px;
    /* Multiple of 26px line-height */
}

.line-numbers {
    padding: 1px 15px 0 5px;
    /* Top padding 1px to align with textarea */
    text-align: right;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    line-height: 26px;
    user-select: none;
    overflow-y: hidden;
    height: 100%;
    min-width: 45px;
    opacity: 0.6;
    font-weight: 800;
    border-right: 2px solid var(--glass-border);
    margin-right: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.line-numbers div {
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

textarea {
    flex: 1;
    height: 100%;
    /* Multiple of 26px line-height */
    border: none;
    background: transparent;
    resize: none;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 26px;
    padding-top: 1px;
    /* Align first line */
    white-space: pre;
    /* Ensure lines don't wrap and cause number desync */
    overflow-x: auto;
}

.lined-textarea {
    background-image: repeating-linear-gradient(transparent, transparent 25px, rgba(0, 0, 0, 0.1) 25px, rgba(0, 0, 0, 0.1) 26px);
    background-clip: content-box;
    background-origin: content-box;
}

.quick-add-panel {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-add-row {
    display: flex;
    gap: 8px;
}

.quick-item-input {
    flex: 1;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-main);
}

.quick-item-input:focus {
    outline: none;
    border-color: rgba(242, 24, 230, 0.35);
    box-shadow: 0 0 0 3px rgba(242, 24, 230, 0.1);
}

.quick-add-btn,
.quick-clear-btn {
    border: none;
    border-radius: 14px;
    padding: 0 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-add-btn {
    background: linear-gradient(135deg, var(--primary), #e000d0);
    color: #fff;
    box-shadow: 0 6px 14px rgba(242, 24, 230, 0.2);
    min-width: 46px;
    font-size: 1.4rem;
    line-height: 1;
}

.quick-clear-btn {
    background: linear-gradient(135deg, #ff5c5c, #dc2626);
    color: #fff;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.25);
}

.quick-add-btn:active,
.quick-clear-btn:active {
    transform: scale(0.96);
}

.quick-add-btn:disabled,
.quick-clear-btn:disabled,
.quick-item-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea:focus {
    outline: none;
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.magic-box-container {
    position: relative;
    height: 250px;
}

.magic-box {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 10px;
    padding: 20px;
}

.magic-box-empty-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
    transition: opacity 0.3s;
}

.pills-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.pill {
    background: var(--pill-bg);
    color: var(--primary);
    font-weight: 600;
    padding: 8px 10px 8px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(242, 24, 230, 0.3);
    animation: drop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: translateY(-50px);
    opacity: 0;
    font-size: 0.9rem;
    word-break: break-word;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pill-content {
    display: inline-block;
    cursor: text;
}

.pill-edit-input {
    border: 1px solid rgba(242, 24, 230, 0.45);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    padding: 4px 8px;
    min-width: 80px;
    max-width: 180px;
}

.pill-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(242, 24, 230, 0.12);
}

.pill-remove {
    border: none;
    background: rgba(242, 24, 230, 0.1);
    color: var(--primary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.pill-remove:hover {
    background: rgba(242, 24, 230, 0.2);
}

@keyframes drop-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pill.highlight {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary);
    transform: scale(1.1);
    transition: all 0.1s;
    z-index: 10;
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.draw-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 15px 20px;
}

.draw-controls-top {
    margin-bottom: 6px;
}

.draw-count-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.draw-controls label {
    font-weight: 600;
    color: var(--text-main);
}

.draw-count-value {
    min-width: 36px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
}

.draw-count-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    cursor: pointer;
}

.draw-count-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #e000d0);
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(242, 24, 230, 0.25);
}

.draw-count-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), #e000d0);
    box-shadow: 0 4px 10px rgba(242, 24, 230, 0.25);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #e000d0);
    color: white;
    border: none;
    padding: 20px 0;
    width: 100%;
    border-radius: 100px;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(242, 24, 230, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.primary-btn:active,
.primary-btn.active {
    transform: scale(0.96);
    box-shadow: 0 5px 10px rgba(242, 24, 230, 0.2);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: var(--secondary);
    color: white;
    /* Changed specifically for electric blue which might need dark text or white */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: none;
    padding: 15px 30px;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(110, 217, 255, 0.4);
    transition: transform 0.2s;
}

.cookie-accept-btn-compact {
    padding: 5px 15px;
    font-size: 0.9rem;
}

.mb-0 {
    margin-bottom: 0;
}

.secondary-btn:active {
    transform: scale(0.96);
}

.pulse-animation {
    animation: pulse 2s infinite;
}

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

    50% {
        transform: scale(1.02);
    }

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

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.buy-coffee-link {
    background: #FFDD00;
    color: #4a4a4a;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(255, 221, 0, 0.3);
}

.top-nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
    margin-bottom: -10px;
    padding: 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
    display: none;
}

.nav-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: min-content;
}

.about-badge {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    z-index: 50;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.about-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 24, 230, 0.15);
}


.about-badge .badge-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.about-badge .badge-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.88rem;
    white-space: nowrap;
}

.history-badge {
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.2), rgba(255, 255, 255, 0.75));
}

@media (max-width: 460px) {
    .about-badge .badge-text {
        display: none;
    }

    .about-badge {
        padding: 7px 10px;
    }
}

.lang-selector-floating {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 80;
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.lang-selector-floating a {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: transform 0.2s, filter 0.2s;
    filter: grayscale(40%);
}

.lang-selector-floating img {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lang-selector-floating a:hover {
    transform: scale(1.2);
    filter: grayscale(0%);
}

@media (max-width: 900px) {
    .lang-selector-floating {
        position: static;
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        margin: 10px auto 0;
        width: fit-content;
        padding: 8px 12px;
    }
}

/* Overlays */
.hidden {
    display: none !important;
}

.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 101;
}

.result-card {
    background: var(--glass-bg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 40px 20px;
    z-index: 102;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.winner-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.winner-name-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    max-height: 50vh;
    overflow-y: auto;
}

.winner-item {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--primary);
    word-break: break-all;
    line-height: 1.2;
    animation: winner-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes winner-pop {
    0% {
        transform: scale(0) translateY(50px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.share-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.share-channel-btn {
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-main);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 88px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.share-channel-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.share-channel-btn:active {
    transform: scale(0.96);
}

.share-channel-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.share-channel-label {
    line-height: 1;
    white-space: nowrap;
}

.pop-in {
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

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

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both infinite;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Countdown Overlay */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
}

.countdown-text {
    font-family: 'Outfit', sans-serif;
    font-size: 8rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: count-pop 1s infinite;
}

@keyframes count-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    30% {
        transform: scale(1.2);
        opacity: 1;
    }

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

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
}

.cookie-banner p {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-right: 15px;
    flex: 1;
}

@media (max-width: 600px) {
    .quick-add-row {
        flex-wrap: wrap;
    }

    .quick-item-input {
        min-width: 100%;
    }

    .quick-add-btn,
    .quick-clear-btn {
        padding: 10px 14px;
    }

    .cookie-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        bottom: 10px;
        left: 10px;
        right: 10px;
    }

    .cookie-banner p {
        margin-right: 0;
    }
}

/* =============================
   POST / ARTICLE PAGE
   ============================= */

.post-article {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 40px;
    margin-top: 20px;
    text-align: left;
    line-height: 1.8;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.post-h1 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    margin-bottom: 10px;
    margin-top: 0;
    text-align: center;
}

.post-subtitle {
    text-align: center;
    opacity: 0.7;
    font-size: 0.97rem;
    margin-bottom: 28px;
}

.post-intro {
    font-size: 1.05rem;
    margin-bottom: 28px;
    color: var(--text);
    border-left: 3px solid var(--primary);
    padding-left: 16px;
    opacity: 0.9;
}

.post-body h2 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    margin-top: 36px;
    margin-bottom: 12px;
}

.post-body p {
    margin-bottom: 16px;
    color: var(--text);
}

.post-body strong {
    color: var(--primary);
}

.post-body em {
    opacity: 0.85;
    font-style: italic;
}

.post-cta {
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.12), rgba(255, 100, 100, 0.08));
    border: 1px solid rgba(255, 200, 0, 0.2);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    margin-top: 40px;
}

.post-cta p {
    margin-bottom: 16px;
    font-size: 1.05rem;
    color: var(--text);
}

.post-cta-btn {
    display: inline-block;
    background: var(--primary);
    color: #000;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    padding: 12px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 200, 0, 0.4);
}

.post-back-link {
    display: inline-block;
    margin-top: 30px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
}

.post-back-link:hover {
    text-decoration: underline;
}

/* =============================
   POST READ TAG (on about + home)
   ============================= */

.post-read-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    background: rgba(255, 200, 0, 0.1);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: 50px;
    padding: 4px 13px;
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.post-read-tag:hover {
    background: rgba(255, 200, 0, 0.22);
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 480px) {
    .post-article {
        padding: 24px 18px;
    }

    .post-h1 {
        font-size: 1.5rem;
    }
}

/* =============================
   LADDER GAME — Setup Panel
   ============================= */

.ladder-setup {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.ladder-hero {
    text-align: center;
}

.ladder-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 6px;
}

.ladder-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Player count controls */
.ladder-count-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.55);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 18px;
}

.ladder-count-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.ladder-count-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.count-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(242,24,230,0.35);
    background: white;
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}

.count-btn:hover:not(:disabled) {
    background: rgba(242,24,230,0.08);
}

.count-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.count-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.count-display {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    min-width: 36px;
    text-align: center;
}

/* Input sections */
.ladder-inputs-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ladder-section-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    margin: 0;
    letter-spacing: 0.01em;
}

.ladder-names-grid,
.ladder-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.ladder-input {
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    background: rgba(255,255,255,0.9);
    color: var(--text-main);
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.ladder-input:focus {
    outline: none;
    border-color: rgba(242,24,230,0.4);
    box-shadow: 0 0 0 3px rgba(242,24,230,0.1);
}

.ladder-result-inp {
    border-color: rgba(110,217,255,0.4);
}

.ladder-result-inp:focus {
    border-color: rgba(110,217,255,0.7);
    box-shadow: 0 0 0 3px rgba(110,217,255,0.12);
}

/* =============================
   LADDER GAME — Canvas Section
   ============================= */

.ladder-canvas-section {
    padding: 0;
    overflow: hidden;
}

.ladder-labels-row {
    display: flex;
    position: relative;
    height: 46px;
    width: 100%;
}

.ladder-bottom-row {
    height: 46px;
}

.ladder-col-label {
    position: absolute;
    transform: translateX(-50%);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    text-align: center;
    border-radius: 10px;
    padding: 5px 8px;
}

.ladder-name-label {
    top: 6px;
    background: rgba(255,255,255,0.92);
    border: 2px solid var(--primary);
    color: var(--text-main);
}

.ladder-result-label {
    bottom: 6px;
    background: rgba(255,255,255,0.92);
    border: 2px solid var(--secondary);
    color: var(--text-main);
}

.ladder-canvas-wrapper {
    width: 100%;
    line-height: 0;
}

#ladder-canvas {
    display: block;
    width: 100%;
}

/* Result label states */
.result-hidden {
    opacity: 0;
    transform: translateX(-50%) scale(0.6);
    transition: none;
}

.result-visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* =============================
   LADDER GAME — Summary / Share Image
   ============================= */

.ladder-result-card {
    max-width: 560px;
    width: 100%;
    padding: 28px 20px 24px;
    max-height: 92vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.ladder-summary-wrapper {
    position: relative;
    margin: 16px 0 14px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(242, 24, 230, 0.12);
    border: 1.5px solid rgba(242, 24, 230, 0.18);
    line-height: 0;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ladder-summary-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(242, 24, 230, 0.18);
}

.ladder-summary-wrapper:active {
    transform: scale(0.98);
}

#ladder-summary-canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* Download hint overlay */
.ladder-canvas-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(242,24,230,0.15));
    color: rgba(242, 24, 230, 0.85);
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    padding: 14px 0 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.ladder-summary-wrapper:hover .ladder-canvas-hint {
    opacity: 1;
}

/* =============================
   LADDER GAME — Result Items
   ============================= */

.ladder-results-list {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    max-height: 55vh;
    overflow-y: auto;
}

.ladder-match-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    padding: 12px 18px;
    border-radius: 14px;
    border: 2px solid var(--primary);
    background: rgba(255,255,255,0.92);
    animation: winner-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.ladder-match-player {
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    flex: 1;
    text-align: right;
}

.ladder-match-arrow {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ladder-match-prize {
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    flex: 1;
    text-align: left;
}

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

    .ladder-names-grid,
    .ladder-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .ladder-col-label {
        font-size: 0.72rem;
        max-width: 75px;
        padding: 4px 6px;
    }

    .ladder-match-item {
        font-size: 0.95rem;
        padding: 10px 12px;
    }
}

/* ── PWA Standalone Mode — AdSense & Safe Area Compliance ────────────────────
 *
 * Google AdSense policy: ads must never cover interactive UI elements.
 * When the app runs as a TWA or PWA (display:standalone), there is no
 * browser chrome, so banner ads rendered near the bottom can overlap
 * fixed-position buttons (draw button, play-again, share).
 *
 * This block applies ONLY in standalone mode (browser/desktop is unaffected):
 *   [✓] Extra bottom padding keeps ad units above critical action buttons
 *   [✓] env(safe-area-inset-bottom) respects iPhone notch / home indicator
 *   [✓] .action-section margin ensures the draw button is always tappable
 *   [✓] .result-overlay padding prevents winner card from hiding behind ads
 *
 * TWA Play Store checklist:
 *   [✓] No ad within 32dp of interactive controls (AdSense policy §4)
 *   [✓] Home indicator area is clear on notched Android devices
 * ─────────────────────────────────────────────────────────────────────────── */
@media all and (display-mode: standalone) {
    body {
        /* Respect the device's safe area (notch, home indicator) */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .app-container {
        /* Extra room so banner ads don't overlap footer / action buttons */
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }

    .action-section {
        /* Push the main CTA button up above any bottom ad */
        margin-bottom: 24px;
    }

    .result-overlay {
        /* Ensure winner result card clears the bottom ad zone */
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }

    /* Footer inside standalone — give it breathing room above system UI */
    footer {
        margin-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}