:root {
    --bg-color: #fcfcfc;
    --text-color: #2d3436;
    --accent-color: #0984e3;
    --card-bg: #ffffff;
    --border-color: #dfe6e9;
    --secondary-text: #636e72;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    text-align: center;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 2rem;
}

/* Home Page Styles */
.search-box {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box:focus {
    border-color: var(--accent-color);
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
}

.category-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-color);
    display: block;
    box-shadow: var(--shadow);
}

.category-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.category-item .path {
    font-size: 0.75rem;
    color: var(--secondary-text);
    display: block;
    margin-bottom: 0.5rem;
}

.category-item .name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Card Page Styles */
.deck-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    width: 100%;
}

.back-link {
    text-decoration: none;
    color: var(--accent-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.card-container {
    perspective: 1000px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 300px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-content {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    line-height: 1.7;
    color: var(--text-color);
}

.card-content sub {
    font-size: 0.75em;
    vertical-align: sub;
}

.card-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.cloze {
    background: #eee;
    border-radius: 4px;
    padding: 0 4px;
    cursor: pointer;
    color: transparent;
    transition: all 0.2s;
    user-select: none;
}

.cloze.revealed {
    background: transparent;
    color: var(--accent-color);
    font-weight: 600;
}

.answer-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
    display: none;
}

.answer-section.visible {
    display: block;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

.btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn:hover {
    background: #f5f5f5;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #0873c4;
}

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

.breadcrumbs {
    font-size: 0.9rem;
    color: var(--secondary-text);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumbs a {
    color: var(--accent-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.related-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.related-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.related-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    display: block;
}

.related-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Footer and Site Description */
.site-description {
    text-align: center;
    max-width: 600px;
    margin: 3rem auto;
    color: var(--secondary-text);
    font-size: 1rem;
}

footer {
    margin-top: auto;
    width: 100%;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    background-color: #f8f9fa;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.footer-content a {
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-content a:hover {
    opacity: 0.8;
}

