/* Klonoa: Empire of Dreams — Decompilation Research Site */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-code: #0d1117;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-heading: #f0f0ff;
    --accent: #e94560;
    --accent-secondary: #f0a050;
    --link: #64b5f6;
    --link-hover: #90caf9;
    --border: #2a2a4a;
    --table-header: #1a2744;
    --table-row-alt: #141e33;
    --mono: "Fira Mono", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
    --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
}

/* Navigation */
nav {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

nav .site-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

nav .nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

nav .nav-links a {
    color: var(--link);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

nav .nav-links a:hover,
nav .nav-links a.active {
    background: var(--bg-tertiary);
    color: var(--link-hover);
}

/* Main content */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

h1 {
    font-size: 2rem;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--accent-secondary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}

h3 {
    font-size: 1.2rem;
    color: var(--text-heading);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Progress bar */
.progress-container {
    margin: 1.5rem 0 2rem;
}

.progress-bar-bg {
    background: var(--bg-code);
    border-radius: 8px;
    height: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    height: 100%;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    min-width: 60px;
}

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

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

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 2rem;
    font-size: 0.9rem;
    overflow-x: auto;
    display: block;
}

@media (min-width: 800px) {
    table {
        display: table;
    }
}

thead th {
    background: var(--table-header);
    color: var(--text-heading);
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
    white-space: nowrap;
}

tbody td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

tbody tr:nth-child(even) {
    background: var(--table-row-alt);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Monospace cells for addresses, hex values */
.mono {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

td.mono {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

/* Code blocks */
pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
}

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--bg-code);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--accent-secondary);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Syntax colors in code blocks */
.kw { color: #c792ea; }
.ty { color: #82aaff; }
.nu { color: #f78c6c; }
.cm { color: #546e7a; }
.st { color: #c3e88d; }
.fn { color: #ffcb6b; }

/* Section cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.1s;
}

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

.card h3 {
    margin-top: 0;
    color: var(--accent);
}

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

/* Lists */
ul, ol {
    margin: 0.5rem 0 1.5rem 1.5rem;
}

li {
    margin-bottom: 0.3rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ROM Picker */
.rom-picker-box {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}

.rom-picker-box h2 {
    border: none;
    margin-top: 0;
    color: var(--text-heading);
}

.rom-drop-zone {
    margin: 1.5rem 0 1rem;
    padding: 2.5rem 1.5rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.rom-drop-zone:hover,
.rom-drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.05);
}

.rom-drop-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.rom-error {
    color: var(--accent);
    font-size: 0.9rem;
    min-height: 1.4em;
}

.rom-status-loaded {
    margin-left: auto;
    color: #4caf50;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.rom-clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.rom-clear-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    nav {
        padding: 0.6rem 1rem;
        gap: 0.8rem;
    }

    .container {
        padding: 1.2rem 1rem 3rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}
