:root {
    --primary: #60a5fa;
    --primary-glow: #3b82f6;
    --accent: #f472b6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --success: #4ade80;
    --error: #f87171;
    --input-bg: rgba(15, 23, 42, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 3rem;
}

body,
body::before {
    background-image: none !important;
}

.hero-section {
    width: 92%;
    max-width: 480px;
    height: 250px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin: 1.5rem auto 0;
    border-radius: 32px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.7);
    z-index: -1;
    transition: background-image 0.5s ease;
}

.hero-content {
    padding: 2rem;
    z-index: 2;
}

.glow-text {
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff !important;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-weight: 400;
    margin-top: 0.6rem;
}

.app-container {
    width: 100%;
    max-width: 500px;
    padding: 0 1.25rem;
    margin-top: -4rem;
    position: relative;
    z-index: 10;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 32px;
    padding: 2.5rem 1.8rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    margin-bottom: 1.6rem;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

label i {
    color: var(--primary);
    font-size: 1rem;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    background: var(--input-bg);
    border: 1.5px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    height: 3.5rem;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(30, 41, 59, 0.8);
}

/* 移除浏览器自动填充时的白色背景，并保持样式统一 */
input:-webkit-autofill,
input:-webkit-autofill:hover {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
    border: 1.5px solid rgba(255, 255, 255, 0.05) !important;
    transition: background-color 5000s ease-in-out 0s;
}

input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 0 0px 1000px rgba(30, 41, 59, 0.8) inset !important;
    border-color: var(--primary) !important;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .icon-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.75rem;
    font-size: 1.25rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.switch-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0.5rem 0;
}

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

.switch-container {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 26px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #f1f5f9;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.switch-slider {
    background-color: var(--primary);
}

input:checked+.switch-slider:before {
    transform: translateX(20px);
}

/* Step Control */
.range-group {
    margin-bottom: 2.5rem;
}

.step-control {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.step-row {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.step-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
}

.step-inputs {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

input[type="number"] {
    width: 90px;
    min-width: 90px;
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 0.6rem 0.5rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    outline: none;
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    background: transparent;
    cursor: pointer;
    outline: none;
}

input[type="range"]::-moz-focus-outer {
    border: 0;
}

input[type="range"]:focus {
    outline: none;
    box-shadow: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: rgba(30, 41, 59, 0.9);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    background-image: radial-gradient(circle at 30% 30%, #ffffff, var(--primary));
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15), 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(96, 165, 250, 0.4);
    margin-top: -9px;
    border: 1.5px solid var(--primary);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* Submit Button */
.submit-btn:not(.btn-small) {
    width: 100%;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    border: none;
    border-radius: 18px;
    min-height: 4rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.4);
}

/* Log Container */
.log-container {
    margin-top: 2rem;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
}

.log-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 8px;
}

.icon-btn:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

#log-content {
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Admin Base Classes */
.admin-box {
    width: 100%;
    max-width: 1100px !important;
    margin-top: -3rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 0.5rem;
}

.admin-header .actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.level-info .badge {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.level-warning .badge {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.level-error .badge {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.admin-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.98);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.btn-small {
    min-height: auto !important;
    width: auto !important;
    padding: 10px 20px !important;
    font-size: 0.85rem !important;
    border-radius: 12px !important;
    border: none;
    cursor: pointer;
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .admin-box {
        padding: 0 0.8rem;
    }

    .admin-header {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .admin-header .actions {
        display: flex;
        gap: 0.5rem;
    }

    .admin-header .actions button {
        flex: 1;
    }

    .log-table thead {
        display: none;
    }

    .log-table tr {
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 16px;
        margin-bottom: 1rem;
        padding: 1.2rem;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .log-table td {
        display: block;
        width: 100% !important;
        padding: 0.5rem 0;
        border: none !important;
    }

    .log-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-dim);
        text-transform: uppercase;
        margin-bottom: 0.2rem;
        font-weight: 600;
    }

    .log-actions {
        border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
        margin-top: 0.5rem;
        padding-top: 1rem !important;
        display: flex !important;
        justify-content: flex-end;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-section {
        width: 94%;
        height: 220px;
    }

    .glow-text {
        font-size: 1.8rem;
    }

    .glass-card {
        padding: 1.8rem 1.2rem;
    }
}

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

.app-footer {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 1rem;
}

.app-footer p {
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.6;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.text-red {
    color: #f87171;
    font-size: 0.7rem;
    animation: heart-beat 1.5s infinite ease-in-out;
}

@keyframes heart-beat {

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

    50% {
        transform: scale(1.2);
    }
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}