:root {
    /* Light Mode Palette (Grayscale) */
    --bg-color: #f4f4f5;
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.8);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: #e4e4e7;
    --btn-primary: #18181b;
    --btn-primary-text: #ffffff;
    --btn-danger: #ef4444;
    --error-color: #ef4444;
    --blob-1: #d4d4d8;
    --blob-2: #e4e4e7;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    /* Dark Mode Palette (Grayscale) */
    --bg-color: #09090b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --glass-bg: rgba(24, 24, 27, 0.6);
    --glass-border: rgba(39, 39, 42, 0.8);
    --input-bg: rgba(9, 9, 11, 0.8);
    --input-border: #3f3f46;
    --btn-primary: #fafafa;
    --btn-primary-text: #18181b;
    --btn-danger: #f87171;
    --error-color: #f87171;
    --blob-1: #27272a;
    --blob-2: #18181b;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Background Animated Blobs */
.background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--blob-1);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--blob-2);
    bottom: -100px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {

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

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

header {
    position: absolute;
    top: 0;
    width: 100%;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

#themeToggle {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

#themeToggle:hover {
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

/* Main Glassmorphism Container */
.glass-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
    z-index: 10;
}

.view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Upload Form Components */
.dropzone {
    border: 2px dashed var(--input-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    background: var(--input-bg);
    transition: all 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--text-primary);
    background: var(--glass-bg);
}

.dropzone.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.dropzone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.file-limits {
    font-size: 0.8rem;
    opacity: 0.7;
}

.form-group {
    padding-top: 1.5rem;
}

.form-group.row {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#uploadBtn {
    margin-top: 1rem;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    overflow: hidden;
}

.url-input-wrapper.url-ready {
    border-color: #eab308;
    background: rgba(234, 179, 8, 0.1);
}

.prefix {
    padding: 1.5rem 0.5rem 1.5rem 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    background: var(--glass-bg);
    border-right: 1px solid var(--input-border);
    white-space: nowrap;
    flex-shrink: 0;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 1.5rem 0.75rem;
    border: none;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
}

.ttl-options {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.ttl-options input[type="radio"] {
    display: none;
}

.radio-btn {
    flex: 1;
    text-align: center;
    padding: 1rem 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-btn:hover {
    background: var(--glass-bg);
}

.ttl-options input[type="radio"]:checked+.radio-btn {
    background: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
}

.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

body.dark-mode select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23fafafa%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
}

.primary-btn,
.secondary-btn,
.danger-btn {
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    width: 100%;
    transition: transform 0.1s ease, opacity 0.2s;
}

.primary-btn {
    background: var(--btn-primary);
    color: var(--btn-primary-text);
}

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

.primary-btn:not(:disabled):active {
    transform: scale(0.98);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-primary);
}

.danger-btn {
    background: transparent;
    border: 1px solid var(--btn-danger);
    color: var(--btn-danger);
}

.danger-btn:hover {
    background: var(--btn-danger);
    color: white;
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2rem;
}

/* Success Screen */
.success-screen {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.copy-box {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.pin-display {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.warning-text {
    color: var(--error-color);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Access View Specifics */
.pin-group input {
    font-size: 3rem;
    text-align: center;
    letter-spacing: 1rem;
    font-weight: 600;
    height: 80px;
    border: 1px solid var(--input-border);
    border-radius: 16px;
    transition: border-color 0.2s;
}

.pin-group input:focus {
    border-color: var(--text-primary);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.pin-error {
    animation: shake 0.5s;
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-color: var(--error-color) !important;
}

.button-group {
    display: flex;
    gap: 1rem;
}

.button-group button {
    flex: 1;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
}

.text-link {
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: block;
}

.text-link:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 600px) {
    .glass-container {
        padding: 2rem;
        border-radius: 0;
        min-height: 100vh;
        border: none;
    }

    header {
        padding: 1.5rem;
    }
}