:root {
    --deep-black: #0a0a0a;
    --soft-black: #1a1a1a;
    --soft-white: rgba(255, 255, 255, 0.87);
    --mid-white: rgba(255, 255, 255, 0.6);
    --white: #ffffff;
    --border-white: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --ai-blue: #00aaff;
    --ai-blue-soft: #0088cc;
    --ai-blue-glow: rgba(0, 170, 255, 0.3);
    --ai-purple: #aa00ff;
    --success-green: #00ff88;
    --error-red: #ff4444;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glow-soft: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--deep-black);
    color: var(--soft-white);
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Glass Card Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Page Wrapper */
.page {
    width: 100%;
    min-height: 100vh;
}

/* Header */
#appPage .header {
    padding: 20px 24px;
    backdrop-filter: blur(16px);
    height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.8);
}

@media (min-width: 1024px) {
    #appPage .header {
        padding: 25px 60px;
        height: 90px;
    }
}

@media (min-width: 1440px) {
    #appPage .header {
        padding: 25px 80px;
        height: 100px;
    }
}

#appPage .logo {
    font-size: 1.8rem;
    letter-spacing: 0.3rem;
    font-weight: 600;
    color: var(--soft-white);
}

@media (min-width: 1024px) {
    #appPage .logo {
        font-size: 2.2rem;
        letter-spacing: 0.4rem;
    }
}

@media (min-width: 1440px) {
    #appPage .logo {
        font-size: 2.4rem;
        letter-spacing: 0.45rem;
    }
}

/* Logout Text */
.logout-text {
    color: var(--mid-white);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}

.logout-text:hover {
    color: var(--ai-blue);
}

.logout-text:active {
    color: var(--white);
}

@media (min-width: 1024px) {
    .logout-text {
        font-size: 15px;
    }
}

/* Main Container */
#appPage .main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-top: 70px;
    padding-bottom: 80px;
    overflow: hidden;
}

@media (min-width: 1024px) {
    #appPage .main-container {
        padding-top: 90px;
        padding-bottom: 100px;
    }
}

@media (min-width: 1440px) {
    #appPage .main-container {
        padding-top: 100px;
        padding-bottom: 110px;
    }
}

#appPage .app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 16px 20px;
    gap: 16px;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out both;
    min-height: calc(100vh - 140px);
}

@media (min-width: 1024px) {
    #appPage .app-container {
        max-width: 1400px;
        padding: 32px 60px;
        gap: 24px;
    }
}

@media (min-width: 1440px) {
    #appPage .app-container {
        max-width: 1600px;
        padding: 40px 80px;
        gap: 28px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#appPage .main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 16px 100px 16px;
    position: relative;
    min-height: 0;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.02);
}

@media (min-width: 1024px) {
    #appPage .main-content-area {
        padding: 32px 32px 120px 32px;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
    }
}

@media (min-width: 1440px) {
    #appPage .main-content-area {
        padding: 40px 40px 140px 40px;
        border-radius: 20px;
    }
}

#appPage .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

@media (min-width: 1024px) {
    #appPage .section-header {
        margin-bottom: 24px;
    }
}

/* Buttons */
.app-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--soft-white);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
}

.app-button:active {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--soft-white);
    color: var(--white);
}

@media (min-width: 1024px) {
    .app-button {
        border-radius: 8px;
    }
    
    .app-button:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--ai-blue);
        color: var(--white);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 163, 255, 0.2);
    }
    
    .app-button:active {
        background: rgba(255, 255, 255, 0.05);
        transform: translateY(0);
    }
}

#appPage .copy-button {
    padding: 6px 8px;
    font-size: 0.7rem;
}

@media (min-width: 1024px) {
    #appPage .copy-button {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
}

#appPage .copy-button.success {
    background: rgba(0, 170, 255, 0.1);
    border-color: var(--ai-blue);
    color: var(--ai-blue);
}

#appPage .view-toggles {
    display: flex;
    gap: 8px;
}

@media (min-width: 1024px) {
    #appPage .view-toggles {
        gap: 10px;
    }
}

#appPage .view-toggle {
    padding: 4px 8px;
    font-size: 0.7rem;
    letter-spacing: 0.05rem;
}

@media (min-width: 1024px) {
    #appPage .view-toggle {
        padding: 8px 16px;
        font-size: 0.8rem;
        letter-spacing: 0.08rem;
    }
}

#appPage .view-toggle.active {
    background: var(--white);
    color: #000;
    border-color: var(--white);
}

/* Input/Output Area */
#appPage .input-textarea {
    flex: 1;
    width: 100%;
    background: var(--glow-soft);
    color: var(--white);
    font-family: inherit;
    font-weight: 400;
    font-size: 0.9rem;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    resize: none;
    overflow-y: auto;
    transition: all 0.2s ease;
    line-height: 1.6;
    min-height: 200px;
}

@media (min-width: 1024px) {
    #appPage .input-textarea {
        font-size: 1rem;
        padding: 24px;
        line-height: 1.8;
        border-radius: 12px;
    }
    
    #appPage .input-textarea:hover {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

@media (min-width: 1440px) {
    #appPage .input-textarea {
        font-size: 1.05rem;
        padding: 28px;
    }
}

#appPage .input-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

#appPage .input-textarea:focus {
    outline: none;
    border-color: var(--ai-blue);
    box-shadow: 0 0 0 3px var(--ai-blue-glow);
    background: rgba(255, 255, 255, 0.1);
}

#appPage .input-textarea:disabled {
    background: rgba(255, 255, 255, 0.02);
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.3);
}

#appPage .input-textarea:disabled::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Character Counter */
#appPage .character-counter {
    align-self: flex-end;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--soft-white);
    font-weight: 500;
}

@media (min-width: 1024px) {
    #appPage .character-counter {
        font-size: 0.85rem;
        margin-top: 12px;
    }
}

#appPage .character-counter.warning {
    color: var(--error-red);
}

/* Decision Content */
#appPage .decision-content {
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 0.85rem;
    color: var(--white);
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
    max-height: calc(100vh - 300px);
}

@media (min-width: 1024px) {
    #appPage .decision-content {
        font-size: 1rem;
        line-height: 1.8;
        padding-right: 12px;
    }
}

@media (min-width: 1440px) {
    #appPage .decision-content {
        font-size: 1.05rem;
        line-height: 1.9;
    }
}

#appPage .decision-content .error-message {
    color: var(--error-red);
    font-weight: 500;
}

/* Button Bar */
#appPage .button-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 20px;
    gap: 12px;
    z-index: 1000;
    backdrop-filter: blur(20px);
    display: flex;
}

@media (min-width: 1024px) {
    #appPage .button-bar {
        padding: 24px 60px;
        gap: 20px;
        max-width: 1400px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    }
}

@media (min-width: 1440px) {
    #appPage .button-bar {
        max-width: 1600px;
        padding: 28px 80px;
        gap: 24px;
    }
}

#appPage .action-button {
    flex: 1;
    background: var(--glass-bg);
    color: var(--white);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 16px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02rem;
}

@media (min-width: 1024px) {
    #appPage .action-button {
        font-size: 1.05rem;
        padding: 20px 24px;
        border-radius: 12px;
        letter-spacing: 0.05rem;
    }
}

@media (min-width: 1440px) {
    #appPage .action-button {
        font-size: 1.1rem;
        padding: 22px 28px;
    }
}

#appPage .action-button:active:not(:disabled) {
    border-color: var(--soft-white);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

@media (min-width: 1024px) {
    #appPage .action-button:hover:not(:disabled) {
        border-color: var(--soft-white);
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
        transform: translateY(-3px);
    }
    
    #appPage .action-button:active:not(:disabled) {
        transform: translateY(-1px);
    }
}

#appPage .action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.03);
}

#appPage .action-button.primary {
    background: linear-gradient(135deg, var(--ai-blue) 0%, var(--ai-blue-soft) 100%);
    color: var(--white);
    border-color: var(--ai-blue);
    box-shadow: 0 0 20px var(--ai-blue-glow);
}

#appPage .action-button.primary:active:not(:disabled) {
    background: linear-gradient(135deg, var(--ai-blue) 0%, var(--ai-blue) 100%);
    box-shadow: 0 0 30px var(--ai-blue-glow);
}

@media (min-width: 1024px) {
    #appPage .action-button.primary:hover:not(:disabled) {
        background: linear-gradient(135deg, var(--ai-blue) 0%, var(--ai-blue) 100%);
        box-shadow: 0 0 40px var(--ai-blue-glow), 0 -5px 20px var(--ai-blue-glow);
        transform: translateY(-4px);
    }
    
    #appPage .action-button.primary:active:not(:disabled) {
        transform: translateY(-2px);
    }
}

#appPage .action-button.primary.locked {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-subtle);
    color: var(--soft-white);
    box-shadow: none;
    cursor: pointer;
}

#appPage .action-button.primary.locked:active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--soft-white);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

@media (min-width: 1024px) {
    #appPage .action-button.primary.locked:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--soft-white);
        transform: translateY(-2px);
    }
}

/* Loading States */
#appPage .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 60px 20px;
    flex: 1;
    justify-content: center;
}

@media (min-width: 1024px) {
    #appPage .loading-container {
        gap: 30px;
        padding: 80px 40px;
    }
}

#appPage .loading-text {
    font-size: 1rem;
    color: var(--soft-white);
    text-align: center;
}

@media (min-width: 1024px) {
    #appPage .loading-text {
        font-size: 1.15rem;
    }
}

@media (min-width: 1440px) {
    #appPage .loading-text {
        font-size: 1.25rem;
    }
}

#appPage .loading-timer {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

#appPage .timer-seconds {
    font-size: 3rem;
    font-weight: 600;
    color: var(--ai-blue);
    text-shadow: 0 0 20px var(--ai-blue-glow);
    min-width: 60px;
    text-align: right;
}

#appPage .timer-label {
    font-size: 1.2rem;
    color: var(--soft-white);
    font-weight: 300;
}

@media (min-width: 1024px) {
    #appPage .timer-seconds {
        font-size: 4rem;
        min-width: 80px;
    }
    
    #appPage .timer-label {
        font-size: 1.4rem;
    }
}

#appPage .loading-subtext {
    color: var(--mid-white);
    font-size: 14px;
}

/* Auth Modal */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.auth-overlay.active {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    width: 90%;
    max-width: 400px;
    padding: 32px;
    position: relative;
}

.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--mid-white);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.auth-close:hover {
    color: var(--white);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    color: var(--white);
}

.auth-subtitle {
    color: var(--mid-white);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mid-white);
}

.form-input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-white);
    border-radius: 8px;
    color: var(--soft-white);
    font-size: 16px;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--ai-blue);
    box-shadow: 0 0 0 3px var(--ai-blue-glow);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--mid-white);
    cursor: pointer;
    padding: 4px;
}

.password-toggle:hover {
    color: var(--white);
}

.auth-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--ai-blue), var(--ai-purple));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 170, 255, 0.3);
}

.auth-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.auth-message.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: var(--error-red);
    display: block;
}

/* Debug Toggle */
.debug-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--ai-blue);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 170, 255, 0.4);
    transition: all 0.3s;
}

.debug-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 170, 255, 0.6);
}

/* Toast Animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
