@charset "UTF-8";

:root {
    /* main-color */
    --color-accent: #608a8a;
    --color-accent-hover: #4c7676;
    
    /* background */
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    
    /* text-color */
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    
    /* border */
    --color-border: rgba(0, 0, 0, 0.2);
    
    /* font */
    --font-main: 'Silkscreen', 'Noto Sans JP', sans-serif;
    
    /* layout */
    --container-width: 900px;
    --section-spacing: 4rem;

    /* specific for app */
    --tag-bg: rgba(96, 138, 138, 0.1);
    --tag-text: var(--color-accent);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    color: var(--color-text);
    background-color: var(--color-bg);
    text-align: center;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Header --- */
.header {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 3rem 1.5rem 1rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

body.study-active {
    /* Allow scrolling if content is taller than viewport on small devices */
}

body.study-active .header,
body.study-active .footer {
    display: none !important;
}

.header .container {
    display: flex;
    justify-content: flex-start;
    padding: 0;
}

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

.breadcrumb-item {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    text-decoration: none;
    font-family: var(--font-main);
    letter-spacing: normal;
}

/* --- Sections --- */
.section {
    padding: var(--section-spacing) 0;
}

.title-section {
    padding-top: 3rem;
    padding-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--color-accent);
    font-family: 'Silkscreen', 'Noto Sans JP', sans-serif;
}

hr.separator {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 3rem 0;
    width: 100%;
}

/* --- App Specific Content --- */
.view {
    display: none;
}
.view.active {
    display: block;
}

/* Hero Section */
.hero-section {
    padding: 3.5rem 0 2.5rem 0;
    text-align: center;
    background: linear-gradient(to bottom, #ffffff, #fdfdfd);
}

.hero-title {
    font-family: 'Silkscreen', sans-serif;
    font-size: 2.2rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero-progress-container {
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #ebedf0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--color-accent);
    width: 0%;
    transition: width 0.5s ease;
}

/* Dashboard Cards (similar to skill-item) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.mode-card {
    padding: 2rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.mode-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(96, 138, 138, 0.15);
    transform: translateY(-2px);
}

.mode-card h4 {
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    color: var(--color-accent);
}

.mode-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    flex-grow: 1;
}

.mode-stats {
    font-size: 0.75rem;
    color: var(--color-accent);
    background: var(--color-bg-alt);
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* Buttons (similar to link-item) */
.mode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    appearance: none;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 400;
    font-family: inherit;
    padding: 0.5rem 1.5rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    background-color: var(--color-accent);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(96, 138, 138, 0.3);
}

.btn-large {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    max-width: 300px;
}

/* Study View (Flashcard) */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.btn-text {
    border: none;
    padding: 0.5rem 1rem;
    color: var(--color-text-muted);
}
.btn-text:hover {
    background: none;
    color: var(--color-accent);
    box-shadow: none;
    border-color: transparent;
}

.flashcard {
    max-width: 600px;
    margin: 0 auto 2rem;
    padding: 3rem 2rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-tags {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.era-tag, .importance-tag {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.era-tag {
    background-color: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.importance-tag {
    background-color: #fff5f5;
    color: #e53e3e;
    border-color: #feb2b2;
}

.event-text {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.card-divider {
    border: 0;
    border-top: 1px dashed var(--color-border);
    margin: 2rem 0;
}

.year-text {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
}

.mnemonics-text {
    font-size: 1rem;
    color: var(--color-text-muted);
    line-height: 1.8;
}

.hidden {
    display: none !important;
}

/* Rating Controls */
.controls {
    max-width: 600px;
    margin: 0 auto;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.btn-rating {
    border-radius: 8px;
    padding: 1rem 0.5rem;
    flex-direction: column;
}

@media (max-width: 480px) {
    .rating-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn-rating {
        padding: 1.5rem 0.5rem;
    }
}

.btn-rating span {
    font-size: 0.9rem;
    font-weight: bold;
}

/* Map specific rating colors */
.btn-again { border-color: #cf222e; color: #cf222e; }
.btn-again:hover { background-color: #cf222e; color: #fff; box-shadow: 0 4px 12px rgba(207,34,46,0.3); }

.btn-hard { border-color: #bf8700; color: #bf8700; }
.btn-hard:hover { background-color: #bf8700; color: #fff; box-shadow: 0 4px 12px rgba(191,135,0,0.3); }

.btn-good { border-color: #2da44e; color: #2da44e; }
.btn-good:hover { background-color: #2da44e; color: #fff; box-shadow: 0 4px 12px rgba(45,164,78,0.3); }

.btn-easy { border-color: #0969da; color: #0969da; }
.btn-easy:hover { background-color: #0969da; color: #fff; box-shadow: 0 4px 12px rgba(9,105,218,0.3); }


/* Charts */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .chart-container {
        height: 150px;
    }
}

/* Activity Heatmap */
.heatmap-wrapper {
    overflow-x: auto;
    padding-bottom: 1rem;
    display: flex;
    margin-top: 3rem;
}

.heatmap-scroll-container {
    display: flex;
    flex-direction: column;
    min-width: max-content;
}

.heatmap-months {
    display: flex;
    margin-left: 36px; /* space for days labels + extra gap */
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    position: relative;
    height: 16px;
}

.heatmap-month-label {
    position: absolute;
    bottom: 0;
}

.heatmap-body {
    display: flex;
    gap: 6px;
}

.heatmap-days {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    padding-top: 1px;
    padding-bottom: 1px;
    width: 30px;
    padding-right: 6px;
}

.heatmap-days span {
    height: 14px;
    line-height: 14px;
    text-align: right;
    display: block;
}

.heatmap-container {
    display: flex;
    gap: 3px;
}

.heatmap-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.heatmap-legend .heatmap-cell {
    margin: 0 1px;
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: #ebedf0; /* GitHub's exact empty cell color */
    border: 1px solid rgba(27, 31, 35, 0.06);
}

.heatmap-cell[data-level="1"] { background-color: #9be9a8; }
.heatmap-cell[data-level="2"] { background-color: #40c463; }
.heatmap-cell[data-level="3"] { background-color: #30a14e; }
.heatmap-cell[data-level="4"] { background-color: #216e39; }

/* --- Footer --- */
.footer {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 3rem 1.5rem;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* --- Loader --- */
#app-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#app-loader.hidden {
    opacity: 0;
    visibility: hidden;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-bg-alt);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loader-text {
    margin-top: 1.5rem;
    color: var(--color-text-muted);
    font-family: sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
