:root {
    --green: #2f6f4f;
    --green-dark: #21503a;
    --amber: #b5651d;
    --red: #a3372b;
    --ink: #23291f;
    --muted: #5c6656;
    --paper: #fbfaf6;
    --card: #ffffff;
    --line: #e2e2d8;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.5;
    overflow-wrap: break-word;
}

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--green-dark); }

.site-header {
    background: var(--green);
    color: #fff;
    padding: 20px 0;
}
.site-header .brand {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
}
.site-header .tagline {
    margin: 2px 0 14px;
    color: #dcefe1;
    font-size: 0.95rem;
}
.header-search { display: flex; gap: 8px; max-width: 480px; }
.header-search input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
}
.header-search button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: var(--green-dark);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

main.wrap { padding-top: 24px; padding-bottom: 60px; min-height: 60vh; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 600; }
.flash-success { background: #e2f3e6; color: var(--green-dark); border: 1px solid #b9ddc2; }
.flash-error { background: #fbe7e4; color: var(--red); border: 1px solid #f0c3bc; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

h1 { font-size: 1.8rem; margin: 0 0 4px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }

.muted { color: var(--muted); }
.reference-badge {
    display: inline-block;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: 0.03em;
}

.lookup-box { text-align: center; padding: 40px 20px; }
.lookup-box form { display: flex; gap: 10px; max-width: 420px; margin: 18px auto 0; }
.lookup-box input {
    flex: 1;
    padding: 12px 14px;
    font-size: 1.05rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.lookup-box button, .btn {
    padding: 12px 20px;
    font-size: 1.05rem;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
.btn:hover, .lookup-box button:hover { background: var(--green-dark); }
.btn-secondary { background: var(--card); color: var(--green-dark); border: 1px solid var(--green); }
.btn-secondary:hover { background: #eef6f0; }

.park-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.park-list li {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.park-list li > div { min-width: 0; }
.park-list a.park-name { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.park-list .loc { color: var(--muted); font-size: 0.9rem; }

.rating-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: #fff6e6;
    border: 1px solid #f0d9a8;
    color: var(--amber);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.95rem;
    white-space: nowrap;
}
.rating-pill .out-of { font-weight: 500; font-size: 0.8rem; color: #8a5f22; }
.rating-pill.empty { color: var(--muted); background: #f2f2ee; border-color: var(--line); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.meta-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.meta-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; vertical-align: top; width: 40%; }
.meta-table td { padding: 6px 0; overflow-wrap: anywhere; word-break: break-word; }

.feature-tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.feature-tags li {
    background: #eef6f0;
    border: 1px solid #cde4d3;
    color: var(--green-dark);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.88rem;
}
.feature-tags.caution li {
    background: #fdeee9;
    border-color: #f0c3ac;
    color: #8a3b1f;
}

.notes-block { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.notes-block:empty::before,
.notes-block.is-empty::before { content: "Nothing added yet."; color: var(--muted); font-style: italic; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo-grid img { width: 100%; height: 140px; object-fit: cover; display: block; cursor: zoom-in; }
.photo-grid figcaption { padding: 8px 10px; font-size: 0.85rem; color: var(--muted); }

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 18, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    z-index: 1000;
}
.lightbox-overlay[hidden] { display: none; }
.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
body.lightbox-open { overflow: hidden; }

form.stacked label { display: block; font-weight: 600; margin: 14px 0 6px; }
form.stacked input[type=text],
form.stacked input[type=number],
form.stacked textarea,
form.stacked select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}
form.stacked textarea { min-height: 90px; resize: vertical; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 6px; }
.checkbox-grid label { font-weight: 400; margin: 0; display: flex; align-items: center; gap: 8px; }
.checkbox-grid.caution label { color: #8a3b1f; }

.rating-scale { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rating-scale label {
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: 6px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
}
.rating-scale input { position: absolute; opacity: 0; pointer-events: none; }
.rating-scale input:checked + label { background: var(--green); color: #fff; border-color: var(--green); }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.rating-list { list-style: none; padding: 0; margin: 0; }
.rating-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.rating-list li:first-child { border-top: none; }
.rating-list .rl-score { font-weight: 700; color: var(--amber); }
.rating-list .rl-meta { color: var(--muted); font-size: 0.85rem; }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: 0.85rem; }

.empty-state { text-align: center; padding: 30px; color: var(--muted); }

details > summary {
    cursor: pointer;
    color: var(--green-dark);
    font-weight: 600;
    list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "\25B6"; display: inline-block; font-size: 0.7em; margin-right: 6px; }
details[open] > summary::before { content: "\25BC"; }

.history-list { list-style: none; padding: 0; margin: 14px 0 0; }
.history-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.history-list li:first-child { border-top: none; }
.history-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.history-field { font-weight: 600; color: var(--ink); }
.history-list p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
