:root {
    --header-bg: #202122;
    --header-text: #f5f5f5;
    --accent: #3366CC;
    --accent-hover: #3366CC;
    --link: #0645ad;
    --link-visited: #0b0080;
    --body-bg: #f8f9fa;
    --content-bg: #ffffff;
    --border: #A2A9B1;
    --border-light: #53595D;
    --text: #202122;
    --text-muted: #54595d;
    --infobox-bg: #f8f9fa;
    --success: #14866d;
    --error: #d73333;
    --font-serif: Georgia, "Linux Libertine", "Times New Roman", Times, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "Consolas", "Courier New", monospace;
    --radius: 2px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:visited {
    color: var(--link-visited);
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, .infobox-title {
    font-family: var(--font-serif);
    font-weight: normal;
    color: var(--text);
}

.container {
    width: min(1080px, 94vw);
    margin: 0 auto;
}

.mono {
    font-family: var(--mono);
    font-size: 0.85em;
}

.muted {
    color: var(--text-muted);
}

.block-meta {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* Header — Discogs-inspired dark bar */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--header-text);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.logo:hover {
    color: var(--accent);
    text-decoration: none;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--accent);
    color: #111;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 800;
}

.header-search {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid #444;
    border-radius: var(--radius);
    background: #2a2a2a;
    color: #fff;
    font-size: 0.9rem;
}

.header-search input:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}

.header-search input::placeholder {
    color: #999;
}

.autocomplete {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 200;
}

.autocomplete a {
    display: block;
    padding: 0.5rem 0.65rem;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
}

.autocomplete a:hover {
    background: #eaecf0;
    text-decoration: none;
}

.autocomplete .ac-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: #ccc;
    text-decoration: none;
}

.main-nav a:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-user {
    color: var(--accent);
    font-weight: 600;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* Main content — Wikipedia paper feel */
main {
    flex: 1;
    padding: 1.5rem 0 2.5rem;
}

main > .container,
main.container {
    background: var(--content-bg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.75rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
}

.lead, .lead-text {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.hero .lead {
    max-width: 36rem;
    margin: 0 auto 1rem;
}

.hero-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: var(--accent);
    color: #111;
    border: 1px solid #c45c00;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
}

.btn:hover {
    background: var(--accent-hover);
    color: #111;
    text-decoration: none;
}

.btn-secondary {
    background: #eaecf0;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #dadde3;
    color: var(--text);
}

.btn-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 0.35rem;
}

.btn-active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-link {
    background: none;
    border: none;
    color: var(--link);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    font-family: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-danger {
    color: var(--error);
}

/* Cards / catalog grid — Discogs list feel */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.card {
    display: block;
    background: #fff;
    border: 1px solid var(--border-light);
    padding: 0.85rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.1s;
}

.card:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.card h3 {
    font-family: var(--font-serif);
    margin: 0.35rem 0 0.4rem;
    font-size: 1rem;
    color: var(--link);
}

.card:hover h3 {
    text-decoration: underline;
}

.card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.card-meta {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: #333;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-muted {
    background: #eaecf0;
    color: var(--text-muted);
}

.tags, .infobox-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.tag {
    padding: 0.1rem 0.4rem;
    background: #eaecf0;
    border: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--link);
    text-decoration: none;
}

.tag:hover {
    background: #dadde3;
    text-decoration: none;
}

/* Sections */
.section {
    margin-top: 1.75rem;
}

.section h2 {
    font-size: 1.35rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.category-group {
    border: 1px solid var(--border-light);
    padding: 0.75rem;
    background: #fafbfc;
}

.category-name {
    font-weight: 700;
    color: var(--link);
}

.category-group ul {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
}

.vision-list {
    columns: 2;
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0;
}

.vision-list li {
    padding: 0.2rem 0;
    color: var(--text-muted);
}

/* Browse */
.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}

.page-header.narrow,
.form-panel.narrow {
    max-width: 400px;
}

.browse-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .browse-layout {
        grid-template-columns: 1fr;
    }

    .infobox {
        float: none !important;
        width: 100% !important;
        margin: 0 0 1rem !important;
    }

    .vision-list {
        columns: 1;
    }
}

.sidebar {
    border: 1px solid var(--border-light);
    background: #fafbfc;
    padding: 0.75rem;
}

.sidebar h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    font-family: var(--font-sans);
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.filter-list a {
    display: block;
    padding: 0.2rem 0.35rem;
    color: var(--link);
    text-decoration: none;
}

.filter-list a.active {
    background: #eaf3ff;
    font-weight: 600;
}

.filter-list a:hover {
    background: #eaecf0;
    text-decoration: none;
}

.filter-list ul {
    list-style: none;
    padding-left: 0.75rem;
    margin: 0.15rem 0 0.35rem;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.result-count {
    color: var(--text-muted);
    margin-left: auto;
    font-size: 0.85rem;
}

/* Catalog table — Discogs release list */
.catalog-table-wrap {
    overflow-x: auto;
}

.catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.catalog-table th,
.catalog-table td {
    border: 1px solid var(--border-light);
    padding: 0.5rem 0.65rem;
    text-align: left;
}

.catalog-table th {
    background: #eaecf0;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.catalog-table tr:nth-child(even) {
    background: #fafbfc;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell form {
    display: inline;
    margin-right: 0.25rem;
}

/* Item page — Wikipedia article + infobox */
.item-page .item-title h1 {
    font-size: 1.9rem;
    margin: 0;
    border: none;
}

.item-alt-name {
    color: var(--text-muted);
    margin: 0.15rem 0 0;
    font-style: italic;
}

.item-layout {
    overflow: hidden;
}

.item-body {
    overflow: hidden;
}

.infobox {
    float: right;
    width: 280px;
    margin: 0 0 1rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--infobox-bg);
    font-size: 0.85rem;
    box-shadow: var(--shadow);
}

.infobox-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.5rem;
    background: #ddd;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.infobox-list {
    margin: 0;
    padding: 0.5rem 0.65rem;
}

.infobox-list dt {
    font-weight: 700;
    color: var(--text);
    margin-top: 0.35rem;
}

.infobox-list dd {
    margin: 0.1rem 0 0.35rem;
}

.infobox-actions {
    padding: 0.5rem 0.65rem 0.75rem;
    border-top: 1px solid var(--border-light);
}

.infobox-select {
    width: 100%;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    padding: 0.25rem;
}

.detail-section {
    margin-bottom: 1.5rem;
    clear: none;
}

.detail-section h2 {
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.15rem;
    margin: 0 0 0.5rem;
}

.detail-section h3 {
    font-size: 0.95rem;
    margin: 0.5rem 0 0.25rem;
    font-family: var(--font-sans);
}

.spec-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}

.spec-list dt {
    font-weight: 600;
    color: var(--text-muted);
}

.spec-list dd {
    margin: 0;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.spec-table th,
.spec-table td {
    border: 1px solid var(--border-light);
    padding: 0.35rem 0.6rem;
    text-align: left;
}

.spec-table th {
    background: #eaecf0;
    width: 35%;
    font-weight: 600;
}

.link-list {
    margin: 0;
    padding-left: 1.25rem;
}

.inline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.inline-list li:not(:last-child)::after {
    content: " · ";
    color: var(--text-muted);
}

/* Comments */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.comment {
    border-bottom: 1px solid var(--border-light);
    padding: 0.65rem 0;
}

.comment-meta {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.comment-form {
    margin-top: 0.75rem;
}

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.collections-list li {
    margin-bottom: 0.75rem;
}

.panel-title {
    font-size: 1rem;
    margin: 0 0 0.75rem;
    font-family: var(--font-serif);
}

/* Forms */
.panel {
    background: #fafbfc;
    border: 1px solid var(--border-light);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.form-panel {
    margin-top: 0.5rem;
}

.form-row {
    margin-bottom: 0.75rem;
}

.form-row label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: var(--radius);
}

.form-row textarea.mono {
    font-family: var(--mono);
    font-size: 0.82rem;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: 2px solid var(--link);
    border-color: var(--link);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0 0.75rem;
}

fieldset {
    border: 1px solid var(--border-light);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

legend {
    padding: 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.required {
    color: var(--error);
}

.form-footer {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Alerts */
.flash {
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.flash-success {
    color: var(--success);
}

.flash-error {
    color: var(--error);
}

.alert {
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.75rem;
    border: 1px solid;
}

.alert-error {
    background: #fee7e6;
    border-color: #f5a9a5;
    color: var(--error);
}

.empty-state {
    padding: 1.5rem;
    color: var(--text-muted);
    text-align: center;
}

.empty-state.centered {
    padding: 3rem 1rem;
}

.empty-state h1 {
    font-size: 2.5rem;
    color: var(--text-muted);
}

/* Footer */
.site-footer {
    background: var(--header-bg);
    color: #999;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 0.82rem;
    border-top: 3px solid var(--accent);
}

.site-footer p {
    margin: 0.15rem 0;
}

.site-footer a {
    color: var(--accent);
}

/* Rules page */
.rules-section {
    margin-bottom: 2rem;
}

.rules-section h2 {
    font-size: 1.35rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
}

.rules-field {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.rules-field h3 {
    font-size: 1rem;
    margin: 0 0 0.35rem;
    font-family: var(--font-sans);
}

.rules-field p {
    margin: 0.35rem 0;
}

.rules-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* Form example links & images */
.example-link {
    font-size: 0.8rem;
    font-weight: normal;
    margin-left: 0.5rem;
}

.image-fieldset {
    margin-top: 1rem;
}

.image-manager-title {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    font-family: var(--font-sans);
}

.image-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.image-item {
    border: 1px solid var(--border-light);
    padding: 0.5rem;
    background: #fff;
}

.image-thumb {
    display: block;
    width: 100%;
    height: 100px;
    object-fit: contain;
    background: #f0f0f0;
    margin-bottom: 0.35rem;
}

.image-visibility {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.image-visibility input {
    margin-top: 0.15rem;
}

/* Item page gallery */
.infobox-gallery {
    border-bottom: 1px solid var(--border-light);
    background: #fff;
}

.infobox-figure {
    margin: 0;
    padding: 0.5rem;
    text-align: center;
}

.infobox-figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.form-row label code,
.rules-field code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: #eaecf0;
    padding: 0.1rem 0.3rem;
}
