/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Import decomposition layout styles */
@import url('decomposition.css');

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #3498db;
}

/* Main content */
main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Character display */
.character-display {
    text-align: center;
    margin-bottom: 2rem;
}

.character-large {
    font-size: 8rem;
    font-weight: bold;
    margin: 1rem 0;
    color: #2c3e50;
}

.character-info {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.character-info h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.character-info p {
    margin-bottom: 0.5rem;
    color: #666;
}

/* Components grid */
.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.component-card {
	background: white;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 1.5rem;
	text-align: center;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.component-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.component-character {
	font-size: 2.5rem;
	margin-bottom: 0.5rem;
	font-weight: bold;
	color: #2c3e50;
}

.component-position {
	font-size: 0.9rem;
	color: #666;
	margin-bottom: 0.5rem;
	text-transform: capitalize;
}

.component-type {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 20px;
	font-size: 0.8rem;
	font-weight: 600;
	margin-bottom: 1rem;
	text-transform: uppercase;
}

.component-type[data-type="radical"] {
	background-color: #ffeaea;
	color: #e74c3c;
	border: 1px solid #e74c3c;
}

.component-type[data-type="phonetic"] {
	background-color: #e8f4fc;
	color: #3498db;
	border: 1px solid #3498db;
}

.component-type[data-type="semantic"] {
	background-color: #e8f7ed;
	color: #2ecc71;
	border: 1px solid #2ecc71;
}

.component-type[data-type="other"] {
	background-color: #f3e8ff;
	color: #9b59b6;
	border: 1px solid #9b59b6;
}

.component-image img {
    display: inline-block;
	max-width: 100%;
	max-height: 150px;
	width: auto;
	height: auto;
	object-fit: contain;
	margin: 0.5rem auto;
	border-radius: 4px;
	border: 1px solid #dee2e6;
}

.character-main-image {
	max-width: 100%;
	height: auto;
	margin: 1rem 0;
	border-radius: 8px;
	border: 2px solid #dee2e6;
}

.correct-answer-display {
	text-align: center;
	margin: 1.5rem 0;
	padding: 1.5rem;
	background-color: #f8f9fa;
	border-radius: 8px;
	border: 1px solid #dee2e6;
}

.correct-character-large {
	font-size: 4rem;
	font-weight: bold;
	margin-bottom: 0.5rem;
	color: #2c3e50;
}

.correct-meaning {
	font-size: 1.5rem;
	color: #7f8c8d;
	font-weight: 500;
}

.review-link-container {
	margin-top: 1rem;
	text-align: center;
}

.review-link {
	display: inline-block;
	padding: 0.5rem 1rem;
	background-color: #3498db;
	color: white;
	text-decoration: none;
	border-radius: 4px;
	font-weight: 500;
	transition: background-color 0.2s;
}

.review-link:hover {
	background-color: #2980b9;
	text-decoration: none;
	color: white;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
	.component-image img {
		max-width: 80px;
		max-height: 80px;
	}
	
	.character-main-image {
		max-width: 300px;
	}
}

@media (max-width: 480px) {
	.component-image img {
		max-width: 60px;
		max-height: 60px;
	}
	
	.character-main-image {
		max-width: 250px;
	}
}

.component-mnemonic {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #eee;
	text-align: left;
}

.mnemonic-label {
	font-size: 0.9rem;
	color: #666;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.mnemonic-text {
	font-size: 0.95rem;
	color: #333;
	line-height: 1.4;
	font-style: italic;
}

/* Example words and sentences */
.examples-section {
    margin: 2rem 0;
}

.example-list {
    list-style: none;
}

.example-item {
    background: white;
    border-left: 4px solid #3498db;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.example-chinese {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.example-pinyin {
    color: #666;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.example-english {
    color: #333;
}

/* Progress and review */
.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-fill {
    background: #3498db;
    height: 100%;
    transition: width 0.3s;
}

.review-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    margin-bottom: 2rem;
}

.quality-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.quality-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.quality-button:hover {
    transform: translateY(-2px);
}

.quality-again { background-color: #ef4444; }
.quality-hard { background-color: #f97316; }
.quality-good { background-color: #22c55e; }
.quality-easy { background-color: #3b82f6; }

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0.5rem 0;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.button:hover {
    background: #2980b9;
}

.button-secondary {
    background: #95a5a6;
}

.button-secondary:hover {
    background: #7f8c8d;
}

.button-success {
    background: #2ecc71;
}

.button-success:hover {
    background: #27ae60;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .character-large {
        font-size: 6rem;
    }
    
    .quality-buttons {
        flex-direction: column;
    }
    
    .components-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error states */
.error {
    background: #fee;
    border: 1px solid #f99;
    color: #c00;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Success states */
.success {
    background: #efe;
    border: 1px solid #9f9;
    color: #090;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Review page specific styles */
.review-instructions {
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.quality-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.quality-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    min-width: 100px;
}

.quality-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.quality-number {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.quality-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.quality-0 { background-color: #ef4444; }
.quality-1 { background-color: #f97316; }
.quality-2 { background-color: #22c55e; }
.quality-3 { background-color: #3b82f6; }

.review-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.answer-content {
    margin-top: 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.answer-content h3, .answer-content h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #666;
    margin-bottom: 1rem;
}

.stats-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.stats-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.character-details {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.character-details span {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
}

.audio-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: background-color 0.2s;
}

.audio-button:hover {
    background: #2980b9;
}

.grammar-link {
    background: #2ecc71;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.grammar-link:hover {
    background: #27ae60;
    color: white;
    text-decoration: none;
}

/* Dashboard specific styles */
.progress-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.progress-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.progress-details {
    margin-top: 1rem;
    color: #666;
}

.review-section, .recent-activity, .learning-tips {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.review-section h2, .recent-activity h2, .learning-tips h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tip-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #3498db;
}

.tip-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.tip-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive adjustments for review page */
@media (max-width: 768px) {
    .quality-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .quality-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .review-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .review-actions .button {
        width: 100%;
        max-width: 300px;
    }
    
    .character-details {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
}/* Character Decomposition Visualization Styles */

.decomposition-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.decomposition-section h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Decomposition section styling (updated for new layout system) */
.decomposition-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.decomposition-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Decomposition view controls */
.decomposition-view-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.view-toggle-button {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-button:hover {
    background: #e9ecef;
}

.view-toggle-button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Decomposition container for side-by-side views */
.decomposition-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin: 1rem 0;
}

.decomposition-view {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.decomposition-view h4 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid positions */
.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9ecef;
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.grid-cell:hover {
    background: #f1f8ff;
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Component styling */
.component-visual {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    padding: 0.5rem;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.component-visual:hover {
	color: #3498db;
	transform: scale(1.1);
}

/* Component image overlay in grid */
.component-image-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.3;
	transition: opacity 0.3s ease;
	z-index: 2;
}

.component-visual:hover .component-image-overlay {
	opacity: 0.7;
}

.component-grid-image {
	max-width: 80%;
	max-height: 80%;
	object-fit: contain;
	border-radius: 4px;
}

/* Component type styling */
.component-visual[data-component-type="radical"] {
	color: #e74c3c;
	border-color: #e74c3c;
}

.component-visual[data-component-type="phonetic"] {
	color: #3498db;
	border-color: #3498db;
}

.component-visual[data-component-type="semantic"] {
	color: #2ecc71;
	border-color: #2ecc71;
}

.component-visual[data-component-type="other"] {
	color: #9b59b6;
	border-color: #9b59b6;
}

/* Component relationship visualization */
.relationship-visualization {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 3;
}

.relationship-svg {
	width: 100%;
	height: 100%;
}

.relationship-line {
	stroke-width: 3;
	stroke-linecap: round;
	fill: none;
	opacity: 0.7;
	transition: all 0.3s ease;
}

.relationship-line:hover {
	stroke-width: 5;
	opacity: 1;
	filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

.relationship-contains {
	stroke: #3498db;
	stroke-dasharray: 10, 5;
}

.relationship-overlaps {
	stroke: #e74c3c;
	stroke-dasharray: 5, 5;
}

.relationship-adjacent {
	stroke: #2ecc71;
}

.relationship-encloses {
	stroke: #9b59b6;
	stroke-dasharray: 15, 5, 5, 5;
}

.relationship-arrowhead {
	fill: currentColor;
}

.relationship-contains .relationship-arrowhead {
	fill: #3498db;
}

.relationship-overlaps .relationship-arrowhead {
	fill: #e74c3c;
}

.relationship-adjacent .relationship-arrowhead {
	fill: #2ecc71;
}

.relationship-encloses .relationship-arrowhead {
	fill: #9b59b6;
}

/* Relationship legend */
.relationship-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 1rem;
	padding: 0.75rem;
	background: #f8f9fa;
	border-radius: 6px;
	border: 1px solid #dee2e6;
}

.relationship-legend-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
	color: #495057;
}

.relationship-legend-line {
	width: 30px;
	height: 3px;
	border-radius: 1.5px;
}

.relationship-legend-contains {
	background: #3498db;
	background-image: repeating-linear-gradient(
		to right,
		transparent,
		transparent 5px,
		#3498db 5px,
		#3498db 10px
	);
}

.relationship-legend-overlaps {
	background: #e74c3c;
	background-image: repeating-linear-gradient(
		to right,
		transparent,
		transparent 2.5px,
		#e74c3c 2.5px,
		#e74c3c 5px
	);
}

.relationship-legend-adjacent {
	background: #2ecc71;
}

.relationship-legend-encloses {
	background: #9b59b6;
	background-image: repeating-linear-gradient(
		to right,
		transparent,
		transparent 7.5px,
		#9b59b6 7.5px,
		#9b59b6 10px
	);
}

/* Position labels */
.position-label {
    position: absolute;
    font-size: 0.75rem;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 5;
}

.top-left-label { top: 2px; left: 2px; }
.top-center-label { top: 2px; left: 50%; transform: translateX(-50%); }
.top-right-label { top: 2px; right: 2px; }
.middle-left-label { top: 50%; left: 2px; transform: translateY(-50%); }
.center-label { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.middle-right-label { top: 50%; right: 2px; transform: translateY(-50%); }
.bottom-left-label { bottom: 2px; left: 2px; }
.bottom-center-label { bottom: 2px; left: 50%; transform: translateX(-50%); }
.bottom-right-label { bottom: 2px; right: 2px; }

/* Full character overlay */
.full-character-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    color: rgba(44, 62, 80, 0.2);
    pointer-events: none;
    z-index: 1;
}

/* Component details panel */
.component-details {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    display: none;
}

.component-details.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.component-details h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.component-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.component-info-item {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.component-info-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.component-info-value {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .decomposition-grid {
        width: 250px;
        height: 250px;
    }
    
    .component-visual {
        font-size: 2rem;
    }
    
    .full-character-overlay {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .decomposition-grid {
        width: 200px;
        height: 200px;
    }
    
    .component-visual {
        font-size: 1.5rem;
    }
    
    .full-character-overlay {
        font-size: 2.5rem;
    }
}

/* Connection lines for complex characters */
.connection-line {
    position: absolute;
    background: #3498db;
    z-index: 2;
    pointer-events: none;
}

.horizontal-line {
    height: 2px;
}

.vertical-line {
    width: 2px;
}

/* Highlight states */
.highlighted {
    background: #e3f2fd !important;
    border-color: #3498db !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3) !important;
}

/* Legend */
.decomposition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-radical { background: #e3f2fd; border: 1px solid #3498db; }
.legend-phonetic { background: #f3e5f5; border: 1px solid #9c27b0; }
.legend-semantic { background: #e8f5e8; border: 1px solid #4caf50; }
/* Outer component border */
.outer-component-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px dashed #3498db;
    border-radius: 8px;
    pointer-events: all;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 3;
}

.outer-component-border:hover {
    border-color: #2980b9;
    background: rgba(52, 152, 219, 0.05);
    transform: scale(1.02);
}

.outer-component-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.zoom-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-button:hover {
    background: #3498db;
    color: white;
    transform: scale(1.1);
}

.zoom-level {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

/* Zoom states */
.decomposition-grid.zoomed {
    transform: scale(1.2);
    transition: transform 0.3s ease;
}

.decomposition-grid.zoomed-out {
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

/* Tooltip for components */
.component-tooltip {
    position: absolute;
    background: #2c3e50;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}

.component-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2c3e50;
}

.component-visual:hover .component-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Pulse animation for new components */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.new-component {
    animation: pulse 2s ease-in-out infinite;
}

/* Component connections */
.component-connection {
    position: absolute;
    stroke: #3498db;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
    z-index: 2;
}

/* Error pages */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    text-align: center;
}

.error-content {
    max-width: 600px;
    padding: 2rem;
}

.error-content h1 {
    font-size: 6rem;
    color: #e74c3c;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.error-content h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.error-content p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .error-content h1 {
        font-size: 4rem;
    }
    
    .error-content h2 {
        font-size: 1.5rem;
    }
    
    .error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .error-actions .button {
        width: 100%;
        max-width: 300px;
    }
}

    /* Level indicators */
.level-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.level-badge {
    background: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.level-progress {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.level-progress-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.level-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.level-stats {
    font-size: 1rem;
    color: #666;
}

.level-progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin: 1rem 0;
}

.level-progress-fill {
    height: 100%;
    background: #27ae60;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.level-completion {
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2c3e50;
}

.overall-levels {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Quiz styles */
.quiz-container {
    background: white;
    border-radius: 11px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 1rem 0;
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
}

.quiz-question {
    text-align: center;
    margin-bottom: 1rem;
    color: #1c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0 0.5rem;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

/* For multiple choice quizzes, use 2 columns on wider screens */
@media (min-width: 640px) {
    .quiz-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 639px) {
    .quiz-options {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.quiz-option {
    background: #f7f9fa;
    border: 1px solid #e9ecef;
    border-radius: 7px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quiz-option:hover:not(:disabled) {
    background: #e8ecef;
    border-color: #3497db;
    transform: translateY(-3px);
}

.quiz-option.selected {
    border-color: #3497db;
    background: #e2f2fd;
}

.quiz-option.correct {
    border-color: #26ae60;
    background: #d4f4e6;
}

.quiz-option.incorrect {
    border-color: #e73c3c;
    background: #fadbd7;
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.option-character {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: -1.5rem;
    color: #1c3e50;
}

.option-meaning {
    font-size: 0rem;
    color: #665;
}

.quiz-feedback {
    margin: 0.5rem 0;
    padding: 1rem;
    border-radius: 7px;
    text-align: center;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    width: 100%;
}

.feedback-correct {
    color: #26ae60;
    background: #d4f4e6;
    padding: 1rem;
    border-radius: 5px;
    font-weight: bold;
    max-width: 100%;
    box-sizing: border-box;
}

.feedback-incorrect {
    color: #e73c3c;
    background: #fadbd7;
    padding: 1rem;
    border-radius: 5px;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .quiz-container {
        padding: 0.75rem;
        margin: 0.5rem 0;
        border-radius: 8px;
    }
    
    .quiz-question {
        font-size: 1.1rem;
        padding: 0 0.25rem;
    }
    
    .quiz-feedback {
        padding: 0.75rem;
        margin: 0.5rem 0;
    }
    
    .feedback-correct,
    .feedback-incorrect {
        padding: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .correct-character-large {
        font-size: 3rem !important;
    }
    
    .correct-meaning {
        font-size: 1.2rem !important;
    }
}

@media (max-width: 480px) {
    .quiz-feedback {
        padding: 0.5rem;
        margin: 0.25rem;
    }
    
    .feedback-correct,
    .feedback-incorrect {
        padding: 0.5rem;
    }
    
    .correct-character-large {
        font-size: 2.5rem !important;
    }
    
    .correct-meaning {
        font-size: 1rem !important;
    }
}

.review-quality-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
}

.quality-btn {
    flex: 1;
    min-width: 70px;
    max-width: 100px;
    padding: 0.5rem;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: transform 0.2s;
    text-align: center;
    color: white;
    font-weight: bold;
    box-sizing: border-box;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Mobile: stack vertically on very small screens */
@media (max-width: 480px) {
    .review-quality-buttons {
        flex-direction: column;
        gap: 0.5rem;
        margin: 0.5rem;
        padding: 0;
        width: 100%;
    }
    
    .quality-btn {
        width: 100%;
        max-width: 100%;
        min-width: auto;
        padding: 0.75rem 0.5rem;
        min-height: 50px;
        margin: 0;
    }
}

/* Small tablets: 2x2 grid */
@media (min-width: 481px) and (max-width: 768px) {
    .review-quality-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    
    .quality-btn {
        width: 100%;
        max-width: 100%;
        min-width: auto;
        margin: 0;
    }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
    .review-quality-buttons {
        margin: 0.25rem;
        gap: 0.25rem;
    }
    
    .quality-btn {
        padding: 0.5rem 0.25rem;
        min-height: 45px;
        font-size: 0.9rem;
    }
    
    .quality-number {
        font-size: 1.25rem;
    }
}

.quality-btn:hover {
    transform: translateY(-3px);
}

.quality-0 { background: #c0392b; }
.quality-1 { background: #e74c3c; }
.quality-2 { background: #e67e22; }
.quality-3 { background: #3498db; }
.quality-4 { background: #27ae60; }

.quality-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.quality-label {
    font-size: 0.9rem;
    font-weight: normal;
}

.learning-info {
    text-align: center;
    margin: 0rem 0;
    color: #665;
}

.due-count {
    background: #e73c3c;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
    margin-left: -1.5rem;
}

@keyframes fadeIn {
    from { opacity: -1; }
    to { opacity: 0; }
}

.hidden {
    display: none;
}

/* WiZìrd Rebranding Styles */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-image {
    height: 64px;
    width: 64px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.logo-accent {
    color: #ff6b6b; /* Accent color for "i" and "ì" */
}

.premise-intro {
    font-size: 1.2rem;
    font-style: italic;
    margin-bottom: 1.5rem;
    color: #555;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.premise {
    background: #f8f9fa;
    padding: 3rem 0;
    margin: 2rem 0;
    border-radius: 8px;
}

.premise h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.premise p {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    color: #555;
}

.accent-text {
    color: #ff6b6b;
    font-weight: bold;
}

/* Hero CTA Styles */
.hero-cta {
    text-align: center;
    margin-top: 2rem;
}

.button-large {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.no-account {
    margin-top: 1rem;
    color: #666;
    font-size: 0.95rem;
}

/* Features Cards */
.features-cards {
    padding: 4rem 0;
    text-align: center;
}

.features-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.features-subtitle {
    color: #666;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eaeaea;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.feature-card p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Final CTA */
.final-cta {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    border-radius: 16px;
    padding: 3rem;
    color: white;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.final-cta h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: white;
}

.button-secondary {
    background: white;
    color: #3498db;
    border: 2px solid white;
}

.button-secondary:hover {
    background: #f8f9fa;
    border-color: #f8f9fa;
}

.cta-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.decomposition-demo {
    padding: 3rem 0;
    text-align: center;
}

.decomposition-demo h2 {
    margin-bottom: 1rem;
    color: #333;
}

.demo-intro {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.character-decomposition {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 3rem 0;
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.target-character {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.character-large {
    font-size: 6rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.character-info {
    text-align: center;
}

.pinyin {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
}

.meaning {
    font-size: 1.3rem;
    color: #27ae60;
    font-weight: bold;
}

.decomposition-arrow {
    font-size: 3rem;
    font-weight: bold;
    color: #7f8c8d;
}

.components {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.component {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: 180px;
}

.component-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid #3498db;
}

.component-character {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.component-info {
    text-align: center;
}

.component-pinyin {
    font-size: 1.2rem;
    color: #e74c3c;
}

.component-meaning {
    font-size: 1.1rem;
    color: #27ae60;
    font-weight: bold;
}

.decomposition-plus {
    font-size: 2rem;
    font-weight: bold;
    color: #7f8c8d;
}

.decomposition-explanation {
    max-width: 800px;
    margin: 3rem auto 0;
    text-align: left;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
}

.decomposition-explanation h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.decomposition-explanation p {
    line-height: 1.6;
    color: #555;
    margin-bottom: 2rem;
}

.learning-benefits {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.benefit {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.benefit-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.benefit h4 {
    color: #3498db;
    margin-bottom: 0.5rem;
}

.benefit p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.features {
    margin-top: 3rem;
}

.feature h3 {
    color: #3498db;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .logo-text {
        font-size: 1.2rem;
    }
    
    .logo-image {
        height: 48px;
        width: 48px;
    }
    
    .character-decomposition {
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
    }
    
    .character-large {
        font-size: 4rem;
    }
    
    .components {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .component-image {
        width: 100px;
        height: 100px;
    }
    
    .component-character {
        font-size: 2rem;
    }
    
    .decomposition-arrow {
        font-size: 2rem;
        transform: rotate(90deg);
    }
    
    .decomposition-plus {
        font-size: 1.5rem;
        transform: rotate(90deg);
    }
    
    .learning-benefits {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .benefit {
        min-width: 100%;
    }
    
    .hero-cta {
        margin-top: 1.5rem;
    }
    
    .button-large {
        padding: 0.8rem 2rem;
        font-size: 1.1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 2rem 1.5rem;
    }
    
    .final-cta {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
    
    .final-cta h3 {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Cookie Consent Banner
   ========================================================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    display: none; /* Hidden by default, shown by JS/HTMX */
}

.cookie-banner.show {
    display: block;
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cookie-banner-text a {
    color: #3498db;
    text-decoration: underline;
}

.cookie-banner-text a:hover {
    color: #2980b9;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

.cookie-btn-accept {
    background: #27ae60;
    color: white;
}

.cookie-btn-accept:hover {
    background: #219653;
}

.cookie-btn-reject {
    background: #e74c3c;
    color: white;
}

.cookie-btn-reject:hover {
    background: #c0392b;
}

/* Mobile responsive for cookie banner */
@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .cookie-banner-text {
        min-width: auto;
    }
    
    .cookie-banner-actions {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-btn {
        flex: 1;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 0.75rem;
    }
    
    .cookie-banner-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .cookie-btn {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   Footer Links
   ========================================================================== */

.footer-links {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: #95a5a6;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #3498db;
    text-decoration: underline;
}

.footer-links .separator {
    color: #7f8c8d;
    margin: 0 0.5rem;
}

/* Mobile responsive for footer links */
@media (max-width: 768px) {
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .footer-links .separator {
        display: none;
    }
}

/* ==========================================================================
   Legal Pages Styling
   ========================================================================== */

.legal-page {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.legal-page h1 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.legal-page h2 {
    color: #34495e;
    margin: 2rem 0 1rem 0;
    font-size: 1.3rem;
}

.legal-page h3 {
    color: #2c3e50;
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.legal-page p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #333;
}

.legal-page ul, .legal-page ol {
    margin: 1rem 0 1rem 2rem;
    line-height: 1.6;
}

.legal-page li {
    margin-bottom: 0.5rem;
}

.legal-page a {
    color: #3498db;
    text-decoration: none;
}

.legal-page a:hover {
    text-decoration: underline;
}

.legal-page .last-updated {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.legal-page .contact-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin: 2rem 0;
    border-left: 4px solid #3498db;
}

.legal-page .contact-info h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* Mobile responsive for legal pages */
@media (max-width: 768px) {
    .legal-page {
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .legal-page {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .legal-page h1 {
        font-size: 1.5rem;
    }
    
    .legal-page h2 {
        font-size: 1.2rem;
    }
}

