:root {
            --bg-main: #06080e;
            --bg-card: rgba(15, 20, 35, 0.7);
            --neon-pink: #d900ff;
            --text-main: #ffffff;
            --text-muted: #8899aa;
            --border-color: rgba(255, 255, 255, 0.15);
            --danger: #ff2222;
            --danger-hover: #ff5555;
            --accent-yellow: #ffde00;
            --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        }

        * {
            box-sizing: border-box;
            font-family: 'Prompt', sans-serif;
        }

        body {
            position: relative;
            background-color: var(--bg-main);
            background-image: repeating-linear-gradient(
                0deg,
                transparent,
                transparent 2px,
                rgba(0, 0, 0, 0.6) 3px,
                rgba(0, 0, 0, 0.6) 4px
            );
            color: var(--text-main);
            padding: 30px 14px 40px;
            margin: 0;
            display: flex;
            justify-content: center;
            min-height: 100vh;
        }

        .app-container {
            position: relative;
            z-index: 1;
            width: 100%;
            max-width: 1180px;
            display: flex;
            flex-direction: column;
            border: 3px solid var(--neon-pink);
            border-radius: 12px;
            padding: 30px 20px;
            background: rgba(10, 14, 26, 0.85);
            box-shadow: 0 0 15px var(--neon-pink), inset 0 0 15px rgba(217, 0, 255, 0.3);
        }

        /* โลโก้ CSS 3D */
        .css-logo {
            text-align: center;
            margin: 0 auto 25px auto;
            font-style: italic;
            font-weight: 900;
            cursor: default;
            user-select: none;
            filter: drop-shadow(4px 4px 0px #000) drop-shadow(0px 0px 15px rgba(255, 102, 0, 0.7));
        }

        .css-logo-top {
            font-size: clamp(65px, 8vw, 90px);
            line-height: 0.9;
            letter-spacing: -2px;
            background: linear-gradient(180deg, #fff200 0%, #ff6600 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            -webkit-text-stroke: 2px #ffffff;
        }

        .css-logo-bottom {
            font-size: clamp(26px, 3.5vw, 36px);
            line-height: 1;
            letter-spacing: 8px;
            margin-top: -5px;
            margin-left: 10px;
            background: linear-gradient(180deg, #fff200 0%, #ff6600 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            -webkit-text-stroke: 1.5px #ffffff;
        }

        .input-section,
        .result-card,
        .static-item {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            box-shadow: var(--glass-shadow);
        }

        .input-section {
            position: relative;
            overflow: hidden;
            border-radius: 12px;
            padding: 15px 18px;
            margin-bottom: 20px;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        /* ปรับแต่งช่องกรอกตัวเลขให้อยู่กึ่งกลางแนวตั้งและแนวนอน */
        input[type="text"] {
            width: 100%;
            height: 60px;
            line-height: 56px;
            padding: 0;
            border: 2px solid #334466;
            border-radius: 8px;
            background: #000000;
            color: #00ffea;
            font-size: 28px;
            font-weight: 700;
            text-align: center;
            outline: none;
            transition: all 0.3s ease;
            letter-spacing: 5px;
            box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
        }

        input[type="text"]:focus {
            border-color: var(--accent-yellow);
            box-shadow: 0 0 15px rgba(255, 222, 0, 0.4);
            background: #111;
        }

        /* ปรับ Placeholder ให้อยู่กึ่งกลางแนวตั้งและแนวนอน */
        input[type="text"]::placeholder {
            color: #556677;
            font-size: 18px;
            font-weight: 400;
            letter-spacing: normal;
            line-height: 56px;
            text-align: center;
        }

        .action-buttons {
            display: flex;
            justify-content: center;
            margin-top: 10px;
        }

        .btn-reset {
            border-radius: 5px;
            padding: 8px 25px;
            font-size: 14px;
            font-weight: 700;
            background: #222;
            color: var(--danger);
            border: 2px solid var(--danger);
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: uppercase;
        }

        .btn-reset:hover {
            background: var(--danger);
            color: #fff;
            box-shadow: 0 0 10px var(--danger);
        }

        .results-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        .result-card {
            border-radius: 10px;
            padding: 12px 14px;
            display: flex;
            flex-direction: column;
            border: 1px solid #2a3449;
            transition: all 0.2s ease;
        }

        .result-card:hover {
            border-color: var(--neon-pink);
            box-shadow: 0 0 10px rgba(217, 0, 255, 0.2);
            transform: translateY(-2px);
        }

        .card-header {
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid #2a3449;
        }

        .card-title {
            font-size: 16px;
            font-weight: 600;
            margin: 0;
            color: #ffffff;
            text-align: center;
        }

        .output-area {
            flex-grow: 1;
            font-size: 14px;
            font-weight: 600;
            line-height: 1.6;
            color: #0fe150;
            letter-spacing: 1px;
            word-break: break-word;
            min-height: 55px;
            max-height: 85px;
            overflow-y: auto;
            text-align: center;
        }

        .output-area::-webkit-scrollbar { width: 4px; }
        .output-area::-webkit-scrollbar-thumb { background-color: #334466; border-radius: 4px; }

        .empty-text {
            color: #445566;
            font-style: italic;
            font-size: 13px;
        }

        .btn-copy, .btn-copy-clean {
            width: 100%;
            margin-top: 10px;
            padding: 8px;
            background: linear-gradient(180deg, #ffea00 0%, #ff8c00 100%);
            color: #000000;
            border: 2px solid #000000;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 800;
            cursor: pointer;
            box-shadow: 2px 2px 0px #000;
            transition: all 0.1s ease;
            text-shadow: 1px 1px 0px rgba(255,255,255,0.4);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .btn-copy:active, .btn-copy-clean:active {
            transform: translate(2px, 2px);
            box-shadow: 0px 0px 0px #000;
        }

        .static-section {
            border-top: 2px dashed #2a3449;
            margin-top: 30px;
            padding-top: 25px;
        }

        .static-header {
            text-align: center;
            font-size: 22px;
            font-weight: 700;
            color: var(--neon-pink);
            margin-bottom: 20px;
            text-shadow: 0 0 10px rgba(217, 0, 255, 0.4);
        }

        .static-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }

        .static-item {
            text-align: center;
            border-radius: 10px;
            padding: 16px;
            border: 1px solid #2a3449;
        }

        .static-title {
            font-size: 18px;
            font-weight: 700;
            margin: 0 0 10px 0;
            color: #ffde00;
        }

        .static-numbers {
            font-size: 15px;
            font-weight: 500;
            color: #00e5ff;
            line-height: 1.8;
            word-break: break-word;
            margin-bottom: 12px;
        }

        .static-item-scroll {
            display: flex;
            flex-direction: column;
            min-width: 0;
            min-height: 0;
        }

        .static-scroll-frame {
            position: relative;
            flex: 1;
            min-height: 0;
            margin-bottom: 12px;
        }

        .static-numbers-scroll {
            position: absolute;
            inset: 0;
            margin-bottom: 0;
            padding-right: 6px;
            overflow-y: auto;
            overscroll-behavior: contain;
            scrollbar-width: thin;
            scrollbar-color: #334466 transparent;
        }

        .static-numbers-scroll::-webkit-scrollbar { width: 6px; }
        .static-numbers-scroll::-webkit-scrollbar-thumb { background: #334466; border-radius: 4px; }

        .static-numbers-scroll:focus-visible {
            outline: 2px solid var(--accent-yellow);
            outline-offset: 2px;
        }

        .site-copyright {
            margin-top: 40px;
            padding-top: 15px;
            border-top: 1px solid #2a3449;
            color: #556677;
            text-align: center;
            font-size: 12px;
        }

        @media (max-width: 768px) {
            body { padding: 15px 10px 30px; }
            .app-container { border-width: 2px; padding: 20px 10px; }
            .results-grid { grid-template-columns: 1fr; gap: 10px; }
            .static-grid { grid-template-columns: 1fr; }
            .static-scroll-frame { min-height: 162px; }
            .css-logo-top { font-size: 70px; }
            .css-logo-bottom { font-size: 28px; }
        }

.calculation-status { margin: 0 0 12px; text-align: center; font-size: 13px; color: #ff8b8b; }
.btn-copy.copy-success, .btn-copy-clean.copy-success { background: #4CAF50; color: #ffffff; border-color: #2E7D32; }
.clipboard-helper { position: fixed; left: -9999px; top: 0; }

.result-card { position: relative; isolation: isolate; overflow: hidden; }
.result-card > .card-header,
.result-card > .output-area,
.result-card > .btn-copy { position: relative; z-index: 2; }
.output-area { perspective: 400px; }
.spark-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 50; }
@media (prefers-reduced-motion: reduce) { .spark-canvas { display: none; } }

/* Copyright ใต้โลโก้ */
.css-logo { margin-top: 0; margin-bottom: 10px; }
.logo-copyright { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 340px; width: 100%; font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin: 0 auto 26px; letter-spacing: 0.6px; white-space: nowrap; }
.logo-copyright::before, .logo-copyright::after { content: ""; flex: 1; height: 1px; }
.logo-copyright::before { background: linear-gradient(90deg, transparent, rgba(217,0,255,0.55)); }
.logo-copyright::after { background: linear-gradient(90deg, rgba(217,0,255,0.55), transparent); }
.copy-shine { background: linear-gradient(110deg, #8899aa 0%, #8899aa 40%, #fff6c2 47%, #ffffff 50%, #f3b8ff 53%, #8899aa 60%, #8899aa 100%); background-size: 250% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; animation: copyShine 3s ease-in-out infinite; }
@keyframes copyShine { 0% { background-position: 100% 0; filter: none; } 35% { background-position: 0% 0; filter: drop-shadow(0 0 4px rgba(255,240,200,0.45)); } 45%, 100% { background-position: 0% 0; filter: none; } }
@media (prefers-reduced-motion: reduce) { .copy-shine { animation: none; -webkit-text-fill-color: currentColor; color: var(--text-muted); background: none; } }

/* Copyright ใต้โลโก้: เส้นทอง ตัวหนาขึ้น */
.logo-copyright { max-width: 420px; gap: 14px; font-size: 15px; font-weight: 600; letter-spacing: 0.8px; margin: 2px auto 26px; }
.logo-copyright::before, .logo-copyright::after { height: 1.5px; }
.logo-copyright::before { background: linear-gradient(90deg, transparent, #ffb81c); }
.logo-copyright::after { background: linear-gradient(90deg, #ffb81c, transparent); }
.copy-shine { background-image: linear-gradient(110deg, #c9dbe6 0%, #c9dbe6 40%, #fff6c2 47%, #ffffff 50%, #f3b8ff 53%, #c9dbe6 60%, #c9dbe6 100%); }
.logo-copyright { font-size: 13px; max-width: 380px; }
.css-logo { margin-top: 16px; }
@media (max-width: 768px) { .logo-copyright { font-size: 12px; max-width: 300px; } }

/* ===== กรอบนีออนม่วงเปล่งแสงเป็นจังหวะ ===== */
.app-container::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 3px solid #f2a6ff;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    box-shadow:
        0 0 18px #d900ff,
        0 0 42px rgba(217, 0, 255, 0.75),
        0 0 90px rgba(217, 0, 255, 0.45),
        inset 0 0 22px rgba(217, 0, 255, 0.55);
    animation: neonPulse 3.2s ease-in-out infinite;
}
@keyframes neonPulse {
    0%, 55%, 100% { opacity: 0; }
    72% { opacity: 1; }
    80% { opacity: 0.85; }
}
@media (max-width: 768px) {
    .app-container::after { inset: -2px; border-width: 2px; border-radius: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-container::after { animation: none; }
}

.output-area[data-has-result="true"] { cursor: pointer; }

/* ===== ปุ่มลูกศรไปรวมเลขชุด ===== */
html { scroll-behavior: smooth; }
#static-sets { scroll-margin-top: 16px; }
.jump-btn {
    position: fixed;
    right: calc(18px + env(safe-area-inset-right, 0px));
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px 10px 12px;
    border-radius: 999px;
    border: 2px solid #d900ff;
    background: rgba(10, 14, 26, 0.88);
    color: #ffffff;
    font-size: 14px; font-weight: 700;
    text-decoration: none;
    box-shadow: 0 0 14px rgba(217, 0, 255, 0.55), inset 0 0 10px rgba(217, 0, 255, 0.25);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.jump-btn svg { width: 22px; height: 22px; color: #ffd43b; animation: jumpBounce 1.4s ease-in-out infinite; transition: transform 0.3s ease; }
.jump-btn:hover { box-shadow: 0 0 22px rgba(217, 0, 255, 0.8), inset 0 0 12px rgba(217, 0, 255, 0.35); }
.jump-btn:active { transform: scale(0.94); }
.jump-btn:focus-visible { outline: 3px solid #ffd43b; outline-offset: 3px; }
.jump-btn.is-up svg { transform: rotate(180deg); animation-name: jumpBounceUp; }
@keyframes jumpBounce { 0%, 100% { translate: 0 -2px; } 50% { translate: 0 3px; } }
@keyframes jumpBounceUp { 0%, 100% { translate: 0 2px; } 50% { translate: 0 -3px; } }
@media (max-width: 768px) {
    .jump-btn { padding: 9px 14px 9px 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .jump-btn svg { animation: none; }
}
