:root {
    --color-primary: 249 115 22;
    --color-primary-hover: 234 88 12;
    --color-secondary: 59 130 246;
    --color-bg: 248 250 252;
    --color-surface: 255 255 255;
    --color-text: 15 23 42;
    --color-text-secondary: 51 65 85;
    --color-muted: 100 116 139;
    --color-border: 226 232 240;
    --color-success: 34 197 94;
    --color-warning: 245 158 11;
    --color-error: 239 68 68;
    --shadow-light: 0 1px 3px 0 #0001;
    --shadow-medium: 0 4px 6px -1px #0001;
    --shadow-heavy: 0 10px 15px -3px #0001
}

.dark {
    --color-primary: 249 115 22;
    --color-primary-hover: 234 88 12;
    --color-secondary: 167 139 250;
    --color-bg: 24 24 27;
    --color-surface: 39 39 42;
    --color-text: 250 250 250;
    --color-text-secondary: 228 228 231;
    --color-muted: 161 161 170;
    --color-border: 63 63 70;
    --shadow-light: 0 1px 3px 0 #0003;
    --shadow-medium: 0 4px 6px -1px #0003;
    --shadow-heavy: 0 10px 15px -3px #0004
}

html {
    width: 100%;
    overflow-x: hidden
}

* {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease
}

body {
    font-family: 'Noto Sans Thai', sans-serif;
    background-color: rgb(var(--color-bg));
    min-height: 100dvh;
    overflow: hidden;
    color: rgb(var(--color-text));
    display: flex;
    flex-direction: column
}

.dark body {
    background-color: rgb(var(--color-bg));
    background-image: none;
    background-attachment: fixed
}

.page-container {
    position: absolute;
    inset: 0;
    transition: opacity .4s ease;
    will-change: opacity
}

#welcomeView, #resetNewPinView, #resetConfirmOldPinView {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page-hidden {
    opacity: 0;
    pointer-events: none;
}

.page-visible {
    opacity: 1;
}

.btn-icon {
    transition: all .2s cubic-bezier(.4, 0, .2, 1);
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center
}

.btn-icon:hover {
    background: rgb(var(--color-primary)/.1);
    color: rgb(var(--color-primary));
    transform: scale(1.05)
}

.btn-icon:active {
    transform: scale(.95)
}

.glass {
    background: rgba(var(--color-surface), .5);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(var(--color-border), .2);
    box-shadow: var(--shadow-light)
}

.dark .glass {
    background: rgba(var(--color-surface), .5);
    border: 1px solid rgba(var(--color-border), .2)
}

.partners-header,
.partners-footer {
    background: rgb(var(--color-surface)/.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
    z-index: 10;
    transition: opacity .3s ease, transform .3s ease
}

.partners-header {
    border-bottom: 1px solid rgb(var(--color-border));
    box-shadow: var(--shadow-light);
    height: 50px
}

.partners-footer {
    border-top: 1px solid rgb(var(--color-border));
    box-shadow: 0 -2px 8px #0000000d;
    height: 50px
}

.header-content,
.footer-content {
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.sidebar {
    position: fixed;
    top: 0;
    left: -75%;
    width: 75%;
    max-width: 300px;
    height: 100%;
    background: rgb(var(--color-surface)/.9);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    z-index: 100;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--shadow-heavy);
    border-right: 1px solid rgb(var(--color-border))
}

.sidebar.open {
    transform: translateX(100%)
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: #0006;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto
}

.workspace-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent
}

.nav-container {
    background: rgb(var(--color-surface)/.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgb(var(--color-border)/.5);
    box-shadow: var(--shadow-light);
    border-radius: 24px;
    padding: 4px;
}

.nav-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    transition: all .3s cubic-bezier(.4, 0, .2, 1)
}

.nav-button:hover {
    background: rgb(var(--color-primary)/.1);
    transform: scale(1.05);
    color: rgb(var(--color-primary))
}

.nav-button.active {
    background: linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-primary-hover)));
    color: #fff!important;
    box-shadow: var(--shadow-medium), 0 0 20px rgb(var(--color-primary)/.4);
    transform: scale(1.05);
    border-radius: 20px
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1)
}

.welcome-title {
    font-size: 1.5rem;
    background: linear-gradient(90deg, #9b25f9, #26c5f3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px #fff4;
    position: relative;
    z-index: 20;
    margin: 0;
    text-align: center;
    font-weight: 700
}

.input-wrapper {
    position: relative;
    width: 350px;
    max-width: 90%;
    height: 56px;
    z-index: 20
}

.input-wrapper.error {
    animation: shake .5s ease-in-out
}

.input-box {
    width: 100%;
    height: 100%;
    padding: 16px 20px;
    font-size: 1.2rem;
    border: none;
    border-radius: 16px;
    background: #1a1a1a;
    color: #fff;
    box-sizing: border-box;
    transition: all .3s ease;
    box-shadow: 0 0 15px #0008
}

.input-box:focus {
    outline: none
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0)
    }
    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px)
    }
    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px)
    }
}

.animated-border {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity .3s ease
}

.input-wrapper:focus-within .animated-border {
    opacity: 1
}

.input-wrapper:focus-within .animated-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(90deg, #9b25f9, #26c5f3, #9b25f9);
    background-size: 300% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: draw 1.3s ease forwards, gradientFlow 3s linear infinite, glow 2s ease-in-out infinite alternate
}

@keyframes draw {
    0% {
        clip-path: polygon(100% 100%, 100% 100%, 100% 100%, 100% 100%)
    }
    25% {
        clip-path: polygon(100% 100%, 0% 100%, 0% 100%, 0% 100%)
    }
    50% {
        clip-path: polygon(100% 100%, 0% 100%, 0% 0%, 0% 0%)
    }
    75% {
        clip-path: polygon(100% 100%, 0% 100%, 0% 0%, 100% 0%)
    }
    100% {
        clip-path: polygon(100% 100%, 0% 100%, 0% 0%, 100% 0%, 100% 100%)
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%
    }
    50% {
        background-position: 100% 50%
    }
    100% {
        background-position: 0% 50%
    }
}

@keyframes glow {
    0% {
        filter: drop-shadow(0 0 5px #b429f9b3)
    }
    50% {
        filter: drop-shadow(0 0 10px #26c5f3cc)
    }
    100% {
        filter: drop-shadow(0 0 12px #b429f9e6)
    }
}

.particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(90deg, hsla(280, 95%, 80%, 0.3), hsla(193, 90%, 80%, 0.3));
    animation: float 15s infinite linear
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0) rotate(0);
        opacity: 0
    }
    10% {
        opacity: 1
    }
    90% {
        opacity: .5
    }
    100% {
        transform: translateY(-100vh) translateX(calc(var(--random-translateX, 1) * 50px)) rotate(360deg);
        opacity: 0
    }
}

.gradient-input-container {
    position: relative;
    width: 100%;
    height: 40px;
    z-index: 20;
    border-radius: 9999px
}

.gradient-input-container .gradient-input {
    width: 100%;
    height: 100%;
    padding: 0 20px;
    font-size: 1rem;
    border: none;
    border-radius: 9999px;
    background: #1a1a1a;
    color: #fff;
    box-sizing: border-box;
    transition: all .3s ease;
    box-shadow: 0 0 15px #0008
}

.gradient-input-container .gradient-input:focus {
    outline: none
}

.gradient-input-container .gradient-animated-border {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity .3s ease
}

.gradient-input-container:focus-within .gradient-animated-border {
    opacity: 1
}

.gradient-input-container:focus-within .gradient-animated-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    padding: 2px;
    background: linear-gradient(90deg, #9b25f9, #26c5f3, #9b25f9);
    background-size: 300% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: draw 1.3s ease forwards, gradientFlow 3s linear infinite, glow 2s ease-in-out infinite alternate
}

.home-gif {
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 12px;
    object-fit: cover;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4, 0, .2, 1)
}

.home-gif:hover {
    background: rgb(var(--color-primary)/.1);
    transform: scale(1.05)
}

.home-gif:active {
    transform: scale(.95)
}

.hidden {
    display: none
}

/* --- [NEW] สไตล์สำหรับปุ่มยืนยันตามธีม --- */
.confirm-button {
    /* Light Mode (default) */
    background-color: rgb(var(--color-text)); /* Black */
    color: rgb(var(--color-bg)); /* White */
}

.confirm-button:hover:not(:disabled) {
    opacity: 0.8;
}

.dark .confirm-button {
    /* Dark Mode */
    background-color: rgb(var(--color-text)); /* White */
    color: rgb(var(--color-bg)); /* Black */
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* ------------------------------------- */
