
        :root {
            --bg: #f5f5f5;
            --panel-bg: #ffffff;
            --text: #333;
            --muted: #999;
            --accent: #cc9c00;
            --muted-border: #ddd;
        }

        .theme-dark {
            --bg: #0f1720;
            --panel-bg: #0b1220;
            --text: #e6eef8;
            --muted: #93a3bf;
            --accent: #cc9c00;
            --muted-border: #1e293b;
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg);
            color: var(--text);
            padding: 20px;
            min-height: 100vh;
            transition: background .18s, color .18s;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        header.app-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        h1 {
            font-size: 24px;
            color: var(--text);
        }

        h1 svg {
            color: var(--accent);
        }

        .tabs {
            display: flex;
            gap: 10px;
            margin-left: 10px;
        }

        .tab-btn {
            margin-bottom: -1px;
            padding: 8px 16px;
            border: 1px solid;
            border-color: var(--muted-border);
            background: var(--bg);
            color: var(--text);
            cursor: pointer;
            border-radius: 6px 6px 0 0;
            transition: background .18s, border-color .18s, color .18s;
        }

        .tab-btn.active {
            background: var(--panel-bg);
            color: var(--accent);
            border-bottom: 1px solid var(--panel-bg);
            z-index: 1;
        }

        .panel {
            padding: 30px;
            background: var(--panel-bg);
            border-radius: 6px;
            border: 1px solid var(--muted-border);
            box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
            transition: background .18s, border-color .18s;
            display: none;
            z-index: 0;
        }

        .panel.active {
            display: block;
        }

        h2 {
            font-size: 18px;
            font-weight: normal;
            margin-bottom: 15px;
            color: var(--text);
        }
        .app-header h2 {
            margin-bottom: 2px;
            margin-left: 20px;
            font-size: 1rem;
            color: var(--muted);
        }

        .notes, .input-area {
            font-size: 15px;
            font-weight: normal;
            line-height: 1.4;
            color: var(--muted);
        }

        .input-area p {
            bottom: 0;
        }

        .input-area a, .notes a {
            color: var(--muted);
            display: flex;
            flex-direction: row;
            align-items: center;
            text-decoration: none;
            gap: .2rem;
        }
        .input-area a:hover, .notes a:hover {
            color: var(--accent);
        }

        .win-save-btn {
            font-family: inherit;
            font-size: 15px;
            background: var(--accent);
            color: #fff;
            padding: 0.5em 1em 0.5em 0.9em;
            display: inline-flex;
            align-items: center;
            gap: 0.3em;
            border: none;
            border-radius: 16px;
            overflow: hidden;
            transition: all 0.2s;
            cursor: pointer;
            text-decoration: none;
        }
        .win-save-btn .svg-wrapper {
            display: flex;
            align-items: center;
        }
        .win-save-btn span {
            display: block;
            transition: all 0.3s ease-in-out;
        }
        .win-save-btn svg {
            display: block;
            transform-origin: center center;
            transition: transform 0.3s ease-in-out;
        }
        .win-save-btn:hover .svg-wrapper {
            animation: wsb-fly 0.6s ease-in-out infinite alternate;
        }
        .win-save-btn:hover svg {
            transform: translateX(1.5em) scale(1.1);
        }
        .win-save-btn:hover span {
            transform: translateX(5em);
        }
        .win-save-btn:active {
            transform: scale(0.95);
        }
        @keyframes wsb-fly {
            from { transform: translateY(0.1em); }
            to   { transform: translateY(-0.1em); }
        }

        .notes ul {
            margin-bottom: 15px;
            padding-left: 15px;
        }

        .notes ul li {
        margin-bottom: 3px;
        font-size: 12px;
        }

        .input-area, .notes {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            height: 100%;
        }

        #winInput {
            width: 100%;
            padding: 12px;
            font-size: 16px;
            border: 2px solid var(--muted-border);
            border-radius: 4px;
            font-family: inherit;
            resize: vertical;
            min-height: 130px;
            background: transparent;
            color: var(--text);
        }

        #winInput:focus {
            outline: none;
            border-color: var(--muted);
        }

        #winInput::placeholder {
            color: var(--muted);
            opacity: 1;
        }

        .help-text {
            font-size: 14px;
            color: var(--muted);
            margin-top: 8px;
        }

        .help-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 6px 0 2rem 0;
        }

        .help-row-actions {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .mic-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 46px;
            height: 46px;
            border: none;
            border-radius: 4px;
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            transition: color 0.15s;
        }

        .mic-btn:hover {
            color: var(--accent);
            border: 0;
            outline: none;
        }

        .mic-btn.listening {
            color: #e05555;
            animation: mic-pulse 1.2s ease-in-out infinite;
        }

        @keyframes mic-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.55; }
        }

        .save-confirmation {
            font-size: 13px;
            color: var(--accent);
            margin-top: 6px;
            opacity: 0;
            transition: opacity 0.2s;
        }
        .save-confirmation.show {
            opacity: 1;
        }


        .admin-panel {
            display: flex;
            gap:2em;
            flex-wrap: none;
            justify-content: space-around;
        }

        .admin-panel > *:first-child {
            flex: 3;
            min-width: 0;
        }

        .admin-panel > *:last-child {
            flex: 2;
            min-width: 0;
        }

        .backup-controls {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            flex-wrap: wrap;
        }

        button {
            padding: 10px 14px;
            font-size: 13px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-family: inherit;
            background: none;
            transition: background .18s, transform .08s;
            display: inline-flex;
            align-items: center;
            border: 1px solid var(--muted);
            color: var(--text);
            gap: 8px;
        }

        button:active {
            transform: translateY(1px);
        }



        button:hover:not(.modal-close):not(.refresh-btn):not(.mic-btn) {
            border: 1px solid var(--accent);
        }

        #fileInput {
            display: none;
        }

        .random-win {
            position: relative;
            overflow: hidden;
            background: var(--card-bg);
            padding: 3rem 2rem 4rem 2rem;
            margin-bottom: 20px;
            min-height: 100px;
            display: flex;
            align-items: center;
            justify-content: start;
            position: relative;
            border: 5px solid var(--accent);
            /* border-radius: 18px; */
            /* border-image-slice: 1; */
            /* border-image-source: linear-gradient(-25deg, #eeda97, var(--accent)); */
        }


        .star {
            position: absolute;
            background: gold;
            clip-path: polygon(
                50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
                50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%
            );
            pointer-events: none;
            opacity: 1;
            transform: translate(0,0) scale(1);
            animation: starburst 0.8s forwards;
            }

        @keyframes starburst {
        to {
            transform: translate(var(--x), var(--y)) scale(0);
            opacity: 0;
        }
        }

        .random-win-text {
            font-size: 30px;
            color: var(--text);
            line-height: 1.3;
            text-align: left;
        }
        .random-win .win-date {
            font-size: 1rem;
            margin: 0 0 1rem 0;
        }
        .random-win-comment {
            position: absolute;
            bottom: 0;
            left: 0;
            background: var(--accent);
            color: var(--bg);
            font-size: 0.8rem;
            font-style: italic;
            padding: 0.4rem 0.75rem 0.3rem 0.5rem;
            border-radius: 0 0 0 0;
        }

        .random-win-empty {
            color: var(--muted);
            font-style: italic;
        }

        .refresh-btn {
            background: none;
            color: var(--muted);
            border: none;
            padding: 8px;
            cursor: pointer;
            position: absolute;
            top: 12px;
            right: 12px;
            font-size: 18px;
            line-height: 1;
            transition: color .12s;
        }

        .refresh-btn:hover {
            color: var(--accent);
        }

        .refresh-tooltip {
            position: absolute;
            top: 18px;
            right: 55px;
            background: var(--accent);
            color: #fff;
            font-size: 13px;
            font-weight: 500;
            padding: 6px 10px;
            border-radius: 6px;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 8px;
            z-index: 10;
            animation: tooltipFloat 2.4s ease-in-out infinite;
            pointer-events: auto;
        }

        .refresh-tooltip::after {
            content: '';
            position: absolute;
            right: -7px;
            top: 50%;
            transform: translateY(-50%);
            border: 7px solid transparent;
            border-left-color: var(--accent);
            border-right: none;
        }

        .refresh-tooltip-close {
            background: none;
            border: none;
            color: rgba(255,255,255,0.75);
            cursor: pointer;
            font-size: 14px;
            line-height: 1;
            padding: 0;
            margin-left: 2px;
            transition: color .12s;
        }

        .refresh-tooltip-close:hover {
            color: #fff;
        }

        @keyframes tooltipFloat {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-3px); }
        }

        .archive {}

        .win-item {
            padding: 15px 0;
            border-bottom: 1px solid var(--muted-border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background .18s;
        }

        .win-item:last-child {
            border-bottom: none;
        }

        .win-text {
            color: var(--text);
            line-height: 1.4;
            word-break: break-word;
            flex: 1;
        }

        .win-date {
            font-size: 12px;
            color: var(--muted);
            white-space: nowrap;
        }

        .win-actions {
            display: flex;
            gap: 6px;
            margin-left: 10px;
        }

        .win-actions button {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--muted);
            padding: 4px;
            font-size: 16px;
            transition: color .15s;
        }

        .win-actions button:hover {
            color: var(--accent);
        }

        .load-more-btn {
            margin: 15px 0 0 0;
            display: inline-flex;
            align-items: center;
            padding: 10px 14px;
            border-radius: 6px;
            background: none;
            color: var(--text);
            border: 2px solid var(--muted-border);
            cursor: pointer;
            font-family: inherit;
            transition: background .18s, color .18s, border-color .18s;
        }

        .load-more-btn:hover {
            color: var(--text);
            border-color: var(--accent);
        }

        .theme-toggle {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            border: none;
            display: inline-grid;
            place-items: center;
            background: transparent;
            color: var(--text);
            cursor: pointer;
        }
        .theme-toggle svg {
            display: block;
            width: 16px;
            height: 16px;
            transform: translateX(-2px);
        }
        .theme-toggle:hover,
        .theme-toggle:focus {
            color: var(--accent);
            outline: none;
            border: none;
        }


        #monthFilter {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            color: var(--text);
            background: var(--panel-bg) no-repeat right 10px center;
            padding: 7px 30px 7px 10px;
            border: 2px solid var(--muted-border);
            border-radius: 4px;
            font-family: inherit;
            font-size: 14px;
            cursor: pointer;
        }

        #monthFilter:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: none;
        }


        body.theme-dark #monthFilter {
            color: var(--text);
            background: var(--panel-bg);
            border-color: var(--muted-border);
        }

        .message {
            display: flex;
            line-height: 1.4;
            justify-content: space-between;
            align-items: start;
            flex-direction: row;
            background: var(--panel-bg);
            border: 2px dashed var(--accent);
            padding: 1rem;
            margin: 1rem 0;
            gap: 10px;
        }

        .message a {
            text-decoration: none;
            color: var(--muted);
        }
        .message a:hover {
            color: var(--accent);
        }

        .hideMessageBtn {
            background: none;
            border: none;
            font-size: 1.2rem;
            cursor: pointer;
            max-height: 18px;
            padding: 0 0 0 10px;
            color: var(--muted);
        }
        .hideMessageBtn:hover {
            color: var(--accent);
        }


        .filter-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            gap: 10px;
        }

        .add-btn {
            background: none;
            color: var(--text);
            border: 2px solid var(--muted-border);
            border-radius: 4px;
            padding: 6px 14px;
            font-size: 14px;
            cursor: pointer;
            transition: background .18s, transform .1s;
        }

        .add-btn:hover {
            border-color: var(--accent);
        }

        .add-btn:active {
            transform: translateY(1px);
        }

        details {
            cursor:pointer;
            font-size:12px;
            line-height: 1.4;
            border-top: 1px solid var(--muted-border);
            padding-top: 1rem;
            margin: 1rem 0;
            max-width: 80%;
        }

        details summary {
            cursor:pointer;
            font-size:14px;
            color:var(--muted);
            margin-bottom:15px;
        }

        .form-container {
            margin: 1px !important;
        }
        footer {
            font-size: 12px;
            color: var(--muted);
            margin-top: 1rem;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .local-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 8px;
            border-radius: 4px;
            border: 1px solid var(--muted-border);
            color: var(--muted);
            font-size: 0.65rem;
            font-family: inherit;
            user-select: none;
            white-space: nowrap;
        }

        footer a {
            text-decoration: none;
            color: inherit;
        }
        footer a:hover {
            color: var(--text);
            text-decoration: none;
        }
        .branding {
            display: flex;
            align-items: end;
        }

        .modal {
            display: none;
            position: fixed;
            top:0; left:0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.5);
            justify-content: center;
            align-items: center;
            z-index: 9999;
            }
        .modal-close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text);
            padding: 0;
            width: 30px;
            height: 30px;
            line-height: 1;
        }

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

        .modal-content {
            color: var(--text);
            position: relative;
            background: var(--panel-bg);
            padding: 2rem;
            border-radius: 0.5rem;
            max-width: 400px;
            width: 90%;
            text-align: center;
            z-index: 10000;
            }

        .modal h2 {
            font-size: 1.2rem;
            color: var(--text);
        }


        .modal p {
            font-size: .9rem;
        }


        .card-content {
            font-size: 18px;
            color: var(--text);
            font-weight: 500;
        }


        /* Roundup emails signup */
        .email-signup-section {
            border-top: 1px solid var(--muted-border);
            padding-top: 1rem;
            max-width: 90%;
            margin: 2rem 0;
        }


        .email-signup-section h3 {
            margin: 0 0 8px 0;
            font-size: 1rem;
            font-weight: 500;
        }
        .email-signup-section h3 span, .modal h2 span {
            color: var(--accent);
        }

        .email-signup-section p {
            margin: 0 0 16px 0;
            font-size: .8rem;
            color: var(--text-secondary);
        }

        #emailSignupForm, .subscribe-form {
            display: flex;
            gap: 8px;
        }

        #emailInput, #emailModalInput {
            flex: 1;
            padding: 10px 12px;
            border: 2px solid var(--muted-border);
            border-radius: 6px;
            background: var(--bg);
            color: var(--text);
            font-size: .8rem;
        }

        #emailInput::placeholder, #emailModalInput::placeholder {
            color: var(--muted);
        }

        #emailSubmitBtn, #emailModalSubmitBtn {
            padding: 10px 16px;
            border: 1px solid var(--accent);
            background: transparent;
            color: var(--accent);
            border-radius: 6px;
            font-size: .8rem;
            cursor: pointer;
            white-space: nowrap;
        }

        #emailSubmitBtn:hover, #emailModalSubmitBtn:hover {
            background: rgba(204,156,0,.08);
        }

        #emailSubmitBtn:disabled, #emailModalSubmitBtn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .email-status {
            margin-top: 12px;
            font-size: 14px;
        }

        /* ── Auth / sync row ── */
        .auth-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            min-height: 36px;
            margin-bottom: 12px;
        }

        .sync-status {
            font-size: 12px;
            color: var(--muted);
            opacity: 0;
            transition: opacity 0.4s;
        }

        .sync-status.visible {
            opacity: 1;
        }

        .auth-bar {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 8px;
            font-size: 13px;
        }

        .auth-form {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .auth-form label {
            font-size: 13px;
            color: var(--muted);
            font-family: inherit;
        }
        .auth-form label span {
            color: var(--text);
        }

        .auth-input {
            padding: 6px 10px;
            font-size: 13px;
            border: 1px solid var(--muted-border);
            border-radius: 6px;
            background: var(--bg);
            color: var(--text);
            font-family: inherit;
            width: 200px;
        }

        .auth-input:focus {
            outline: none;
            border-color: var(--muted);
        }

        .auth-input::placeholder {
            color: var(--muted);
        }

        .auth-submit-btn {
            padding: 6px 12px;
            font-size: 13px;
            border: 1px solid var(--muted-border);
            border-radius: 6px;
            background: none;
            color: var(--text);
            cursor: pointer;
            font-family: inherit;
            white-space: nowrap;
        }

        .auth-submit-btn:hover {
            border-color: var(--accent);
        }

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

        .auth-msg {
            color: var(--accent);
        }

        .auth-email {
            color: var(--muted);
        }

        .auth-sep {
            color: var(--muted-border);
        }

        .auth-link {
            background: none;
            border: none;
            padding: 0;
            font-size: 13px;
            color: var(--muted);
            cursor: pointer;
            font-family: inherit;
            text-decoration: underline;
            text-underline-offset: 2px;
        }

        .auth-link:hover {
            color: var(--text);
            border: none;
        }

        .auth-error {
            font-size: 12px;
            color: #cc4444;
            width: 100%;
            text-align: right;
        }

        /* ── Auth row right side ── */
        .auth-row-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* ── Pro badge ── */
        .pro-badge {
            font-size: 11px;
            font-weight: 600;
            color: var(--accent);
            padding: 2px 8px;
            border: 1px solid rgba(204, 156, 0, 0.4);
            border-radius: 4px;
            background: rgba(204, 156, 0, 0.08);
            white-space: nowrap;
        }

        /* ── Upgrade panel ── */
        .upgrade-panel {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 20px;
            background: rgba(204, 156, 0, 0.07);
            border: 1px solid rgba(204, 156, 0, 0.22);
            border-radius: 10px;
            padding: 8px 20px;
            margin-bottom: 22px;
            flex-wrap: wrap;
        }

        .upgrade-panel-left {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 15px;
            flex: 1;
        }

        .upgrade-panel-title {
            font-weight: 600;
            font-size: 14px;
            color: var(--text);
        }

        .upgrade-panel-features {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .upgrade-panel-features li {
            padding: 10px;
            display: inline;
            font-size: 12px;
            color: var(--accent);
            line-height: 1.7;
            margin: 10px;
        }
        .upgrade-panel-features li svg {
            padding-top: 4px;
        }

        .upgrade-panel-right {
            display: flex;
            justify-content: space-between;
            flex-direction: row;
            align-items: center;
            gap: 27px;
            flex-shrink: 0;
            min-width: 25%;
        }

        .upgrade-cta-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 18px;
            background: var(--accent);
            color: #fff;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
            white-space: nowrap;
            transition: opacity .15s;
        }

        .upgrade-cta-btn:hover {
            opacity: .88;
        }

        .redeem-link {
            background: none !important;
            border: none !important;
            padding: 0 !important;
            font-size: 12px;
            color: var(--muted);
            cursor: pointer;
            font-family: inherit;
            text-decoration: none;
            box-shadow: none;
        }

        .redeem-link:hover {
            color: var(--accent);
            background: none !important;
            border: none !important;
        }

        /* ── Key input row (inside modal) ── */
        .key-input-row {
            display: flex;
            gap: 8px;
            margin-top: 4px;
        }

        @media(max-width:768px) {
            .branding {
            flex-direction: column;
            align-items: start;
            }
            .panel {
                padding: 10px;
            }
            .admin-panel {
                flex-direction: column;
            }

            .archive .win-item {
                text-align: left;
                align-items: flex-start;
                flex-direction: column;
            }

            .win-actions {
                margin-top: .5rem;
            }

            .win-actions button svg {
                width: 18px;
                height: 18px;
            }

            .win-date {
                margin-top: .5rem;
                font-size: 12px;
            }
        }
