:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --accent: #ec4899;
    --accent-dark: #db2777;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.main-content {
    flex: 1;
    padding-top: 70px;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

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

.hero-section {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 40px;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(79, 70, 229, 0.1) 0%, transparent 50%);
    animation: heroBgMove 20s ease-in-out infinite;
}

@keyframes heroBgMove {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 700px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
}

.title-line {
    display: block;
}

.title-line.highlight {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 50px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.feature-icon {
    font-size: 1.2rem;
}

.key-input-section {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.key-input {
    flex: 1;
    padding: 16px 24px;
    font-size: 1.1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    transition: all var(--transition-normal);
}

.key-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.key-input::placeholder {
    letter-spacing: 1px;
    text-transform: none;
    color: var(--text-muted);
}

.input-hint {
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-accent {
    background: var(--gradient-2);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.2em;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading .btn-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.test-header {
    margin-bottom: 40px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 4px;
    transition: width var(--transition-normal);
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
}

.progress-text span {
    font-weight: 700;
    color: var(--primary);
}

.question-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
    line-height: 1.5;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 16px;
}

.option-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.option-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.option-marker {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.option-item.selected .option-marker {
    border-color: var(--primary);
    background: var(--primary);
}

.option-item.selected .option-marker::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.option-text {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.test-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.result-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.result-header {
    margin-bottom: 50px;
}

.result-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.result-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    border: 1px solid var(--border);
    transition: all var(--transition-normal);
    animation: cardFadeIn 0.6s ease backwards;
}

.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }

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

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.score-bg {
    fill: none;
    stroke: var(--bg-dark);
    stroke-width: 8;
}

.score-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease;
}

.score-fill.repression {
    stroke: url(#repression-gradient);
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.sm-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.sm-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sm-label {
    width: 80px;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.bar-container {
    flex: 1;
    height: 12px;
    background: var(--bg-dark);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease;
}

.s-bar {
    background: var(--gradient-1);
}

.m-bar {
    background: var(--gradient-2);
}

.sm-value {
    width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.fourlove-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.fourlove-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.fourlove-bar {
    width: 100%;
    height: 60px;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.fl-fill {
    width: 100%;
    transition: height 1s ease;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.fl-fill.first { background: linear-gradient(to top, #6366f1, #818cf8); }
.fl-fill.second { background: linear-gradient(to top, #ec4899, #f472b6); }
.fl-fill.third { background: linear-gradient(to top, #10b981, #34d399); }
.fl-fill.fourth { background: linear-gradient(to top, #f59e0b, #fbbf24); }

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

.fl-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.fourlove-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.first { background: #6366f1; }
.dot.second { background: #ec4899; }
.dot.third { background: #10b981; }
.dot.fourth { background: #f59e0b; }

.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.login-card {
    max-width: 400px;
    margin: 100px auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    text-align: center;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--text-primary);
}

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

.admin-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

.admin-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-login {
    width: 100%;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: all var(--transition-normal);
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tab-btn.active {
    color: var(--primary);
    background: var(--bg-card);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.keys-header, .questions-header, .results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.keys-header h3, .questions-header h3, .results-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.keys-list, .questions-list, .results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.key-item, .question-item, .result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-normal);
}

.key-item:hover, .question-item:hover, .result-item:hover {
    border-color: var(--primary);
}

.key-code {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 2px;
}

.key-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.valid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.used {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.key-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.question-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.question-item-text {
    font-size: 1rem;
    color: var(--text-primary);
}

.question-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.question-actions, .key-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.result-item-content {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.result-stat {
    text-align: center;
}

.result-stat-label {
    font-size: 0.8rem    color: var(--text-muted);
    margin-bottom: 4px;
}

.result-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.options-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.option-editor-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
}

.option-editor-item:last-child {
    border-bottom: none;
}

.option-editor-item .form-group {
    margin-bottom: 0;
}

.option-editor-item .form-input {
    padding: 10px 12px;
    font-size: 0.9rem;
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.score-input {
    text-align: center;
}

.score-input input {
    width: 100%;
    padding: 8px;
    text-align: center;
}

.score-input label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    transition: transform 0.3s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .nav-bar {
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 16px;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
    
    .test-navigation {
        flex-direction: column;
    }
    
    .result-cards {
        grid-template-columns: 1fr;
    }
    
    .fourlove-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .result-item-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .option-editor-item {
        grid-template-columns: 1fr;
    }
    
    .scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
