/* ==========================================================================
   Nameless — member portal
   Builds on styles.css (tokens, buttons, .frame, team colors, roster table).
   ========================================================================== */

:root {
  --head-avatar: 72px;
}

html.has-dialog { overflow: hidden; } /* keeps the page still behind an open dialog (iOS Safari) */

/* ---------------- Header ---------------- */
.site-header--solid {
  background: rgba(11, 16, 40, 0.82);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom-color: var(--line);
}
.portal-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.portal-divider { width: 1px; height: 24px; background: var(--line); }
.portal-label {
  font-family: var(--font-label); font-weight: 500;
  font-size: 0.95rem; letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}
.portal-actions { display: flex; align-items: center; gap: 12px; }
/* The account menu and avatars are in styles.css: the home page's header has them too */
.avatar--lg { --size: var(--head-avatar); }

/* ---------------- Page shell ---------------- */
.portal {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--header-h) + 40px) 0 72px;
}
.portal::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 35% at 90% 0%, rgba(91, 29, 158, 0.18), transparent 70%),
    linear-gradient(rgba(217, 164, 110, 0.045) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(217, 164, 110, 0.045) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 100%);
  mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 100%);
}
.portal-container { position: relative; z-index: 1; }

/* Identity */
.portal-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
}
.portal-id { display: flex; align-items: center; gap: 20px; min-width: 0; }
.portal-avatar { position: relative; flex: none; }
.portal-avatar .avatar { box-shadow: 0 0 0 1.5px var(--gold), 0 0 18px rgba(181, 124, 255, 0.35); }
.portal-avatar::after {
  /* small violet stud on the bottom edge, like the crest's gems */
  content: "";
  position: absolute; left: 50%; bottom: -5px;
  width: 9px; height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #E9D6FF 0%, var(--violet-glow) 35%, var(--violet) 65%, var(--violet-deep) 100%);
  box-shadow: 0 0 0 1px rgba(217, 164, 110, 0.7), 0 0 10px 1px rgba(181, 124, 255, 0.55);
}
.portal-id-text { min-width: 0; }
.portal-id-text .eyebrow { flex-wrap: wrap; margin-bottom: 8px; }
.portal-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0.03em;
  background: var(--gold-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.portal-handle {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.portal-handle .icon { width: 15px; height: 15px; }
.portal-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  font-family: var(--font-label); font-weight: 500;
  font-size: 0.98rem; letter-spacing: 0.05em;
  color: var(--text-muted);
}
.portal-stats[hidden] { display: none; }
.portal-stats a { color: inherit; text-decoration: none; text-underline-offset: 4px; }
.portal-stats a:hover { color: var(--gold-100); text-decoration: underline; }
.portal-stats-sep { color: var(--text-faint); }

/* ---------------- Up next ---------------- */
.portal-upnext { margin: 36px 0 56px; }
.portal-upnext .next-raid { margin-bottom: 0; }
.next-raid-as {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 12px;
}
.next-raid-as-label, .team-spot-label {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.75rem; letter-spacing: 0.16em;
  color: var(--text-muted);
}
.next-raid-as-name { font-weight: 500; color: var(--gold-100); }
.next-raid-note { margin-top: 6px; font-size: 0.95rem; color: var(--text-muted); }
.next-raid--empty .next-raid-name { color: var(--gold-100); }

/* Getting started (new member) */
.portal-start { padding: clamp(24px, 4vw, 36px); }
.portal-start-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: var(--gold-100);
}
.steps--compact { margin: 28px 0 28px; gap: 16px; }
.steps--compact::before { top: 18px; }
.steps--compact .step-node { width: 36px; height: 36px; margin-bottom: 12px; font-size: 0.85rem; }
.steps--compact h3 { font-size: 1.1rem; }
.steps--compact p { font-size: 0.95rem; }
.steps--compact .is-later .step-node { background: linear-gradient(var(--line-strong), var(--line-strong)) var(--navy-700); color: var(--text); }
.portal-start .steps li { background: none; }
/* Raids hidden: step I on its own, in line with the card's title and button */
.steps--compact:has(> li:only-child) { grid-template-columns: minmax(0, 1fr); text-align: left; }
.steps--compact:has(> li:only-child)::before { display: none; }
.steps--compact:has(> li:only-child) .step-node { margin-left: 0; }

/* Sign-in needed or failed (Supabase): shown in place of the portal */
.portal-signin { max-width: 560px; margin: clamp(16px, 6vh, 64px) auto 0; text-align: center; }
.portal-signin .eyebrow { justify-content: center; }
.portal-signin-text { margin: 12px 0 24px; color: var(--text-muted); }
.portal-signin-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------------- Sections ---------------- */
.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px;
  align-items: start;
}
/* Raids hidden (the admin portal's Show/Hide Raids): Characters takes the full width, its cards side by
   side, and keeps the Next raid box's space below the page head */
.portal-grid:has(> #raids[hidden]) { grid-template-columns: minmax(0, 1fr); }
.portal-upnext[hidden] + .signup-cta[hidden] + .portal-grid { margin-top: 36px; }
.portal-section-head { margin-bottom: 24px; }
.portal-section-head .eyebrow { margin-bottom: 10px; }
.portal-section-head--row {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 16px;
}
.portal-title {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: 0.03em;
  color: var(--gold-100);
}
.portal-section-head .section-sub { margin-top: 8px; }
.count-pill {
  display: inline-grid; place-items: center;
  min-width: 1.9em;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  background: rgba(217, 164, 110, 0.16);
  color: var(--gold-300);
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.04em;
  line-height: 1.4;
}
.count-pill[hidden] { display: none; }
.portal-empty-line { color: var(--text-muted); font-style: italic; }

/* ---------------- Team cards (quieter cousins of the home panels) ---------------- */
.team-cards { display: grid; gap: 20px; }
.team-card {
  container-type: inline-size;
  border-color: rgba(var(--team-rgb), 0.35);
  /* base at 90% (same tones pre-blended), so the page grid shows faintly through */
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(var(--team-rgb), 0.1), transparent 65%),
    linear-gradient(180deg, rgba(36, 49, 101, 0.9), rgba(20, 29, 64, 0.9));
}
.team-card::before { --c: var(--team-glow); --l: 10px; }
.team-card .team-head { padding: 18px 22px 14px; border-bottom: 0; }
.team-card .team-gem { width: 14px; height: 14px; }
.team-card .team-name { font-size: 1.4rem; }

.team-spot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 0 16px;
  padding: 10px 12px;
  border-radius: 3px;
  background: rgba(var(--team-rgb), 0.1);
  box-shadow: inset 2px 0 0 var(--team);
}
.team-spot-name { font-weight: 500; color: var(--gold-100); }
.team-spot-spec { color: var(--text-muted); font-size: 0.95rem; }
.team-spot-standing { margin-left: auto; }

.team-card .team-nights { padding: 12px 16px 0; }
.team-card .night { padding: 10px 12px; }
@container (min-width: 520px) {
  .team-card .team-nights { grid-template-columns: 1fr 1fr; }
}
.team-card .team-next { padding: 14px 22px 0; }
.team-card .night--empty { color: var(--text-muted); }
.team-card .roster { margin: 14px 22px 22px; }

/* The viewer's own rows in a roster */
.roster-table tr.is-you th, .roster-table tr.is-you td { background: rgba(var(--team-rgb, 217, 164, 110), 0.14); }
.roster-table tr.is-you th { box-shadow: inset 3px 0 0 var(--team-glow, var(--gold)); }
.roster-table tr.is-you .member-name { font-weight: 700; color: var(--gold-100); }
.you-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  border: 1px solid rgba(181, 124, 255, 0.45);
  background: rgba(139, 63, 224, 0.25);
  color: #D9BEFF;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.65rem; letter-spacing: 0.08em;
  font-style: normal;
  vertical-align: 0.1em;
}


/* ---------------- Characters ---------------- */
.char-list { display: grid; gap: 12px; }
.char-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  padding: 14px 16px 14px 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.7);
  box-shadow: inset 3px 0 0 var(--class-color, var(--gold));
  transition: box-shadow 0.4s, border-color 0.4s;
}
.char-card.is-new {
  animation: char-glow 1.6s var(--ease-out);
}
@keyframes char-glow {
  0% { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--class-color), 0 0 0 1px var(--gold), 0 0 28px -4px rgba(217, 164, 110, 0.7); }
  100% { border-color: var(--line); box-shadow: inset 3px 0 0 var(--class-color), 0 0 0 0 transparent; }
}
.char-body { display: grid; gap: 4px; min-width: 0; }
.char-name {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold-100);
}
.char-name:focus-visible { outline-offset: 4px; }
.char-line { color: var(--text-muted); font-size: 0.95rem; }
.char-role { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 0.95rem; }
.char-profs { color: var(--text-muted); font-size: 0.9rem; }
.char-profs.is-empty { font-style: italic; color: var(--text-muted); }
.char-teams { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.team-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0.25em 0.65em;
  border: 1px solid rgba(var(--team-rgb), 0.4);
  border-radius: 999px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.team-chip .team-gem { width: 8px; height: 8px; margin: 0 1px; box-shadow: 0 0 0 1px var(--gold); }
.char-edit {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 8, 13, 0.3);
  color: var(--gold-300);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.char-edit:hover { border-color: var(--line-strong); background: rgba(217, 164, 110, 0.1); color: var(--gold-100); }
.char-edit .icon { width: 18px; height: 18px; }

.char-empty {
  display: grid; justify-items: center; gap: 12px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
}
.char-empty-icons { display: flex; gap: 10px; opacity: 0.4; }

/* ---------------- Dialogs ---------------- */
.sheet {
  position: fixed; /* .frame sets position: relative, which would undo the modal's viewport anchoring */
  width: min(600px, calc(100vw - 32px));
  max-width: none;
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: linear-gradient(180deg, var(--navy-600), var(--navy-800));
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::before { inset: 0; }
.sheet::backdrop { background: rgba(7, 8, 13, 0.75); backdrop-filter: blur(4px); }
.sheet-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet-top { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  background: var(--gold-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.dialog-close {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--gold-100);
  cursor: pointer;
}
.dialog-close:hover { border-color: var(--line-strong); background: rgba(217, 164, 110, 0.08); }
.char-preview {
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--navy-900);
  font-size: 0.95rem;
  color: var(--gold-100);
}
.char-preview[hidden] { display: none; }
.sheet-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid; gap: 22px; align-content: start;
  padding: 20px 24px 24px;
}
.sheet-bottom { padding: 14px 24px; border-top: 1px solid var(--line); background: rgba(11, 16, 40, 0.6); }
.sheet-actions, .sheet-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.sheet-actions[hidden], .sheet-confirm[hidden] { display: none; }
.sheet-remove { margin-right: auto; display: grid; gap: 4px; flex: 1 1 12rem; }
.sheet-remove[hidden] { display: none; }
.sheet-confirm-text { margin-right: auto; flex: 1 1 12rem; color: var(--gold-100); font-weight: 500; }
.link-danger {
  justify-self: start;
  padding: 8px 0;
  min-height: 44px;
  background: none; border: 0;
  color: var(--danger);
  font: inherit;
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.05em;
  text-decoration: underline; text-underline-offset: 4px;
  cursor: pointer;
}
.link-danger:disabled { color: var(--text-faint); text-decoration: none; cursor: not-allowed; }
.remove-reason { font-size: 0.85rem; color: var(--text-muted); }
.remove-reason[hidden] { display: none; }
.btn--danger {
  background: rgba(255, 143, 136, 0.14);
  border-color: rgba(255, 143, 136, 0.6);
  color: #FFD6D3;
}
.btn--danger:hover { background: rgba(255, 143, 136, 0.24); border-color: var(--danger); }

/* Form controls */
.form-errors {
  padding: 12px 14px;
  border: 1px solid rgba(255, 143, 136, 0.55);
  border-radius: var(--radius);
  background: rgba(255, 143, 136, 0.08);
  color: #FFD6D3;
}
.form-errors[hidden] { display: none; }
.form-errors ul { margin-top: 6px; display: grid; gap: 4px; list-style: disc; padding-left: 1.2em; }
.form-errors a { color: #FFD6D3; text-underline-offset: 3px; }

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field[hidden] { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row--name { grid-template-columns: 1fr 1fr; }
.field-row--name > .field-hint { grid-column: 1 / -1; margin-top: -6px; } /* first and last name share it */
.field label, .choice-group legend {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.85rem; letter-spacing: 0.12em;
  color: var(--gold-100);
}
.choice-group legend { margin-bottom: 10px; padding: 0; }
.choice-group .field label { letter-spacing: 0.08em; color: var(--text-muted); }
.optional { font-weight: 500; letter-spacing: 0.04em; color: var(--text-muted); }
.choice-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 8, 13, 0.5);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.input:focus-visible { outline: 2px solid var(--gold-300); outline-offset: 1px; border-color: var(--gold); }
.input[aria-invalid="true"] { border-color: var(--danger); }
select.input {
  appearance: none;
  padding-right: 36px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E6C08E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center,
    rgba(7, 8, 13, 0.5);
}
select.input option { background: var(--navy-800); color: var(--text); }
textarea.input { resize: vertical; min-height: 96px; }
.field-hint { font-size: 0.88rem; color: var(--text-muted); }
.field-hint[hidden] { display: none; }
.field-count { justify-self: end; }
.field-placeholder { color: var(--text-muted); font-style: italic; }
.field-placeholder[hidden] { display: none; }
.field-error { font-size: 0.88rem; color: var(--danger); }
.field-error[hidden] { display: none; }
.choice-group .field-hint, .choice-group .field-error { margin-top: 8px; }
.choice-group.is-invalid .tile { border-color: rgba(255, 143, 136, 0.55); }

/* Choice tiles: native radios, visually hidden but still focusable */
.tiles { display: grid; gap: 8px; }
.tiles--race { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles--class, .tiles--spec, .tiles--role { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Druid has four specs: two rows of two rather than three and one */
.tiles--spec:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles--segment { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 320px; }
.tile, .option-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 8, 13, 0.35);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.tile {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--text-muted);
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.92rem; letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}
.tile input, .option-card input {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.tile:hover, .option-card:hover { border-color: var(--line-strong); color: var(--text); }
.tile:has(:checked), .option-card:has(:checked) {
  border-color: var(--gold);
  background: rgba(217, 164, 110, 0.1);
  color: var(--gold-100);
  box-shadow: 0 0 0 1px rgba(217, 164, 110, 0.35), 0 0 18px -6px rgba(181, 124, 255, 0.7);
}
/* selected gem: selection isn't shown by color alone */
.tile:has(:checked)::after, .option-card:has(:checked)::after {
  content: "";
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #E9D6FF, var(--violet-glow) 40%, var(--violet));
  box-shadow: 0 0 6px rgba(181, 124, 255, 0.8);
}
.tile:has(:focus-visible), .option-card:has(:focus-visible) { outline: 2px solid var(--gold-300); outline-offset: 2px; }
@media (forced-colors: active) {
  /* shadows and gradients are dropped in forced colors, so mark the selection with system colors */
  .tile:has(:checked), .option-card:has(:checked) { border: 2px solid Highlight; }
  .tile:has(:checked)::after, .option-card:has(:checked)::after { forced-color-adjust: none; background: Highlight; }
}
.tile:has(:disabled) { opacity: 0.4; cursor: not-allowed; }
.tile:has(:disabled):hover { border-color: var(--line); color: var(--text-muted); }
.tile .role-icon, .tile .class-icon { width: 22px; height: 22px; }

.option-list { display: grid; gap: 8px; }
.option-card { display: grid; gap: 4px; padding: 12px 14px; }
.option-main { display: flex; align-items: center; gap: 10px; }
.option-title { font-family: var(--font-label); font-weight: 700; font-size: 1.02rem; letter-spacing: 0.05em; color: var(--gold-100); }
.option-detail { font-size: 0.92rem; color: var(--text-muted); }

/* ---------------- Raid signup: portal banner and list ---------------- */
.portal-upnext:has(+ .signup-cta:not([hidden])) { margin-bottom: 20px; }
.signup-cta {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 14px 24px;
  margin-bottom: 56px;
  padding: 18px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(70% 140% at 0% 50%, rgba(139, 63, 224, 0.2), transparent 65%),
    var(--navy-700);
}
.signup-cta[hidden] { display: none; }
.signup-cta-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold-100);
}
.signup-cta-sub { color: var(--text-muted); font-size: 1rem; }
/* Profile: the link to the Add-ons page, between the characters and availability */
.signup-cta.addons-cta { margin: 56px 0 0; }

.signups { margin-top: 28px; display: grid; gap: 12px; }
.portal-subhead {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 1.3rem; letter-spacing: 0.03em;
  color: var(--gold-100);
}
.signups[hidden] { display: none; }
.signup-row {
  display: grid; gap: 4px;
  padding: 14px 16px 14px 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.9); /* --navy-700 at 90% */
  box-shadow: inset 3px 0 0 var(--class-color, var(--gold));
}
/* A long name wraps (between its first and last name) instead of squeezing the team chip or "No team" tag
   beside it onto two lines; when even the longer of the two names doesn't fit beside it, the chip or tag
   drops to a line of its own. A team name too long for a line of its own wraps inside its chip. */
.signup-row-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 2px; }
.signup-row-name { flex: 1 1 0; margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; line-height: 1.15; color: var(--gold-100); }
.signup-row-top .tag { margin-left: auto; flex-shrink: 0; white-space: nowrap; }
.signup-row-intent { color: var(--text); font-size: 0.98rem; }
.signup-row-line { color: var(--text-muted); font-size: 0.92rem; }
.signup-row-key {
  margin-right: 6px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.75rem; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.signup-row-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.signup-row-note { color: var(--text-muted); font-size: 0.88rem; }
.signup-row-top .team-chip { margin-left: auto; flex-shrink: 0; max-width: 100%; }
.signup-row-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-left: auto; }
.signup-row-actions .link-danger { min-height: 36px; padding: 4px 0; }
/* Raid leaders on a team card, between its nights and its next raid */
.team-card .team-leaders { padding: 12px 22px 0; color: var(--text-muted); font-size: 0.95rem; }
.team-card .team-leaders strong { margin-right: 6px; font-family: var(--font-label); font-weight: 700; letter-spacing: 0.06em; color: var(--team-glow); }

/* ---------------- Sections: Profile and Surveys, as tabs like the admin portal's ---------------- */
.portal-tabs {
  display: flex; gap: 4px;
  margin-top: 32px;
  border-bottom: 1px solid var(--line);
}
.portal-tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.02rem; letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.portal-tab:hover { color: var(--gold-100); }
.portal-tab[aria-selected="true"] { color: var(--gold-100); border-bottom-color: var(--gold); }
.portal-tab:focus-visible { outline-offset: -2px; }
.portal-tab[hidden] { display: none; }
.portal-panel[hidden] { display: none; }
.portal-panel:focus { outline: none; }

/* An officer's title beside the welcome (the heading's own gold is clipped to its text) */
.portal-h1 .tag {
  vertical-align: 0.45em;
  font-family: var(--font-label); font-weight: 700;
  -webkit-text-fill-color: currentColor;
}

/* ---------------- Raid teams (officers) ---------------- */
.officer-teams { display: grid; gap: 22px; }
.officer-note {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(217, 164, 110, 0.08);
  color: var(--gold-100);
}
.officer-team {
  padding-bottom: 18px;
  border-color: rgba(var(--team-rgb), 0.35);
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(var(--team-rgb), 0.1), transparent 65%),
    linear-gradient(180deg, rgba(36, 49, 101, 0.9), rgba(20, 29, 64, 0.9));
}
.officer-team::before { --c: var(--team-glow); --l: 10px; }
.officer-team-head { display: grid; gap: 4px; padding: 18px 22px 12px; }
.officer-team-name {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--team-glow);
  text-shadow: 0 0 20px rgba(var(--team-rgb), 0.45);
}
.officer-team-name:focus { outline: none; }
.officer-team-name:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.officer-team-name .team-gem { width: 14px; height: 14px; }
.officer-team-sub { font-size: 0.95rem; color: var(--text-muted); }
.officer-faint { color: var(--text-faint); }
.officer-subhead {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 22px 8px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-300);
}
.officer-list { display: grid; gap: 6px; margin: 0 16px; }
.officer-empty { margin: 0 22px; }
.officer-row {
  display: flex; align-items: center; gap: 10px 14px;
  min-height: 60px;
  padding: 10px 12px 10px 14px;
  border: 1px solid rgba(var(--team-rgb), 0.25);
  border-radius: 3px;
  background: rgba(18, 26, 58, 0.9);
  box-shadow: inset 2px 0 0 var(--class-color, transparent);
}
.officer-row:focus-visible { outline-offset: -2px; }
.officer-row.is-new { animation: char-glow 1.6s var(--ease-out); }
.officer-row-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.officer-row-title {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.04em;
  color: var(--gold-100);
  overflow-wrap: anywhere;
}
.officer-row-line { font-size: 0.92rem; color: var(--text-muted); }
.officer-row-line .signup-row-key { margin-right: 4px; }
.officer-row-line .tag, .officer-row-line .you-tag { margin-left: 2px; }
.officer-spot-role { flex: none; width: 92px; }
.officer-spot-standing { flex: none; }
.officer-row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.officer-row-actions .char-edit { width: 40px; height: 40px; }
.officer-spot.is-open-slot .officer-row-title { font-family: var(--font-body); font-weight: 400; font-style: italic; letter-spacing: 0; color: var(--text-faint); }
.officer-spot.is-open-slot .role-slot { border-style: dashed; background: transparent; }
.tiles--standing { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 420px; }

@media (max-width: 600px) {
  .officer-team-head { padding-inline: 16px; }
  .officer-subhead { margin-inline: 16px; }
  .officer-list { margin-inline: 10px; }
  .officer-empty { margin-inline: 16px; }
  /* Rows become: role, details (standing under them), actions on the right */
  .officer-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 6px 10px; padding-left: 12px; }
  .officer-spot-role { grid-column: 1; grid-row: 1 / span 2; align-self: center; width: auto; }
  .officer-row-body { grid-column: 2; grid-row: 1; }
  .officer-spot-standing { grid-column: 2; grid-row: 2; }
  .officer-row-actions { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
  .officer-spot-role .role-name { display: none; }
}

/* ---------------- Surveys ---------------- */
/* The banner at the top of Profile while surveys wait for the member's answers */
.survey-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 28px;
  padding: 12px 16px 12px 19px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(60% 160% at 0% 50%, rgba(217, 164, 110, 0.14), transparent 70%),
    var(--navy-700);
  box-shadow: inset 3px 0 0 var(--gold);
}
.survey-banner[hidden] { display: none; }
.survey-banner-text { display: grid; gap: 2px; min-width: 0; }
.survey-banner-title { font-family: var(--font-label); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.05em; color: var(--gold-100); }
.survey-banner-sub { font-size: 0.95rem; color: var(--text-muted); overflow-wrap: anywhere; }

/* The Surveys tab: new surveys to answer, then the member's submissions */
.portal-panel > .portal-section:first-child { margin-top: 36px; }
.portal-submissions { margin-top: 56px; }
.survey-cards, .survey-subs { display: grid; gap: 10px; }
.survey-card {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 20px;
  padding: 16px 18px 16px 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.9); /* --navy-700 at 90% */
  box-shadow: inset 3px 0 0 var(--gold);
}
.survey-card-text { flex: 1 1 320px; min-width: 0; display: grid; gap: 4px; }
.survey-card-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; line-height: 1.2; color: var(--gold-100); overflow-wrap: anywhere; }
/* A long description shows its first lines here; the survey page has all of it */
.survey-card-desc {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  white-space: pre-line; overflow-wrap: anywhere;
  color: var(--text); font-size: 0.98rem;
}
.survey-card-meta { color: var(--text-muted); font-size: 0.9rem; }
.survey-card .btn { flex: none; }

.survey-sub {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.9);
}
.survey-sub-toggle {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 4px 14px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px 10px 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}
.survey-sub-toggle:hover, .survey-sub.is-open > .survey-sub-toggle { background: rgba(217, 164, 110, 0.04); }
.survey-sub-toggle:focus-visible { outline-offset: -2px; }
.survey-sub-title { min-width: 0; font-family: var(--font-display); font-size: 1.1rem; color: var(--gold-100); overflow-wrap: anywhere; }
.survey-sub-meta { font-size: 0.9rem; color: var(--text-muted); text-align: right; }
.survey-sub-chevron { width: 18px; height: 18px; color: var(--gold-300); transition: transform 0.3s var(--ease-out); }
.survey-sub.is-open .survey-sub-chevron { transform: rotate(180deg); }
.survey-sub-panel { padding: 0 14px 14px 18px; }
.survey-sub-panel[hidden] { display: none; }
.survey-sub-foot { margin-top: 12px; }
.survey-subs > .portal-empty-line { padding: 4px 0; }

/* A response's answers: each question as it was asked, then the answer */
.survey-answers {
  display: grid; gap: 10px;
  padding: 12px 14px;
  border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(7, 8, 13, 0.3);
}
.survey-answers dt { font-family: var(--font-label); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; color: var(--text-muted); overflow-wrap: anywhere; }
.survey-answers dd { margin: 2px 0 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
/* A follow-up's answer, indented under its question's with its number (3a); here and in the admin portal */
.survey-answers > .is-follow-up, .admin-answers > .is-follow-up { margin-left: 18px; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.answer-mark {
  display: inline-block; margin-right: 2px; padding: 0 6px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.8rem; letter-spacing: 0; line-height: 1.5; /* "3a", not small caps */
  color: var(--gold-300);
}
.survey-answers dd .class-icon, .admin-answers dd .class-icon { vertical-align: -3px; }

/* The survey page (portal/survey/): the raid signup page's form and notices, with the survey's own head */
.survey-lede { white-space: pre-line; overflow-wrap: anywhere; }
.survey-closes { margin-top: 10px; font-family: var(--font-label); font-weight: 700; letter-spacing: 0.05em; color: var(--gold-300); }
.signup-head .portal-h1 { overflow-wrap: anywhere; }
.survey-actions { align-items: center; }
.survey-final { margin: 0 auto 0 0; }
/* Answered: Withdraw sits apart from the other actions, and asking first, its question takes the row */
.signup-done-actions .survey-withdraw { margin-left: auto; }
.signup-done-actions .survey-withdraw-ask { flex: 1 1 100%; color: var(--gold-100); font-size: 1rem; }
/* A follow-up shows right under its question, indented and joined to it by a line */
[data-survey-questions] > .question.question--follow-up {
  margin: -12px 0 0 15px;
  padding: 4px 0 28px 27px;
  border-top: 0;
  border-left: 2px solid var(--line-strong);
}
.question--follow-up > .question-title { font-size: 1.05rem; }
.question-num.question-num--follow-up { width: 34px; height: 34px; margin-top: -4px; margin-left: -2px; font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; }
/* Where a survey's preferences start from: one of the member's raid applications, picked or the only one */
[data-survey-questions] > .pref-start { margin: 0; padding: 28px 0 20px; border-top: 1px solid var(--line); }
[data-survey-questions] > .pref-start:first-child { padding-top: 0; border-top: 0; }
[data-survey-questions] > .pref-start .input { max-width: 520px; }
[data-survey-questions] > .pref-start + .question { padding-top: 8px; border-top: 0; }
p.pref-start + .question { padding-top: 0; }
/* Under a dropdown, where they start from is indented with the set */
[data-survey-questions] > .pref-start.pref-start--follow-up {
  margin: -12px 0 0 15px;
  padding: 4px 0 16px 27px;
  border-top: 0;
  border-left: 2px solid var(--line-strong);
}
[data-survey-questions] > .pref-start--follow-up + .question.question--follow-up { margin-top: 0; padding-top: 4px; }
/* A preference waiting for the one before it: greyed out, with why above it */
.pref-choices.is-locked { opacity: 0.4; }
.question .pref-lock { margin: -4px 0 12px; }
.question--pref .pref-clear { margin-top: 6px; }
.scale-clear { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; font-size: 0.92rem; }

/* A linear scale: five points on a line from left to right, numbered under them, with a label above each end */
.scale { max-width: 520px; }
.scale-ends {
  display: flex; justify-content: space-between; gap: 16px;
  margin-bottom: 8px;
  font-size: 0.92rem; color: var(--text-muted);
}
.scale-ends > span { max-width: 45%; overflow-wrap: anywhere; }
.scale-ends > span:last-child { text-align: right; }
.scale-points { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* The line, from the 1's point to the 5's */
.scale-points::before {
  content: ""; position: absolute; top: 21px; left: 10%; right: 10%;
  height: 2px; background: var(--line-strong);
}
.scale-point {
  position: relative;
  display: grid; justify-items: center; gap: 4px;
  padding: 10px 0 4px;
  cursor: pointer;
}
.scale-point input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.scale-dot {
  width: 24px; height: 24px;
  border: 2px solid var(--line-strong); border-radius: 999px;
  background: var(--navy-800);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.scale-point:hover .scale-dot { border-color: var(--gold-300); }
.scale-point:has(:checked) .scale-dot { border-color: var(--gold-300); background: var(--gold); box-shadow: inset 0 0 0 4px var(--navy-800); }
.scale-point:has(:focus-visible) .scale-dot { outline: 2px solid var(--gold-300); outline-offset: 3px; }
.scale-num { font-family: var(--font-label); font-weight: 700; color: var(--text-muted); }
.scale-point:has(:checked) .scale-num { color: var(--gold-100); }
.choice-group.is-invalid .scale-dot, .question.is-invalid .scale-dot { border-color: rgba(255, 143, 136, 0.55); }
.pref-choices .scale { margin-top: 4px; }
@media (forced-colors: active) {
  .scale-point:has(:checked) .scale-dot { background: Highlight; }
}
[data-done-answers] { margin: 22px 0; }

@media (max-width: 600px) {
  .survey-sub-toggle { grid-template-columns: minmax(0, 1fr) auto; }
  .survey-sub-meta { grid-column: 1; grid-row: 2; text-align: left; }
  .survey-sub-chevron { grid-column: 2; grid-row: 1 / span 2; }
  .survey-card .btn, .survey-banner .btn { flex: 1 1 auto; }
  .survey-final { flex: 1 1 100%; }
}

/* ---------------- Add-ons page (/portal/addons/) ---------------- */
/* Wider than the signup form, for the grid of cards */
.signup-container.addons-container { max-width: 1100px; }
.addon-filter { min-width: 0; margin: 0 0 36px; padding: 0; border: 0; }
.addon-filter[hidden] { display: none; }
.addon-filter-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.addon-filter-tiles .tile { min-height: 40px; padding: 6px 16px; }
.addon-filter-count { font-family: var(--font-body); font-weight: 400; font-size: 0.85rem; letter-spacing: 0; color: var(--text-faint); }
.tile:has(:checked) .addon-filter-count { color: var(--gold-300); }
.addon-group + .addon-group { margin-top: 48px; }
.addon-group-title {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 18px;
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.45rem; letter-spacing: 0.03em; line-height: 1.3;
  color: var(--gold-100);
  overflow-wrap: anywhere;
}
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
/* Each add-on in its own card: the site's framed panel, at 98% opacity */
.addon-card.frame, .addon-empty.frame {
  background: linear-gradient(180deg, rgba(42, 56, 112, 0.98), rgba(18, 26, 58, 0.98));
}
.addon-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 24px; }
.addon-name {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.25rem; letter-spacing: 0.02em; line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}
.addon-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.addon-description { flex: 1; margin: 0; font-size: 1rem; line-height: 1.6; color: var(--text-muted); white-space: pre-line; overflow-wrap: anywhere; }
.addon-link { align-self: flex-start; margin-top: 4px; }
.addon-link .icon { width: 16px; height: 16px; }
.addon-empty { margin: 0; padding: 20px 24px; color: var(--text-muted); }

/* ---------------- Raid signup page ---------------- */
.signup-container { max-width: 840px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  margin-bottom: 8px;
  font-family: var(--font-label); font-weight: 500; letter-spacing: 0.06em;
  color: var(--text-muted);
  text-decoration: none;
}
.back-link:hover { color: var(--gold-100); }
.signup-head { margin-bottom: 28px; }
.signup-head .eyebrow { flex-wrap: wrap; margin-bottom: 8px; }
.signup-lede { margin-top: 8px; max-width: 60ch; color: var(--text-muted); }

.signup-form, .signup-done, .signup-off {
  padding: clamp(20px, 4vw, 36px);
  background: linear-gradient(180deg, #243165, #141D40); /* opaque, like the team panels */
}
.signup-form[hidden], .signup-done[hidden], .signup-off[hidden] { display: none; }
/* Raids hidden: the notice in place of the form */
.signup-off .signup-done-actions { margin-top: 22px; }
.signup-form > .form-errors { margin-bottom: 20px; }

/* Member portal: availability (the same grid as the signup form) */
.portal-availability { margin-top: 56px; }
.avail-form {
  padding: clamp(20px, 4vw, 32px);
  background: linear-gradient(180deg, #243165, #141D40);
}
.avail-form > .form-errors { margin-bottom: 20px; }
.avail-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--line);
}
.avail-saved { margin: 0; }
.avail-actions .btn[hidden] { display: none; } /* Save availability shows only while editing */

/* Member portal: "I'm interested in raiding", a switch above the availability form, saved as it changes */
.raid-interest {
  margin-bottom: 20px;
  padding: 16px clamp(20px, 4vw, 32px);
  background: linear-gradient(180deg, #243165, #141D40);
}
.raid-interest .field-hint { margin: 4px 0 0; }
.switch-row {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 40px;
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.04em;
  color: var(--gold-100);
  cursor: pointer;
}
.switch {
  appearance: none;
  position: relative; flex: none;
  width: 44px; height: 24px; margin: 0;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--navy-900);
  cursor: pointer;
}
.switch::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-faint);
}
/* It slides only once the page has drawn it, not when the saved setting fills it in */
.switch.is-live { transition: background-color 0.2s, border-color 0.2s; }
.switch.is-live::before { transition: transform 0.2s var(--ease-out), background-color 0.2s; }
.switch:checked { background: var(--gold-800); border-color: var(--gold); }
.switch:checked::before { transform: translateX(20px); background: var(--gold-100); }
.switch:disabled { opacity: 0.6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .switch.is-live, .switch.is-live::before { transition: none; } }

.question { border: 0; margin: 0; padding: 0 0 28px; min-width: 0; }
/* A floated legend lays out like normal content, so the question's top rule and padding
   sit above it instead of the fieldset drawing the legend across its own border */
.question > legend { float: left; width: 100%; }
.question > legend + * { clear: both; }
.question + .question,
.signup-rest > .question:first-child,
[data-preferences] > .question:first-child {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.question-title {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
  padding: 0;
  font-family: var(--font-body); font-weight: 500;
  font-size: 1.12rem; line-height: 1.45;
  color: var(--gold-100);
}
.question-num {
  display: grid; place-items: center;
  flex: none;
  width: 30px; height: 30px;
  margin-top: -2px;
  font-family: var(--font-display); font-size: 0.95rem;
  color: var(--gold-ink);
  background: var(--gold-metal);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.question .field-hint, .question .field-error { margin-top: 8px; }
.question .field-hint + .btn { margin-top: 14px; }
.signup-character { position: relative; max-width: 520px; }
/* The chosen character's class icon, inside the select before its name */
.signup-character-icon { position: absolute; top: 50%; left: 12px; display: flex; transform: translateY(-50%); pointer-events: none; }
.signup-character-icon .class-icon { width: 22px; height: 22px; }
.signup-character:has(.class-icon) select { padding-left: 44px; }
.signup-zone { display: grid; gap: 4px 12px; grid-template-columns: max-content minmax(0, 320px); justify-content: start; align-items: center; margin-bottom: 14px; }
.signup-zone-label { font-family: var(--font-label); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.08em; color: var(--text-muted); }
.signup-zone .field-hint, .signup-zone .field-error { grid-column: 2; margin: 0; }
.signup-zone-select:disabled { opacity: 0.7; cursor: default; } /* locked with the availability grid */
@media (max-width: 480px) {
  .signup-zone { grid-template-columns: minmax(0, 1fr); }
  .signup-zone .field-hint, .signup-zone .field-error { grid-column: 1; }
}
/* The team question: a tile per team, with whether it's taking applications or already applied to */
.tiles--apply-team { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tiles--apply-team .tile { justify-content: flex-start; padding: 10px 14px; text-align: left; }
.tiles--apply-team .team-gem { width: 10px; height: 10px; margin: 0 4px 0 2px; }
.tiles--apply-team .tile:has(:checked) { border-color: rgba(var(--team-rgb), 0.85); background: rgba(var(--team-rgb), 0.14); }
.tiles--apply-team .tile:has(:disabled) { opacity: 0.55; cursor: not-allowed; }
.tiles--apply-team .tile:has(:disabled):hover { border-color: var(--line); color: var(--text-muted); }
.tile-text { display: grid; gap: 2px; }
.tile-sub { font-family: var(--font-body); font-weight: 400; font-size: 0.8rem; letter-spacing: 0; color: var(--text-muted); }
.question-input { max-width: 640px; }
textarea.question-input { min-height: 120px; }
.signup-existing { color: var(--text-muted); }
.signup-existing[hidden] { display: none; }
.signup-rest.is-locked { opacity: 0.45; }

.option-list--compact { gap: 6px; }
.option-list--compact .option-card { padding: 12px 14px; }
.option-list--compact .option-title { font-family: var(--font-body); font-weight: 500; font-size: 1rem; letter-spacing: 0; }

/* Availability grid (lib/availability-grid.js): days by hours, drawn like the admin heatmap */
.avail-wrap {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-900);
}
.avail-grid { width: 100%; min-width: 300px; border-collapse: separate; border-spacing: 3px; table-layout: fixed; user-select: none; }
.avail-grid th {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.avail-grid thead th:first-child { width: 4.4rem; }
.avail-grid abbr { text-decoration: none; }
.avail-grid td { padding: 0; }
.avail-head {
  display: block; width: 100%;
  padding: 2px 4px;
  border: 0; border-radius: 2px;
  background: none;
  color: inherit; font: inherit; letter-spacing: inherit;
  cursor: pointer;
}
.avail-head--hour { padding-right: 6px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.avail-head:hover { color: var(--gold-100); }
.avail-head:focus-visible { outline: 2px solid var(--violet-glow); outline-offset: 0; }
.avail-cell {
  display: block;
  width: 100%; height: 22px;
  padding: 0;
  border: 0; border-radius: 2px;
  background: rgba(217, 164, 110, 0.06);
  cursor: pointer;
  touch-action: manipulation;
}
.avail-cell:hover { outline: 1px solid var(--gold-300); outline-offset: -1px; }
.avail-cell[aria-pressed="true"] { background: rgba(217, 164, 110, 0.8); box-shadow: inset 0 0 0 1px rgba(255, 228, 180, 0.35); }
.avail-cell:focus-visible { outline: 2px solid var(--violet-glow); outline-offset: -2px; }
.avail-cell[aria-pressed="true"]:focus-visible { outline-color: var(--navy-900); } /* violet barely shows on gold */
.avail-short { display: none; }
.avail-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 10px; }
.avail-count { margin: 0; font-size: 0.92rem; color: var(--text-muted); }
.avail-foot .btn[hidden] { display: none; }
.avail-foot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.avail-foot .btn:disabled { opacity: 0.45; pointer-events: none; }
/* Locked until Edit (the member portal and the signup form): dimmed, and nothing reacts to the pointer */
.avail-wrap.is-locked { opacity: 0.7; }
.avail-wrap.is-locked .avail-head, .avail-wrap.is-locked .avail-cell { cursor: default; }
.avail-wrap.is-locked .avail-head:hover { color: inherit; }
.avail-wrap.is-locked .avail-cell:hover:not(:focus-visible) { outline: none; }
.is-invalid .avail-wrap { border-color: rgba(255, 143, 136, 0.7); }
@media (forced-colors: active) {
  .avail-cell { border: 1px solid CanvasText; }
  .avail-cell[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; }
  .avail-cell[aria-pressed="true"]:focus-visible { outline-color: HighlightText; }
}
@media (max-width: 560px) {
  .avail-wrap { padding: 8px 6px; }
  .avail-grid { border-spacing: 2px; }
  .avail-grid th { font-size: 0.72rem; letter-spacing: 0.02em; }
  .avail-grid thead th:first-child { width: 3.3rem; }
  .avail-head--hour { padding-right: 3px; }
}
/* Phones: the whole week fits without scrolling sideways (two-letter days, "7p" hours) */
@media (max-width: 400px) {
  .avail-wrap { padding: 6px 3px; }
  .avail-grid { min-width: 0; border-spacing: 1px; }
  .avail-grid thead th:first-child { width: 2.3rem; }
  .avail-head { padding-inline: 0; }
  .avail-head--hour { padding-right: 3px; }
  .avail-long { display: none; }
  .avail-short { display: inline; }
}

/* Preferences */
.pref-label {
  margin: 12px 0 8px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.14em;
  color: var(--text-muted);
}
.pref-choices > .pref-label:first-child { margin-top: 0; }
.link-button {
  padding: 0; border: 0; background: none;
  font: inherit;
  color: var(--gold-300);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover { color: var(--gold-100); }
.link-button[hidden] { display: none; }
/* The first preference's clear link only appears when the answer is "No". Like Select and Remove below, it's
   greyed out, with the hint beside it saying why, while it can't be used. */
.pref-clear-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; margin: -8px 0 4px; }
.pref-clear-row[hidden] { display: none; }
.question .pref-clear-row .field-hint { margin: 0; padding: 4px 0 8px; } /* room above the classes once it wraps under the link */
.pref-clear { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.92rem; }
.pref-clear[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
/* The second and third preferences start closed: Select opens one and turns into Remove. Greyed out, with
   the hint beside it saying why, while it can't be used. */
.pref-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.question .pref-toggle .field-hint { margin: 0; }
.pref-toggle .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.pref-toggle + .pref-choices { margin-top: 16px; }
@media (forced-colors: active) {
  .pref-toggle .btn[aria-disabled="true"], .pref-clear[aria-disabled="true"] { color: GrayText; border-color: GrayText; }
}
/* How willing the member is to play their second or third preference: 1 to 5 in a row, "Unwilling" and
   "Very willing" beside the ends (under them on phones) */
.likelihood { display: grid; grid-template-columns: auto auto auto; justify-content: start; align-items: center; gap: 6px 12px; }
.tiles--likelihood { grid-template-columns: repeat(5, 48px); }
.likelihood-end { font-size: 0.88rem; color: var(--text-muted); }
@media (max-width: 560px) {
  .likelihood { grid-template-columns: 1fr 1fr; }
  .tiles--likelihood { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .likelihood-end { grid-row: 2; }
  .likelihood-end:last-child { justify-self: end; }
}

.signup-actions {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* Saved */
.signup-done-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--gold-100);
}
.signup-done-title:focus-visible { outline-offset: 4px; }
.signup-done-text { margin-top: 8px; color: var(--text-muted); }
.signup-summary { display: grid; gap: 10px; margin: 22px 0; }
.signup-summary div { display: grid; grid-template-columns: 9rem 1fr; gap: 12px; }
.signup-summary dt {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.82rem; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.signup-summary dd { margin: 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.signup-done-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 600px) {
  .signup-summary div { grid-template-columns: 1fr; gap: 2px; }
  .signup-actions .btn { flex: 1 1 auto; }
}

/* ---------------- Footer ---------------- */
.site-footer--slim { padding: 32px 0 24px; }
.site-footer--slim .footer-inner { padding-bottom: 20px; }
.site-footer--slim .footer-brand img { width: 40px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1099px) {
  .portal-container { max-width: 768px; }
  .portal-grid { grid-template-columns: minmax(0, 1fr); gap: 56px; }
}
@media (min-width: 600px) and (max-width: 1099px) {
  .char-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .char-list > .char-empty { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .portal-grid:has(> #raids[hidden]) .char-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .portal-grid:has(> #raids[hidden]) .char-list > .char-empty { grid-column: 1 / -1; }
}

@media (max-width: 719px) {
  :root { --head-avatar: 56px; }
  .portal-divider, .portal-label, .portal-back { display: none; }

  .portal { padding-top: calc(var(--header-h) + 28px); }
  .portal-id { align-items: flex-start; gap: 14px; }
  .portal-h1 { font-size: 1.6rem; }
  .portal-upnext { margin: 28px 0 48px; }
  .portal-upnext[hidden] + .signup-cta[hidden] + .portal-grid { margin-top: 28px; }

  /* Dialogs become full-screen sheets */
  .sheet {
    width: 100%; height: 100dvh; max-height: none;
    margin: 0;
    border: 0;
  }
  .sheet[open] { animation: sheet-up 0.35s var(--ease-out); }
  .sheet::before { display: none; }
  .sheet-top, .sheet-body, .sheet-bottom { padding-left: var(--gutter); padding-right: var(--gutter); }
  .sheet-remove { max-width: none; flex-basis: 100%; }
}
@keyframes sheet-up { from { translate: 0 24px; opacity: 0.6; } to { translate: 0 0; opacity: 1; } }

@media (max-width: 860px) {
  .portal-divider, .portal-label { display: none; }
}
@media (max-width: 720px) {
  .steps--compact::before { display: none; } /* the vertical connector would run through the step text */
}
@media (max-height: 560px) {
  /* short viewports (landscape phones, high zoom): scroll the whole sheet so the
     title and action bars can't crowd out the form */
  .sheet { overflow-y: auto; }
  .sheet-form, .sheet-body { flex: none; }
  .sheet-body { overflow: visible; }
}

@media (max-width: 560px) {
  .tiles--race { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .field-row, .field-row--name { grid-template-columns: 1fr; }
  .tiles--spec, .tiles--spec:has(> :nth-child(4)) { grid-template-columns: 1fr; }
  .tiles--segment { max-width: none; }
  .tile { font-size: 0.88rem; }
}
@media (max-width: 360px) {
  .portal-title { font-size: 1.35rem; }
}

/* ===================================================================
   Characters from the Armory: the Profile's Refresh and Import buttons, a character's Armory status, the edit
   dialog's Armory facts, and the Import from the Armory page (/portal/armory/)
   =================================================================== */
.char-head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.char-head-actions [hidden] { display: none; }
.char-head-actions [aria-busy="true"] { cursor: progress; }
.char-armory-line { font-size: 0.85rem; color: var(--text-faint); }
.char-armory-when { font-style: italic; }

.armory-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.armory-tag--found { border-color: rgba(var(--rgb-green), 0.55); background: rgba(var(--rgb-green), 0.14); color: #B9F2D6; }
.armory-tag--not_public { border-color: rgba(var(--rgb-blue), 0.55); background: rgba(var(--rgb-blue), 0.14); color: #CFE0FF; }
.armory-tag--missing { border-color: rgba(var(--rgb-orange), 0.6); background: rgba(var(--rgb-orange), 0.14); color: #FFD3AE; }
.armory-tag--unlinked { border-color: var(--line-strong); background: rgba(217, 164, 110, 0.1); color: var(--gold-100); }

/* Edit dialog: what comes from the Armory */
.char-armory { display: grid; gap: 10px; margin-bottom: 22px; }
.char-armory-facts { display: grid; gap: 6px; }
.char-armory-facts > div { display: flex; gap: 12px; }
.char-armory-facts dt { min-width: 7.5em; color: var(--text-faint); font-size: 0.9rem; }
.char-armory-facts dd { color: var(--text); }
.char-armory-note { font-size: 0.9rem; color: var(--text-muted); }
.char-armory-note--missing { color: #FFD3AE; }

/* The import page */
.armory-tips { display: grid; gap: 6px; margin-top: 14px; padding-left: 1.2em; list-style: disc; color: var(--text-muted); font-size: 0.95rem; }
.armory-loading { display: flex; align-items: center; gap: 12px; }
.armory-loading .spinner {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--gold);
  border-radius: 50%;
  animation: armory-spin 0.9s linear infinite;
}
@keyframes armory-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .armory-loading .spinner { animation: none; } }
.armory-form .question-title { margin-bottom: 6px; }
.armory-list { display: grid; gap: 10px; margin-top: 18px; }
.armory-row {
  display: grid; gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.7);
  box-shadow: inset 3px 0 0 var(--class-color, var(--gold));
}
.armory-row.is-off { opacity: 0.6; }
.armory-pick { display: grid; gap: 4px; cursor: pointer; }
.armory-who { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.armory-who input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.armory-check { width: 18px; text-align: center; color: #8BE9BF; font-weight: 700; }
.armory-name { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.1rem; color: var(--class-color, var(--gold-100)); }
.armory-name .class-name { color: var(--class-color, var(--gold-100)); }
.armory-line { color: var(--text-muted); font-size: 0.9rem; padding-left: 28px; }
.armory-note { color: var(--text-muted); font-size: 0.9rem; padding-left: 28px; }
.armory-details { display: grid; gap: 12px; margin-top: 8px; padding-left: 28px; }
.armory-details[hidden], .armory-details [hidden] { display: none; }
.armory-form .signup-actions { margin-top: 22px; }
@media (max-width: 520px) {
  .armory-line, .armory-note, .armory-details { padding-left: 0; }
  .char-head-actions { width: 100%; }
  .char-head-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* The character card's Open character button (lib/character-sheet.js), across the card under its details */
.char-open { grid-column: 1 / -1; }
