:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172d2a;
  background: #f3f7f5;
  line-height: 1.5;
  --ink: #172d2a;
  --muted: #516661;
  --line: #d8e5df;
  --brand: #106052;
  --brand-dark: #0b493e;
  --light: #e8f5ee;
  --error: #a32c25;
  --radius: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; margin: 0; }
body > main { flex: 1; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 750; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
input, select, button { font: inherit; }
:focus-visible { outline: 3px solid #3b8d7b; outline-offset: 3px; }
.container { width: min(100% - 3rem, 78rem); margin-inline: auto; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4.25rem; gap: 1rem; }
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; min-height: 4rem; padding-block: .55rem; color: var(--muted); font-size: .875rem; }
.footer-inner .footer-link { display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: 0; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: var(--brand); }
.brand-mark span { position: relative; width: .9rem; height: .9rem; border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: translateY(-.1rem) rotate(-45deg); }
.brand-mark span::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: #fff; }

.page-heading { margin: 2.6rem 0 1.55rem; }
.page-heading p, .compact-panel > p { margin-top: .55rem; color: var(--muted); }
.page-status { margin: 3rem auto; max-width: 32rem; text-align: center; color: var(--muted); }
.notice { padding: .85rem 1rem; background: var(--light); border: 1px solid #c7e5d7; border-radius: .65rem; color: #1a5043; font-size: .875rem; }
.notice strong { margin-inline-end: .35rem; }
#local-notice { margin-bottom: 1rem; }

.workspace { display: grid; grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr); gap: 1rem; padding-bottom: 3rem; align-items: start; }
.sidebar { display: grid; gap: 1rem; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 3px 14px #172d2a08; min-width: 0; }
.sidebar-panel { padding: 1.25rem; }
.sidebar-panel > h2 { margin-bottom: 1rem; }
.stack { display: grid; gap: .55rem; }
.stack > label ~ label { margin-top: .35rem; }
label { font-size: .875rem; font-weight: 650; }
input, select { width: 100%; min-width: 0; min-height: 2.75rem; padding: .56rem .7rem; background: #fff; border: 1px solid #b9cec5; border-radius: .55rem; color: var(--ink); }
input::placeholder { color: #637772; }
input[readonly] { background: #f8fbf9; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-inline-end: 2rem; }
.select-wrap::after { position: absolute; content: ''; right: 1rem; top: 1rem; width: .48rem; height: .48rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.stack > .button { margin-top: .4rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 2.75rem; padding: .52rem .85rem; border: 1px solid transparent; border-radius: .55rem; font-size: .875rem; font-weight: 650; line-height: 1.35; cursor: pointer; }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { color: #fff; background: var(--brand); }
.button-primary:hover:not(:disabled) { background: var(--brand-dark); }
.button-secondary { color: var(--brand-dark); border-color: #b9cec5; background: #fff; }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: var(--light); }
.button-quiet { color: var(--brand-dark); background: transparent; }
.button-danger { color: #fff; background: var(--error); }
.button-danger:hover { background: #84251f; }

.link-list { display: grid; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.saved-link { display: flex; align-items: center; justify-content: space-between; gap: .65rem; width: 100%; min-height: 2.75rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .55rem; background: #fff; color: var(--ink); text-align: left; cursor: pointer; font-size: .875rem; }
.saved-link:hover, .saved-link[aria-current] { background: var(--light); border-color: #bddbcb; }
.saved-link[aria-current] { box-shadow: inset 3px 0 var(--brand); }
.saved-title { min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.saved-status { color: var(--muted); font-size: .8125rem; }

.report { padding: clamp(1rem, 2.5vw, 1.5rem); }
.report-top, .activity-heading, .share-footer { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.report-top { margin-bottom: 1.2rem; align-items: start; }
.report-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
#report-title { font-size: clamp(1.3rem, 3vw, 1.75rem); }
.report-heading > p { margin-top: .3rem; }
.muted { color: var(--muted); font-size: .875rem; }
.status-pill { padding: .22rem .58rem; border-radius: 10rem; background: #edf0ee; color: #52625d; font-size: .8125rem; font-weight: 700; }
.status-pill[data-status="active"] { background: #dff4e8; color: #195441; }

.share-box { display: grid; gap: .4rem; padding: .85rem; background: #f4f8f6; border: 1px solid var(--line); border-radius: .75rem; }
.share-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.share-field input { font-family: ui-monospace, Consolas, monospace; font-size: .875rem; }
.close-button { color: var(--error); min-height: 2rem; padding-block: .3rem; white-space: nowrap; }
.close-button:hover:not(:disabled) { background: #fff0ed; }
.message { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.message:empty { display: none; }
.message.error, #fatal { color: var(--error); }
.message.success { color: #21654e; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: 1rem 0 1.35rem; }
.metrics > div { min-width: 0; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .7rem; }
.metrics dt { color: var(--muted); font-size: .875rem; line-height: 1.25; }
.metrics dd { color: var(--brand-dark); font-size: clamp(1.25rem, 3.2vw, 2rem); font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.activity-heading { margin-bottom: .55rem; }
#report-message:not(:empty) { margin: .45rem 0; }
.blank-state { display: grid; place-content: center; justify-items: center; gap: .35rem; min-height: 7.5rem; padding: .85rem; text-align: center; background: #f8fbf9; border: 1px dashed #c6dcd2; border-radius: .75rem; }
.blank-state p { color: var(--muted); font-size: .875rem; }
.no-link { min-height: 20rem; }
.state-mark { display: grid; place-items: center; margin-bottom: .45rem; width: 2.6rem; height: 2.6rem; color: var(--brand-dark); background: var(--light); border-radius: .7rem; font-size: 1.3rem; }

.table-wrap { border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: .65rem; vertical-align: top; overflow-wrap: anywhere; }
th { background: #f3f8f5; color: #38534b; font-weight: 650; }
th:nth-child(2) { width: 35%; }
td { border-top: 1px solid var(--line); }
td > span, td > a { display: block; }
.subtle { color: var(--muted); font-size: .8125rem; }
.ip-address { font-family: ui-monospace, Consolas, monospace; font-weight: 650; }
.text-link { color: var(--brand-dark); font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; margin-top: .25rem; }
.text-link:hover { color: #08735e; }
.ip-address.text-link { margin-top: 0; }
.lookup-links { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.lookup-link { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; max-width: 100%; padding: .32rem .46rem; min-height: 2rem; border: 1px solid var(--line); border-radius: .45rem; background: #fff; color: var(--brand-dark); font-size: .8125rem; font-weight: 650; line-height: 1.25; text-decoration: none; }
.lookup-link:hover { border-color: #b9cec5; background: var(--light); text-decoration: underline; }
.lookup-link img { flex: none; object-fit: contain; }
.lookup-link span { min-width: 0; overflow-wrap: anywhere; }
.load-more { margin-top: .75rem; }

.standalone { width: min(100%, 34rem); margin: clamp(1.35rem, 7vw, 4rem) auto; }
.compact-panel { padding: clamp(1.15rem, 5vw, 2rem); }
.compact-panel h1 { font-size: clamp(1.8rem, 4vw, 2.45rem); }
.compact-panel form { margin-top: 1.1rem; }
.member-page { max-width: 62rem; padding-block: clamp(1.25rem, 4vw, 3rem) 3rem; margin-inline: auto; }
#member-title { margin-bottom: 1.05rem; }
#member-status:not(:empty) { margin-top: .75rem; }
.privacy-policy { max-width: 44rem; margin: clamp(1.25rem, 4vw, 3rem) auto; padding: clamp(1.15rem, 4vw, 2.25rem); }
.privacy-policy h1 { font-size: clamp(1.8rem, 4.5vw, 2.75rem); }
.privacy-policy h2 { margin-top: 1.35rem; }
.privacy-policy p { margin-top: .5rem; color: var(--muted); }
.memories { margin-bottom: 1.15rem; padding: clamp(1rem, 3vw, 1.4rem); }
.memory-form { display: grid; gap: .45rem; margin-top: .85rem; }
.memory-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; }
.memory-actions input { font-size: .875rem; }
#memory-status:not(:empty) { margin-top: .65rem; }
.friendship-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.friendship-grid figure { margin: 0; overflow: hidden; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.memory-photo-link { display: block; }
.memory-photo-link:focus-visible { outline-offset: -4px; }
.friendship-grid img, .friendship-grid video { display: block; width: 100%; height: auto; background: #263c32; }
.friendship-grid img { aspect-ratio: 3 / 2; object-fit: cover; }
.friendship-grid .friendship-portrait { object-position: center 18%; }
.friendship-grid video { aspect-ratio: 16 / 9; object-fit: contain; }

dialog { width: min(100% - 2rem, 26rem); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; color: var(--ink); }
dialog::backdrop { background: #112b2685; }
dialog p { color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: .55rem; }

@media (max-width: 58rem) {
  .workspace { grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); }
}

@media (max-width: 47rem) {
  .container { width: calc(100% - 1.5rem); }
  .page-heading { margin-top: 1.65rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .no-link { min-height: 10rem; }
}

@media (max-width: 34rem) {
  .sidebar { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .header-inner { min-height: 3.75rem; }
  .share-field { grid-template-columns: minmax(0, 1fr); }
  .share-footer { flex-wrap: wrap; gap: .2rem; }
  .metrics { gap: .35rem; }
  .metrics > div { padding: .6rem .45rem; }
  .metrics dt { font-size: .8125rem; }
  .table-wrap { border: 0; overflow: visible; }
  table, tbody, tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  tbody { display: grid; gap: .55rem; }
  tbody tr { border: 1px solid var(--line); border-radius: .65rem; padding: .35rem .6rem; }
  td { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); gap: .12rem .3rem; padding: .4rem 0; }
  td:first-child { border-top: 0; }
  td::before { content: attr(data-label); grid-column: 1; grid-row: 1; font-weight: 650; color: var(--muted); }
  td > * { grid-column: 2; }
  .lookup-link { min-height: 2.5rem; }
  .memory-actions { grid-template-columns: minmax(0, 1fr); }
  .friendship-grid { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
}
