:root {
    --ink: #17120e;
    --brown: #9a6231;
    --pink: #ef7d96;
    --paper: #fffdfa;
    --line: #26201b;
    --muted: #6d6259;
    --link: #003399;
}

* { box-sizing: border-box; }
html { background: #f2f0eb; }
body {
    margin: 0;
    color: var(--ink);
    background: #fff;
    font-family: "Times New Roman", Times, serif;
    font-size: 15px;
}
a { color: var(--link); }
a:visited { color: #551a8b; }
button, input, select, textarea { font: inherit; }
.site-shell { width: min(980px, calc(100% - 20px)); margin: 0 auto; min-height: 100vh; background: #fff; }
.site-header {
    min-height: 135px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 8px 10px;
}
.brand { display: inline-flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--brown); min-width: 210px; }
.brand:visited { color: var(--brown); }
.brand-rule { width: 130px; border-top: 3px solid var(--pink); margin-top: 6px; }
.brand strong { font: bold 17px Arial, sans-serif; }
.hero-tagline { font: bold 18px Arial, sans-serif; color: #6c3b23; }
.hero-intro { max-width: 720px; margin-left: auto !important; margin-right: auto !important; line-height: 1.35; }
.top-links { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; font-family: Arial, sans-serif; font-size: 13px; padding-top: 10px; }
.button, button, input[type="submit"] {
    display: inline-block; border: 1px solid #888; border-radius: 2px; background: linear-gradient(#fff, #ddd); color: #111;
    padding: 4px 10px; text-decoration: none; cursor: pointer;
}
.button:visited { color: #111; }
.button.primary { font-weight: bold; }
.button.danger, button.danger { background: #f5d6d6; border-color: #9e4a4a; color: #6a0000; }
.hero {
    border: 1px solid #b9a994;
    background: #fff9ee;
    text-align: center;
    padding: 18px 15px;
    margin: 0 0 18px;
}
.hero h1 { margin: 0 0 5px; font: bold 26px Arial, sans-serif; color: var(--brown); }
.hero p { margin: 5px 0; }
.stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 24px; margin-top: 12px; font-family: Arial, sans-serif; }
.stats b { font-size: 18px; display: block; color: #7b3f27; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.toolbar form { display: flex; align-items: end; flex-wrap: wrap; gap: 6px; }
.toolbar label { display: flex; flex-direction: column; gap: 2px; }
.archive-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}
.archive-card {
    min-width: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 4px;
    background: #fff;
}
.archive-card h2 { font-size: 15px; margin: 0 0 4px; line-height: 1.1; overflow-wrap: anywhere; }
.archive-card .thumb-wrap { display: block; background: #eee; border: 0; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; }
.archive-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; align-items: center; margin-top: 4px; white-space: nowrap; font-size: 13px; }
.card-stats span { text-align: center; }
.empty-state { padding: 35px; text-align: center; border: 1px solid #888; }
.pager { display: flex; justify-content: center; gap: 10px; padding: 14px; }
.panel { border: 1px solid #777; background: var(--paper); padding: 14px; margin: 0 auto 18px; max-width: 720px; }
.panel h1, .panel h2 { font-family: Arial, sans-serif; color: #6c3b23; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-weight: bold; margin-bottom: 3px; }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="password"], .form-row input[type="datetime-local"], .form-row textarea, .form-row select {
    width: 100%; max-width: 520px; border: 1px solid #777; padding: 6px; background: #fff;
}
.form-row textarea { min-height: 100px; }
.rules-box { border: 1px dashed #9a6231; background: #fff7e9; padding: 10px 18px; white-space: pre-line; }
.error-list, .flash.error { border: 1px solid #a30000; background: #ffecec; color: #700; padding: 8px; }
.flash.success { border: 1px solid #467a34; background: #efffe9; color: #27521b; padding: 8px; }
.flash { margin: 0 0 12px; }
.error-text { color: #a30000; font-weight: bold; }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
.post-image { border: 1px solid #444; background: #eee; text-align: center; }
.post-image img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.post-sidebar { border: 1px solid #777; padding: 10px; align-self: start; }
.vote-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.comments { margin-top: 18px; }
.comment { border-top: 1px solid #aaa; padding: 8px 0; }
.comment-meta { color: var(--muted); font-size: 13px; }
.admin-nav { border: 1px solid #777; padding: 8px; margin-bottom: 12px; background: #f2eee5; }
.admin-table { width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 13px; }
.admin-table th, .admin-table td { border: 1px solid #777; padding: 5px; text-align: left; vertical-align: top; }
.admin-table th { background: #e9e2d6; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.site-footer { border-top: 1px solid #bbb; margin-top: 26px; padding: 16px 6px 28px; text-align: center; color: #5d554e; font-size: 13px; }
.mini { font-size: 12px; color: var(--muted); }

@media (max-width: 820px) {
    .archive-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .post-layout { grid-template-columns: 1fr; }
    .post-sidebar { width: 100%; }
}
@media (max-width: 560px) {
    .site-header { min-height: auto; flex-direction: column; align-items: center; }
    .top-links { justify-content: center; padding-top: 0; }
    .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toolbar { align-items: stretch; flex-direction: column; }
}

/* Inline SVG icon system */
.icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    vertical-align: -0.14em;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.button, button, input[type="submit"], .top-links a, .pager a, .post-sidebar a, .admin-nav a {
    align-items: center;
    gap: 5px;
}
.button, button, input[type="submit"] { display: inline-flex; }
.top-links a, .pager a, .post-sidebar a, .admin-nav a { display: inline-flex; }
.brand-logo {
    display: block;
    width: auto;
    max-width: 230px;
    height: auto;
    max-height: 82px;
    border: 0;
}
.brand-text { font: bold 17px Arial, sans-serif; }
.card-stats span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.card-stats .icon { width: 14px; height: 14px; }
.pager a { white-space: nowrap; }
.post-sidebar p > a { align-items: flex-start; }
.admin-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 14px;
}
.admin-nav a { white-space: nowrap; }


/* v1.3 icon sizing fix. Keep every inline SVG inside its intended text row. */
svg.icon {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    flex: 0 0 14px !important;
    vertical-align: -2px !important;
    overflow: visible;
}
.card-stats svg.icon {
    width: 12px !important;
    height: 12px !important;
    min-width: 12px !important;
    min-height: 12px !important;
    max-width: 12px !important;
    max-height: 12px !important;
    flex-basis: 12px !important;
}
.vote-row svg.icon,
.post-sidebar svg.icon,
.pager svg.icon,
.admin-nav svg.icon,
.admin-table svg.icon {
    width: 13px !important;
    height: 13px !important;
    min-width: 13px !important;
    min-height: 13px !important;
    max-width: 13px !important;
    max-height: 13px !important;
    flex-basis: 13px !important;
}
.admin-nav a,
.post-sidebar a,
.vote-row button,
.card-stats span {
    line-height: 1.2;
}

/* v1.4 administrator bulk uploader */
.admin-dashboard-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.bulk-upload-form small,
.form-note {
    display: block;
    margin-top: 4px;
    color: #555;
    font-size: 12px;
}
.bulk-summary {
    margin: 12px 0;
    padding: 9px 10px;
    border: 1px solid #5d9d5d;
    background: #effbef;
}
.bulk-summary.has-errors {
    border-color: #b88b44;
    background: #fff7e8;
}
.result-ok {
    color: #146614;
    font-weight: bold;
}
.result-error {
    color: #a00000;
    font-weight: bold;
}
.admin-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 10px 0 18px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th,
.admin-table td {
    border: 1px solid #777;
    padding: 6px;
    text-align: left;
    vertical-align: top;
}
.admin-table th {
    background: #eee;
}

/* v1.5 duplicate image confirmation and administrator scanner */
.duplicate-warning {
    border: 2px solid #a65a00;
    background: #fff6dc;
    padding: 14px;
    margin: 12px 0;
}
.duplicate-warning h2 { margin-top: 0; }
.duplicate-compare {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0;
}
.duplicate-compare figure {
    margin: 0;
    min-width: 0;
    border: 1px solid #777;
    background: #fff;
    padding: 7px;
    text-align: center;
}
.duplicate-compare img {
    display: block;
    width: 100%;
    height: 320px;
    object-fit: contain;
    background: #111;
}
.duplicate-compare figcaption {
    margin-top: 7px;
    overflow-wrap: anywhere;
}
.duplicate-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.duplicate-actions form { margin: 0; }
button.secondary, .button.secondary {
    background: #eee;
    border-color: #777;
}
.duplicate-scan-form { margin: 14px 0 4px; }
.duplicate-scan-form button:disabled {
    cursor: not-allowed;
    opacity: .65;
}
.duplicate-pair-list {
    display: grid;
    gap: 14px;
}
.duplicate-pair {
    border: 1px solid #777;
    background: #f8f8f8;
    padding: 10px;
}
.duplicate-pair > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid #aaa;
    padding-bottom: 7px;
}
.duplicate-pair .duplicate-compare { margin-bottom: 0; }
.duplicate-pair .duplicate-compare img { height: 260px; }

@media (max-width: 680px) {
    .duplicate-compare { grid-template-columns: 1fr; }
    .duplicate-compare img,
    .duplicate-pair .duplicate-compare img { height: 260px; }
}
