:root {
  color-scheme: dark;
  --background: #141310;
  --surface: #1c1a16;
  --field: #151410;
  --text: #f4efe5;
  --muted: #c5bdae;
  --border: #514a3d;
  --gold: #e6b66b;
  --gold-hover: #f3c882;
  --error: #ffada5;
  --success: #a5dcb2;
  font-family: "Instrument Sans", Inter, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 80% 0, #2d2418 0, transparent 36rem), var(--background);
  color: var(--text);
  line-height: 1.55;
}

a { color: inherit; }
button, input, textarea { font: inherit; }
h1, h2, h3, p { margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.frame { width: min(100% - 3rem, 68rem); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  flex-wrap: wrap;
  min-height: 4.75rem;
  padding-block: .65rem;
}

.wordmark, .quiet-link { text-decoration: none; }
.wordmark { display: inline-flex; align-items: center; }
.wordmark img {
  display: block;
  width: clamp(8.25rem, 17vw, 12.25rem);
  height: auto;
}

.quiet-link { color: var(--muted); font-size: .9rem; }
.quiet-link:hover { color: var(--gold); }

main { flex: 1; }
.intro { margin-block: clamp(2.15rem, 6vw, 5rem) clamp(1.65rem, 4vw, 3rem); }

h1 {
  margin-bottom: .45rem;
  font-size: clamp(2.25rem, 6.25vw, 4.4rem);
  font-weight: 720;
  letter-spacing: -.05em;
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.intro p { max-width: 38rem; color: var(--muted); font-size: clamp(1rem, 2.1vw, 1.18rem); }
.header-links { display: flex; align-items: center; gap: .25rem 1rem; }
.admin-grid { display: grid; gap: 1rem; align-items: start; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.admin-full, .code-panel { grid-column: 1 / -1; }

.panel {
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: var(--surface);
  padding: clamp(1.15rem, 3.5vw, 2rem);
}

.code-panel { border-color: #8a673e; }
.panel h2 { color: var(--text); font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.2; letter-spacing: -.02em; }
.panel-description { color: var(--muted); margin-top: .45rem; }
.form-stack { display: grid; gap: .45rem; margin-top: 1.35rem; }
.form-stack label { color: var(--text); font-size: .94rem; font-weight: 650; }
.form-stack label:not(:first-child) { margin-top: .45rem; }
.label-note { color: var(--muted); font-weight: 400; }

input, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: .38rem;
  background: var(--field);
  color: var(--text);
}

textarea { resize: vertical; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
input:focus-visible, textarea:focus-visible { outline-offset: 1px; }
#invite-code, #new-code { font-family: "IBM Plex Mono", Consolas, ui-monospace, monospace; font-weight: 600; letter-spacing: .05em; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .58rem;
  min-height: 2.75rem;
  padding: .63rem .94rem;
  border: 1px solid transparent;
  border-radius: .4rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.form-stack .button { margin-top: .5rem; }
.button.primary { background: var(--gold); color: #201608; }
.button.primary:hover:not(:disabled) { background: var(--gold-hover); }
.button.secondary { border-color: #9b794d; background: transparent; color: var(--gold); }
.button.secondary:hover:not(:disabled), .button.tertiary:hover:not(:disabled) { background: #342a1c; }
.button.tertiary { background: transparent; color: var(--muted); }
.button.compact { justify-self: start; font-size: .9rem; }


.feedback { margin-top: .55rem; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.feedback:empty { margin: 0; }
.feedback[data-tone="error"] { color: var(--error); }
.feedback[data-tone="success"] { color: var(--success); }
:is(#admin-status, #logout-result):not(:empty) { margin-bottom: 1rem; }

.admin-intro, .panel-header { display: flex; justify-content: space-between; align-items: start; gap: .8rem 1.15rem; }
.code-actions { display: flex; align-items: stretch; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.code-actions input { width: auto; flex: 1 1 15rem; }
.records { display: grid; gap: .65rem; margin-top: .9rem; }
.record { padding: .85rem; border: 1px solid var(--border); border-radius: .45rem; background: var(--field); }
.record h3 { line-height: 1.35; font-size: 1.02rem; overflow-wrap: anywhere; }
.record-meta { color: var(--muted); font-size: .89rem; overflow-wrap: anywhere; }
.record-message { margin-top: .35rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.record-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .65rem; margin-top: .6rem; }
.record-actions label { font-size: .9rem; }
.record-actions input { width: 4.65rem; }
.record-actions .button { font-size: .88rem; }
.record-state { margin-top: .35rem; color: var(--gold); font-size: .88rem; }
.empty-state { font-size: .93rem; color: var(--muted); }

.site-footer {
  margin-top: clamp(2rem, 6vw, 4rem);
  padding-block: 1.15rem 1.45rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .84rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.portal-public {
  --background: #111315;
  --surface: #191c1f;
  --field: #141719;
  --text: #f2f0e9;
  --muted: #b4b9bf;
  --border: #34393f;
  --border-strong: #555d67;
  --gold: #d1ad59;
  --gold-hover: #e2c57d;
  --gold-text: #d8b96d;
  --gold-line: #6a5730;
  background: var(--background);
}

.portal-public .frame { width: min(100% - 4rem, 86.25rem); }

.portal-public .quiet-link {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
}

.portal-public .quiet-link:hover { color: var(--gold); }

.portal-public .intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  margin-block: clamp(2rem, 4.2vw, 3.15rem) clamp(1.65rem, 3.2vw, 2.4rem);
}

.portal-public .section-eyebrow {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.1rem;
  color: var(--gold-text);
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .16em;
}

.section-eyebrow::before { content: ""; flex: none; width: 1.6rem; height: 1px; background: var(--gold); }

.portal-public .intro h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 4.2vw, 3.7rem);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1.08;
}

.portal-public .intro h1 em { color: var(--gold-text); }

.intro-description {
  width: min(38%, 19.5rem);
  padding-left: clamp(.95rem, 2.2vw, 1.9rem);
  border-left: 1px solid var(--gold-line);
}

.portal-public .intro-description p { font-size: .875rem; line-height: 1.65; text-wrap: pretty; }
.portal-public .intro-description p:first-child { color: var(--text); font-size: 1.125rem; margin-bottom: .75rem; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
}

.section-card-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.55rem 1.45rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: var(--surface);
  transition: border-color .18s, transform .18s;
}

.section-card-featured { border-color: var(--gold-line); background: linear-gradient(150deg, #282318, var(--surface) 43%); }

.section-card-shell:hover,
.section-card-shell:focus-within {
  border-color: var(--gold);
  transform: translateY(-3px);
}

.section-card-icon {
  flex: none;
  margin-bottom: 1.4rem;
  color: var(--gold-text);
}

.section-card-shell .section-card-type {
  color: #a1a8b0;
  font-size: .65rem;
  font-weight: 650;
  letter-spacing: .1em;
  margin: 0 0 .55rem;
  text-transform: uppercase;
}

.section-card-title {
  margin-bottom: .75rem;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.section-card-description {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.7;
  min-height: 4.15rem;
  margin-bottom: 1.3rem;
  text-wrap: pretty;
}

.section-card-features {
  display: grid;
  gap: .65rem;
  margin: 0 0 1.45rem;
  padding: 0;
  list-style: none;
  color: #d9dadd;
  font-size: .82rem;
}

.section-card-features li { display: flex; align-items: baseline; gap: .65rem; }
.section-card-features li::before {
  content: "";
  width: .36rem;
  height: .6rem;
  margin-inline: .15rem .2rem;
  flex: none;
  border-right: 1.5px solid var(--gold-text);
  border-bottom: 1.5px solid var(--gold-text);
  transform: rotate(45deg) translateY(-.12rem);
}

.section-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  min-height: 2.95rem;
  margin-top: auto;
  padding: .65rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: .3rem;
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  font-weight: 650;
  text-align: start;
  transition: background-color .18s, color .18s;
}

.section-card::after { content: ""; position: absolute; inset: 0; border-radius: .65rem; }
.section-card-featured .section-card,
.section-card:hover { color: #171819; background: var(--gold); border-color: var(--gold); }
.section-card-featured .section-card:hover { background: var(--gold-hover); }

.independence-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem 2rem;
  padding: 1.7rem 0 1.25rem;
  margin: 0;
  list-style: none;
  color: var(--muted);
  font-size: .81rem;
}

.independence-strip li { display: inline-flex; align-items: center; gap: .5rem; }
.independence-strip svg { color: var(--gold-text); flex: none; }
.portal-public .site-footer { margin-top: clamp(1.15rem, 2.8vw, 2.35rem); }

.portal-arrow {
  position: relative;
  display: inline-block;
  width: .7em;
  height: .7em;
  flex: none;
  background: linear-gradient(135deg, transparent calc(50% - .65px), currentColor calc(50% - .65px), currentColor calc(50% + .65px), transparent calc(50% + .65px));
}
.portal-arrow::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: .44em;
  height: .44em;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}
.section-card .portal-arrow { font-size: 1rem; }

.access-dialog {
  width: min(100% - 2rem, 29rem);
  max-height: calc(100% - 2rem);
  border-color: var(--gold-line);
  color: var(--text);
  padding: clamp(1.2rem, 4vw, 1.8rem);
  overflow: auto;
}

.access-dialog::backdrop { background: rgb(9 11 13 / 74%); }
.access-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.access-heading h2 { font-size: clamp(1.3rem, 3.4vw, 1.72rem); overflow-wrap: anywhere; }
.access-close {
  display: grid;
  place-items: center;
  flex: 0 0 2.75rem;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .4rem;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
}
.access-close:hover { border-color: var(--gold); color: var(--gold); }
.access-choices { display: grid; gap: .65rem; margin-top: .7rem; }
.access-panel { margin-top: 1rem; }
.access-panel h3 { font-size: 1.05rem; }
.access-panel .form-stack { margin-top: 1rem; }
#access-back { margin-top: .55rem; padding-inline: .4rem; }

@media (max-width: 68.75rem) {
  .section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-card-description { min-height: 2.9rem; }
}

@media (max-width: 46rem) {
  .frame { width: min(100% - 2rem, 68rem); }
  .admin-grid { grid-template-columns: 1fr; }
  .panel-header, .admin-intro { flex-wrap: wrap; }
}

@media (max-width: 40rem) {
  .portal-public .frame { width: calc(100% - 2rem); }
  .portal-public .intro { align-items: flex-start; flex-direction: column; gap: 1.25rem; }
  .intro-description { width: 100%; }
  .portal-public .intro-description p:first-child { font-size: 1rem; margin-bottom: .4rem; }
  .section-grid { grid-template-columns: 1fr; gap: .85rem; }
  .section-card-shell { padding: 1.4rem; }
  .section-card-icon { margin-bottom: 1rem; }
  .section-card-description { min-height: 0; margin-bottom: 1rem; }
  .independence-strip { gap: .65rem 1rem; font-size: .74rem; }
}

@media (prefers-reduced-motion: reduce) {
  .section-card-shell, .section-card { transition: none; }
  .section-card-shell:hover, .section-card-shell:focus-within { transform: none; }
}

.portal-language { flex: none; }
.portal-language select {
  min-height: 2.75rem;
  max-width: 100%;
  padding: .4rem .5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: .4rem;
  font: inherit;
  cursor: pointer;
}
.portal-public .access-heading { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: .6rem; }
@media (max-width: 30rem) {
  .portal-public .header-links { flex-wrap: wrap; gap: .4rem .75rem; }
  .portal-public .access-heading { grid-template-columns: minmax(0,1fr) auto; }
  .portal-public .access-heading h2 { grid-column: 1; grid-row: 1; }
  .portal-public .access-close { grid-column: 2; grid-row: 1; }
  .portal-public .access-heading .portal-language { grid-column: 1 / -1; }
}

.wordmark .product-name { margin-inline-start: .85rem; padding-inline-start: .85rem; border-inline-start: 1px solid var(--border); color: var(--gold); font-size: 1rem; font-weight: 600; }
.portal-public .site-footer { display:flex; align-items:center; flex-wrap:wrap; gap:.75rem 2rem; justify-content:space-between; }
.site-footer a { text-underline-offset:.2em; }
@media (max-width: 40rem) {
  .header-content { row-gap:.55rem; }
  .header-links { flex-wrap:wrap; }
}

@media screen and (min-width:70rem) {
  .portal-public .frame { width:calc(100% - 2 * clamp(2rem,3vw,5rem)); max-width:150rem; }
  .portal-public .intro { gap:clamp(2rem,4vw,5rem); }
  .portal-public .intro-description { width:clamp(20rem,28%,32rem); }
  .portal-public .intro h1 { font-size:clamp(3.4rem,3.65vw,5rem); }
  .portal-public .intro-description p { font-size:1rem; }
  .portal-public .intro-description p:first-child { font-size:1.2rem; }
  .section-grid { gap:clamp(1.1rem,1.35vw,2.25rem); }
  .section-card-shell { padding:clamp(1.5rem,1.6vw,2.4rem); }
  .section-card-title { font-size:clamp(1.45rem,1.35vw,2rem); }
  .section-card-description, .section-card-features { font-size:1rem; max-width:55ch; }
  .section-card-features li, .section-card { font-size:1rem; }
  .section-card-shell .section-card-type { font-size:.78rem; }
}
