:root {
    --bg-dark: #0f172a;
    --primary: #3b82f6;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
}

.sphere-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.8) 0%, rgba(15,23,42,0) 70%);
    top: -200px;
    left: -100px;
}

.sphere-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16,185,129,0.5) 0%, rgba(15,23,42,0) 70%);
    bottom: -300px;
    right: -200px;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

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

.logo-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Tabs */
.tabs {
    display: none;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* --- Category Selection Grid --- */
.category-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.category-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.category-card h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-dark);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 4rem 2rem;
    width: 100%;
    max-width: 600px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card.idle {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.1);
}

.glass-card.success {
    border-color: var(--success);
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.2);
    transform: scale(1.02);
}

.glass-card.error {
    border-color: var(--error);
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.2);
    animation: shake 0.5s ease-in-out;
}

.icon-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    font-size: 3rem;
    transition: all 0.3s ease;
}

.success .icon-container {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.error .icon-container {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

#status-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

#status-message {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* User Info Section */
.user-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    animation: slideUp 0.5s ease-out forwards;
}

.hidden {
    display: none !important;
}

.tags {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tag {
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 500;
}

.tag-section {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.tag-group {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.user-info .name {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Camera Section */
.camera-section {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-camera {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

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

#reader-container {
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
}

#reader {
    width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

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