:root {
    --bg: #f2ece1;
    --surface: #fffaf2;
    --ink: #202327;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: #d5f6f2;
    --warn: #9f1239;
    --muted: #5b6470;
    --border: #d8ccbc;
    --shadow: 0 12px 30px -22px rgba(18, 31, 36, 0.55);
    --page-gutter: clamp(12px, 2vw, 24px);
    --layout-max: 1480px;
    --paper-grain: radial-gradient(circle at 20% 12%, rgba(130, 110, 80, 0.035) 0.6px, transparent 0.7px);
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --control-height: 40px;
    --focus-ring: 0 0 0 3px rgba(29, 154, 144, 0.24);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at top, #fff7ea, var(--bg));
    font-family: "Source Sans 3", "Segoe UI", Tahoma, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3, h4 { font-family: "Merriweather", Georgia, serif; line-height: 1.25; margin-top: 0; }
h1 { font-size: clamp(1.75rem, 1.2rem + 1.35vw, 2.35rem); }
h2 { font-size: clamp(1.3rem, 1.05rem + 0.75vw, 1.8rem); }
h3 { font-size: clamp(1.12rem, 0.98rem + 0.45vw, 1.35rem); }
.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 250, 242, 0.95);
    position: sticky;
    top: 0;
    padding: 14px 20px;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.site-header-inner {
    max-width: var(--layout-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--page-gutter);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.site-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    color: var(--ink);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.nav-avatar {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #fff;
}
.nav-link:hover {
    text-decoration: none;
    border-color: #bad8d5;
    background: #eef5f5;
}
.nav-link.is-active {
    border-color: var(--accent);
    color: #0f463f;
    background: var(--accent-soft);
}
.site-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.site-actions .btn {
    font-size: 13px;
    padding: 6px 10px;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #3a434f;
    background: #f3eee3;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 10px;
}
.user-chip-link:hover {
    text-decoration: none;
    border-color: #bad8d5;
    background: #eef5f5;
}
.user-role {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}
main {
    max-width: var(--layout-max);
    width: 100%;
    margin: 20px auto 60px;
    padding: 0 var(--page-gutter);
    flex: 1;
}
.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 250, 242, 0.9);
}
.site-footer-inner {
    max-width: var(--layout-max);
    width: 100%;
    margin: 0 auto;
    padding: 14px var(--page-gutter);
    color: var(--muted);
    font-size: 14px;
}
.site-footer-inner p {
    margin: 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.skip-link {
    position: absolute;
    left: 12px;
    top: -40px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    font-weight: 700;
    padding: 8px 10px;
    z-index: 50;
}
.skip-link:focus {
    top: 12px;
}
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}
.brand-link:hover { text-decoration: none; }
.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
}
.brand-name {
    font-weight: 700;
    letter-spacing: 0.01em;
}
.card {
    background:
        var(--paper-grain),
        linear-gradient(165deg, rgba(255, 255, 255, 0.84), rgba(250, 244, 233, 0.88)),
        var(--surface);
    background-size: 7px 7px, auto, auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.prose-card p,
.prose-card li {
    line-height: 1.6;
    max-width: 72ch;
}
.prose-card h2,
.prose-card h3 {
    margin-top: 18px;
    margin-bottom: 8px;
}
.prose-card ul,
.prose-card ol {
    padding-left: 18px;
}
.terms-card {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}
.terms-scroll {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 12px;
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.projects-existing-card { order: 0; }
.projects-editor-card { order: 1; }
@media (max-width: 899px) {
    .projects-existing-card,
    .projects-editor-card {
        order: initial;
    }
}
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.file-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 4px;
}
.file-picker-name {
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
    word-break: break-word;
}
table thead th.is-sortable {
    cursor: pointer;
    user-select: none;
}
table thead th.is-sortable::after {
    content: "  \2195";
    font-size: 0.85em;
    color: var(--muted);
}
table thead th.is-sortable.is-sorted-asc::after {
    content: "  \2191";
    color: var(--accent);
}
table thead th.is-sortable.is-sorted-desc::after {
    content: "  \2193";
    color: var(--accent);
}
.btn {
    appearance: none;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    min-height: var(--control-height);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 3px 10px -8px rgba(12, 76, 71, 0.5);
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 90ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 6px -5px rgba(12, 76, 71, 0.5); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: #eef5f5; }
.btn[disabled],
.btn.is-unlocked-disabled {
    cursor: not-allowed;
    opacity: 0.65;
    background: #9ca3af;
    border-color: #9ca3af;
    color: #ffffff;
}
.btn.secondary[disabled],
.btn.secondary.is-unlocked-disabled {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #4b5563;
}
.btn .bi {
    font-size: 0.95em;
    line-height: 1;
}
.muted { color: var(--muted); }
.hint {
    margin-top: 6px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}
.error { color: var(--warn); }
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: white;
}
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 640px; }
thead th {
    background: #f9f5ee;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
th, td { border-bottom: 1px solid var(--border); padding: 11px 12px; text-align: left; vertical-align: top; }
tbody tr:hover {
    background: #faf7f2;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff, #fdfbf8);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    min-height: var(--control-height);
    font-size: 15px;
    margin-top: 4px;
    margin-bottom: 12px;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
input:focus,
select:focus,
textarea:focus {
    border-color: #6ab5ad;
    box-shadow: var(--focus-ring);
    outline: none;
}
textarea {
    min-height: 84px;
}
.flash { padding: 12px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid transparent; }
.flash.error { background: #fde8ef; color: #9f1239; border-color: #f5bfd1; }
.flash.success { background: var(--accent-soft); color: #0f463f; border-color: #b9e8d8; }
.error-details {
    margin-top: 8px;
    color: #7a1535;
    font-size: 13px;
}
.error-details summary {
    cursor: pointer;
    font-weight: 700;
}
.error-details pre {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255, 255, 255, 0.75);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #eab8c8;
}
.inline { display: inline; }
.topnav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tab-nav {
    gap: 8px;
}
.tab-nav a {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
}
.tab-nav a:hover {
    text-decoration: none;
    background: #eef5f5;
    border-color: #bad8d5;
}
.tab-nav a.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #0f463f;
}
.admin-tabs {
    margin-top: 10px;
}
.settings-layout {
    display: grid;
    gap: 14px;
}
.settings-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 14px;
}
.settings-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
}
.settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.settings-confirm {
    margin-top: 14px;
}
.action-stack { display: grid; gap: 8px; }
.user-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.usage-open-btn {
    white-space: nowrap;
}
.usage-dialog {
    width: min(680px, calc(100vw - 24px));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: linear-gradient(160deg, #fffdf8, #f8f3ea);
    padding: 16px;
}
.usage-dialog::backdrop {
    background: rgba(21, 28, 36, 0.45);
}
.usage-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.usage-dialog-head h3 {
    margin: 0;
}
.usage-close-btn {
    white-space: nowrap;
}
.unlock-dialog {
    max-width: 560px;
}
.unlock-dialog .muted {
    margin: 8px 0 10px;
    line-height: 1.45;
}
.usage-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 10px;
}
.usage-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fffaf2;
    padding: 11px;
}
.usage-item strong {
    display: block;
    margin-top: 4px;
    font-size: 15px;
}
.usage-label {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 700;
}
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.inline-form select,
.inline-form input {
    width: auto;
    min-width: 100px;
    margin: 0;
}
.inline-form .credits-amount-input {
    min-width: 0;
    width: 10ch;
}
.project-image-preview {
    display: block;
    margin-top: 6px;
    width: 100%;
    max-width: 240px;
    max-height: 140px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.project-gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 6px;
}
.profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #fff;
}
.profile-avatar-fallback {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-menu .btn.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #0f463f;
}
.profile-panel-card {
    margin-top: 12px;
}
.profile-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.profile-panel-head h2 {
    margin: 0;
}
.profile-panel-body {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}
.wallet-bundle-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 14px;
    margin-top: 10px;
}
.wallet-bundle-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}
.wallet-bundle-content {
    min-width: 0;
}
.wallet-bundle-media {
    width: 420px;
    max-width: 58%;
}
.wallet-bundle-image {
    width: 100%;
    max-width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 10px;
    border: 0;
    background: transparent;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    display: block;
    filter: sepia(0.28) saturate(0.9) contrast(0.96);
}
.wallet-bundle-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.wallet-bundle-head h3 {
    margin: 0;
}
.wallet-bundle-actions {
    margin-top: 10px;
}
.wallet-success-card {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.wallet-shop-hero {
    background: linear-gradient(145deg, #fff5e7, #eaf8f6);
}
.wallet-impact-badge {
    margin: 8px 0 4px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    color: #0f4d45;
    background: linear-gradient(135deg, #e8f7ef, #f2fbf8);
    border: 1px solid #bfe8d8;
    border-radius: 999px;
    padding: 6px 12px;
}
.wallet-impact-badge .bi {
    color: #d6456b;
}
.wallet-shop-auth-note {
    margin-top: 6px;
    color: #1f3f3b;
    font-weight: 500;
}
.wallet-shop-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.wallet-shop-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(155deg, #fffefc, #f7f2e8);
    padding: 16px;
    box-shadow: var(--shadow);
}
.wallet-shop-card:nth-child(4n + 1) {
    background: linear-gradient(155deg, #fffefc, #f7f2e8);
}
.wallet-shop-card:nth-child(4n + 2) {
    background: linear-gradient(155deg, #fffdf6, #eef8f5);
}
.wallet-shop-card:nth-child(4n + 3) {
    background: linear-gradient(155deg, #fffdf8, #f1f4fb);
}
.wallet-shop-card:nth-child(4n + 4) {
    background: linear-gradient(155deg, #fffdf7, #f8f1f8);
}
.wallet-shop-image {
    width: auto;
    max-width: 100%;
    height: 190px;
    object-fit: contain;
    border-radius: 10px;
    border: 0;
    background: transparent;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    display: block;
    filter: sepia(0.3) saturate(0.88) contrast(0.95);
}
.wallet-shop-image-top {
    margin: 0 auto 10px;
}
.wallet-image-fade-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.wallet-image-fade-wrap.wallet-shop-image-top {
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.wallet-image-fade-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 52%, rgba(247, 242, 232, 0.82) 100%);
}
.wallet-shop-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.wallet-shop-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.wallet-preferred-pill {
    background: #fff4cf;
    color: #7a5a00;
}
.wallet-shop-card-head h2 {
    margin: 0;
    font-size: 20px;
}
.wallet-shop-price {
    margin: 10px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.wallet-shop-price-text {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}
.wallet-shop-credits-main {
    font-size: 17px;
    font-weight: 650;
    color: var(--ink);
}
.wallet-shop-price-tail {
    font-size: 16px;
    font-weight: 500;
    color: var(--muted);
}
.wallet-save-badge {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: #0c6a57;
    background: #e7f7f0;
    border: 1px solid #b9e8d8;
    border-radius: 999px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}
.wallet-save-line {
    margin: 2px 0 8px;
    font-size: 13px;
    color: #0c6a57;
    font-weight: 700;
}
.wallet-inline-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
    margin-top: 6px;
}
.wallet-shop-list {
    margin: 0 0 12px;
    padding-left: 18px;
    color: var(--muted);
}
.wallet-shop-list li {
    font-style: normal;
    color: var(--ink);
}
.wallet-hint-section {
    margin: 10px 0;
    padding: 9px 10px;
    border: 1px solid #d2e7e3;
    border-left: 3px solid #7ab8ae;
    border-radius: 9px;
    background: linear-gradient(170deg, #fbfdfc, #f3faf8);
}
.wallet-hint-section + .wallet-hint-section {
    margin-top: 8px;
}
.wallet-hint-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #0b5f59;
}
.wallet-hint-line {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.45;
    color: #314946;
}
.wallet-hint-line:last-child {
    margin-bottom: 0;
}
.compact { margin: 0; }
.compact input, .compact select { margin-bottom: 8px; }
.compact label { display: block; font-size: 14px; }
.input-3digits {
    width: 8ch;
    min-width: 8ch;
    max-width: 8ch;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: #edf6f5;
    color: #0f766e;
}
.pill.warn { background: #fde8ef; color: #9f1239; }
:focus-visible {
    outline: 3px solid #1d9a90;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Home */
.project-hero {
    background: linear-gradient(140deg, #fff7ea, #f2fbfa 55%, #e9f5f7);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.project-hero h1 { margin-bottom: 8px; }
.project-hero p {
    margin: 0;
    max-width: 980px;
    font-size: 16px;
}
.about-hero {
    background: linear-gradient(140deg, #fff7ea, #f2fbfa 55%, #e9f5f7);
}
.about-blurb-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}
.about-hero-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.about-logo {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 10px 24px -18px rgba(15, 68, 78, 0.55);
}
.hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}
.hero-brand-text h1 {
    margin: 0 0 6px;
}
.hero-brand img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px -18px rgba(15, 68, 78, 0.55);
    background: #fff;
}
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}
.project-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: grid;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
    animation: card-enter 520ms ease both;
    animation-delay: 0ms;
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: #b8d8d4;
    box-shadow: 0 20px 32px -24px rgba(15, 68, 78, 0.45);
}
.project-media {
    position: relative;
    aspect-ratio: 3 / 2;
    max-height: 320px;
    background: radial-gradient(circle at 15% 20%, #b6ece7, #7ab7c1 52%, #2f6f78);
    border-bottom: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.project-media img {
    width: 100%;
    height: 100%;
    max-height: 320px;
    border-radius: inherit;
    object-fit: cover;
    display: block;
    transition: transform 360ms ease;
}
.project-card:hover .project-media img { transform: scale(1.06); }
.project-badge {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(15, 118, 110, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.project-body {
    padding: 14px;
    display: grid;
    gap: 10px;
}
.project-body h2 { margin: 0; font-size: 21px; }
.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.project-excerpt {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
}
.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.project-grid .project-card:nth-child(2) { animation-delay: 80ms; }
.project-grid .project-card:nth-child(3) { animation-delay: 160ms; }
.project-grid .project-card:nth-child(4) { animation-delay: 240ms; }
.project-grid .project-card:nth-child(5) { animation-delay: 320ms; }
.project-grid .project-card:nth-child(6) { animation-delay: 400ms; }
@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.project-detail {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    padding: 0;
}
.project-detail-media {
    aspect-ratio: 16 / 6;
    height: auto;
    max-height: 340px;
    background: radial-gradient(circle at 20% 20%, #a8e3dd, #6f9db5 48%, #2f4e6d);
    border-bottom: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.project-detail-media img {
    width: 100%;
    height: 100%;
    max-height: 340px;
    border-radius: inherit;
    object-fit: cover;
    display: block;
}
.project-detail-carousel {
    position: relative;
    width: 100%;
    height: clamp(220px, 36vw, 380px);
    border-bottom: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: radial-gradient(circle at 20% 20%, #a8e3dd, #6f9db5 48%, #2f4e6d);
}
.project-detail-slide {
    position: absolute;
    inset: 0;
    display: none;
    margin: 0;
}
.project-detail-slide.is-active {
    display: block;
}
.project-detail-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.project-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 2;
    padding: 8px 10px;
}
.project-carousel-prev {
    left: 10px;
}
.project-carousel-next {
    right: 10px;
}
.project-carousel-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.project-detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    background: #fdfaf5;
}
.project-detail-gallery img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
}
.project-detail-body {
    padding: 18px;
}
.project-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.project-content {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
    margin-bottom: 14px;
}

/* Search */
.search-shell { display: grid; gap: 14px; }
.search-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.search-panel {
    background: linear-gradient(145deg, #fffaf2, #eef9f8);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}
.search-title {
    margin-bottom: 12px;
}
.search-notes {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}
.search-form-wrap {
    margin-top: 16px;
    border: 1px solid #cfe1de;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f6fbfa 68%);
    box-shadow: 0 10px 24px -18px rgba(14, 64, 64, 0.5);
    padding: 12px;
}
.search-grid {
    display: grid;
    gap: 10px 16px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    align-items: start;
}
.search-field-row {
    display: grid;
    grid-template-columns: minmax(150px, max-content) minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}
.search-field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.25;
    white-space: nowrap;
}
.search-field-input {
    width: 100%;
    max-width: calc(var(--search-field-ch, 24) * 1ch + 2.6rem);
}
.search-date-input {
    width: 100%;
    max-width: 13rem;
}
.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5f3;
    color: #0f5f58;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}
.search-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.result-main {
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.result-meta {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.result-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}
.pager .btn {
    min-width: 38px;
    padding: 7px 10px;
}
.pager .btn[disabled] {
    cursor: default;
    opacity: 0.55;
}
.result-row-active {
    background: #eef8f7;
}
.table-wrap tr[data-result-row] {
    cursor: pointer;
}
.table-wrap tr[data-result-row]:hover {
    background: #f3faf8;
}
.table-wrap tr[data-record-href] {
    cursor: pointer;
}
.table-wrap tr[data-record-href]:hover,
.table-wrap tr[data-record-href]:focus-visible {
    background: #f3faf8;
}

/* Record page */
.record-shell {
    display: grid;
    gap: 16px;
}
.record-header {
    background: linear-gradient(120deg, #fffaf2, #f2fbfa);
}
.record-project-name {
    margin: 4px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.meta-line {
    margin: 0;
}
.meta-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.meta-value {
    color: var(--ink);
    font-weight: 700;
}
.record-project-label {
    display: block;
    margin-right: 2px;
}
.record-project-value {
    font-size: 18px;
    letter-spacing: 0.005em;
}
.record-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.record-content {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.45fr);
    align-items: start;
}
.record-media {
    position: sticky;
    top: 94px;
}
.record-media-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.record-media-actions h3 {
    margin-bottom: 10px;
}
.unlock-firework-piece {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    pointer-events: none;
    z-index: 70;
    animation: unlock-firework-burst 900ms ease-out forwards;
}
@keyframes unlock-firework-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0.35) rotate(var(--rot));
    }
}
.section-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background:
        var(--paper-grain),
        linear-gradient(168deg, rgba(255, 255, 255, 0.95), rgba(253, 248, 239, 0.9)),
        #fff;
    background-size: 7px 7px, auto, auto;
    padding: 14px;
    margin-bottom: 12px;
}
.section-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
}
.kv-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.kv-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: #fffefc;
    min-height: 0;
}
.kv-item.locked {
    background: #f8f4ed;
}
.kv-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 2px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.kv-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}
.kv-head .kv-label {
    margin-bottom: 0;
}
.kv-head .pill {
    margin: 0;
    white-space: nowrap;
}
.kv-value {
    font-size: 15px;
    line-height: 1.25;
    word-break: break-word;
}
.kv-locked-note {
    display: inline-block;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.2;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kv-locked-visual {
    border: 1px dashed #ccb58f;
    border-radius: 999px;
    padding: 4px 6px;
    margin-bottom: 4px;
    background-image: repeating-linear-gradient(
        -45deg,
        #f4e8d6,
        #f4e8d6 6px,
        #faefe0 6px,
        #faefe0 12px
    );
}
.kv-locked-visual .skeleton-line {
    height: 7px;
    margin-bottom: 0;
}
.locked-skeleton {
    border: 1px dashed #ccb58f;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    background-image: repeating-linear-gradient(
        -45deg,
        #f4e8d6,
        #f4e8d6 6px,
        #faefe0 6px,
        #faefe0 12px
    );
}
.skeleton-line {
    display: block;
    height: 9px;
    border-radius: 999px;
    margin-bottom: 7px;
    background: linear-gradient(90deg, #e8ddcc 25%, #f6ebdc 50%, #e8ddcc 75%);
    background-size: 220% 100%;
    animation: skeleton-wave 1.1s ease-in-out infinite;
}
.skeleton-line:last-child {
    margin-bottom: 0;
}
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-45 { width: 45%; }
@keyframes skeleton-wave {
    0% { background-position: 180% 0; }
    100% { background-position: -20% 0; }
}
.kv-meta {
    margin-top: 4px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.carousel-frame {
    position: relative;
    width: 100%;
    min-height: clamp(300px, 50vh, 620px);
    padding: 4px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #c9d9d8;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(238, 248, 246, 0.9)),
        #f7f2e9;
    box-shadow:
        0 16px 34px -22px rgba(15, 118, 110, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.carousel-slide {
    position: absolute;
    inset: 4px;
    display: none;
}
.carousel-slide.active {
    display: block;
}
.carousel-zoom-surface {
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}
.carousel-zoom-surface:active {
    cursor: grabbing;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    user-select: none;
    background: #ffffff;
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.5);
}
.carousel-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
    color: var(--muted);
    background: linear-gradient(160deg, #f7f0e4, #efe5d4);
}
.carousel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
}
.carousel-caption {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}
.carousel-zoom-controls {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.carousel-placeholder-icon {
    font-size: 28px;
    margin: 0 0 8px;
}
.carousel-placeholder-title {
    margin: 0 0 6px;
}
.carousel-placeholder-text {
    margin: 0;
}
.action-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.action-grid-unlocks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.action-grid form {
    margin: 0;
}
.action-grid .btn {
    width: 100%;
    justify-content: center;
}
.action-grid-unlocks .btn {
    font-size: 13px;
    padding: 8px 10px;
}
.action-grid-secondary {
    margin-top: 10px;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.action-grid-secondary .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
}
.mt-12 {
    margin-top: 12px;
}
.mt-10 {
    margin-top: 10px;
}
.mb-10 {
    margin-bottom: 10px;
}
.is-hidden {
    display: none !important;
}
.portal-pagination {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.portal-pagination-summary {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}
.portal-pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.portal-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.portal-page-link:hover {
    text-decoration: none;
    background: #eef5f5;
    border-color: #bad8d5;
}
.portal-page-link.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #0f463f;
}
.portal-page-link.is-disabled {
    opacity: 0.55;
    cursor: default;
}

/* Policy editor */
.policy-editor {
    display: grid;
    gap: 14px;
}
.policy-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.policy-tab {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.policy-tab.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #0f463f;
}
.policy-panel {
    display: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 14px;
}
.policy-panel.is-active {
    display: block;
}
.policy-dual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}
.policy-dual {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fffefb;
    padding: 12px;
}
.policy-dual h3 {
    margin: 0 0 8px;
}
.policy-dual-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}
.policy-control-short input,
.policy-control-short select {
    max-width: 180px;
}
.policy-control-medium input,
.policy-control-medium select {
    max-width: 280px;
}
.policy-dual select {
    min-height: 220px;
    margin-bottom: 0;
}
.policy-cost-unlockable {
    width: 9ch;
    min-width: 9ch;
    max-width: 9ch;
}
.security-limit-grid label {
    display: grid;
}
.security-limit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.security-limit-grid input[type="number"] {
    width: 12ch;
    min-width: 12ch;
    max-width: 12ch;
}
.security-block-row {
    display: grid;
    grid-template-columns: minmax(180px, 300px) auto;
    align-items: end;
    gap: 10px;
}
.security-block-row input[name="ip_address"] {
    margin-bottom: 0;
}
.security-block-row .btn {
    margin-top: 0;
}
.security-subheading {
    font-size: 1rem;
    margin-top: 10px;
    margin-bottom: 6px;
}
.security-general-row {
    display: grid;
    grid-template-columns: minmax(0, 560px);
}
.security-general-row input {
    margin-bottom: 0;
}
.security-storage-input {
    max-width: 560px;
}
.security-general-save {
    margin-top: 12px;
}
.policy-transfer-buttons {
    display: grid;
    gap: 6px;
    align-content: center;
}
.policy-transfer-buttons .btn {
    white-space: nowrap;
}
.policy-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.bundle-row-selectable {
    cursor: pointer;
}
.bundle-row-selectable:hover {
    background: #f4f8f8;
}
.bundle-row-active {
    background: #eef8f7;
}
.bundle-thumb {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
}
.bundle-image-preview {
    margin: 4px 0 10px;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: #fff;
    max-width: 260px;
}
.bundle-image-preview-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.policy-footer {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .project-card {
        animation: none;
        transition: none;
    }
    .project-media img {
        transition: none;
    }
    .project-card:hover {
        transform: none;
    }
}
@media (max-width: 960px) {
    .record-content {
        grid-template-columns: 1fr;
    }
    .record-media {
        position: static;
    }
}
@media (max-width: 900px) {
    .about-blurb-grid {
        grid-template-columns: 1fr;
    }
    .search-grid {
        grid-template-columns: 1fr;
    }
    .search-field-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .search-field-input {
        max-width: none;
    }
    .search-date-input {
        max-width: none;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .result-main,
    .result-meta span {
        max-width: none;
    }
}
@media (max-width: 720px) {
    .site-header-inner {
        align-items: flex-start;
        flex-direction: column;
    }
    .site-header-right {
        width: 100%;
        align-items: flex-start;
        justify-content: flex-start;
    }
    .site-nav {
        width: 100%;
    }
    main { margin-top: 12px; }
    .card { padding: 14px; border-radius: 12px; }
    table { min-width: 540px; }
    .brand-logo { width: 40px; height: 40px; }
    .portal-pagination {
        align-items: flex-start;
        flex-direction: column;
    }
    .policy-dual-controls {
        grid-template-columns: 1fr;
    }
    .policy-transfer-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    table {
        min-width: 500px;
    }
    .project-hero {
        padding: 16px;
    }
    .hero-brand img {
        width: 58px;
        height: 58px;
        border-radius: 10px;
    }
    .project-media,
    .project-media img {
        max-height: 220px;
    }
    .project-detail-media,
    .project-detail-media img {
        max-height: 220px;
    }
    .project-detail-carousel {
        height: 220px;
    }
    .security-limit-grid {
        grid-template-columns: 1fr;
    }
    .action-grid,
    .action-grid-secondary {
        grid-template-columns: 1fr;
    }
    .wallet-bundle-main {
        grid-template-columns: 1fr;
    }
    .wallet-bundle-media {
        width: 100%;
        max-width: 100%;
    }
    .wallet-shop-image {
        height: 180px;
    }
    .kv-grid {
        grid-template-columns: 1fr;
    }
}
