.raid-planning-page {
  --armory-background-opacity: .55;
  --raid-cream: #f3dfbb;
  --raid-text: #d7e2eb;
  --raid-muted: #acc0cf;
  --raid-line: #3d5365;
  --raid-panel: #152330ed;
}

.raid-planning-page [hidden] { display: none !important; }
.raid-planning-page .site-shell { max-width: 1280px; }
.raid-page-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.raid-home { width: min(260px, 50%); }
.raid-home img { display: block; width: 100%; height: auto; }
.raid-planning-page main { padding-block: clamp(32px, 5vw, 64px) 56px; }
.raid-intro { margin-bottom: 25px; }
.raid-intro h1, .raid-intro h2 {
  margin: 0 0 10px;
  color: var(--raid-cream);
  font: 400 clamp(36px, 5vw, 56px)/1.06 Georgia, serif;
}
.raid-intro p, #raid-sign-in p { max-width: 61ch; margin: 0; color: var(--raid-text); line-height: 1.55; }

.raid-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  align-items: start;
  gap: 16px;
}
.raid-panel {
  min-width: 0;
  padding: clamp(16px, 2.5vw, 28px);
  border: 1px solid var(--raid-line);
  border-radius: 7px;
  background: var(--raid-panel);
  box-shadow: 0 12px 45px #030b1466;
}
.raid-panel h2 {
  margin: 0 0 17px;
  color: var(--raid-cream);
  font: 400 clamp(23px, 3vw, 29px)/1.17 Georgia, serif;
}
.raid-panel h3 { margin: 26px 0 10px; color: #c5d5e2; font: 600 14px/1.3 Arial, sans-serif; }
.raid-primary, .raid-secondary, .raid-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--raid-line);
  border-radius: 5px;
  background: #1d3040;
  color: var(--raid-text);
  font: 600 13px/1.25 Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.raid-primary { border-color: #c99659; background: #493520; color: #fff1d3; }
.raid-primary:hover { border-color: #ffda98; background: #594027; }
.raid-secondary:hover { border-color: #8aa7ba; color: #fff; }
.raid-text-action { padding-inline: 4px; border-color: transparent; background: transparent; color: var(--raid-muted); }
.raid-text-action:hover { color: #fff; }
.raid-planning-page :focus-visible { outline: 2px solid #e9c78c; outline-offset: 3px; }
.raid-planning-page :disabled { cursor: wait; }
.raid-planning-page select:disabled { opacity: .62; }
#raid-sign-in .raid-primary { margin-top: 16px; }
.raid-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -7px 0 11px;
  border-bottom: 1px solid #6c84983d;
  color: var(--raid-muted);
}
#raid-user { overflow-wrap: anywhere; }
.raid-fields, .raid-name-fields, .raid-character-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.raid-fields { display: grid; gap: 9px; }
.raid-fields :is(label, legend) { color: var(--raid-text); font-weight: 600; font-size: 14px; }
.raid-fields label span { color: var(--raid-muted); font-weight: 400; }
.raid-fields :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #526c80;
  border-radius: 4px;
  background: #111d28;
  color: var(--raid-text);
  font: inherit;
}
.raid-fields textarea { resize: vertical; }
.raid-fields select {
  appearance: none;
  padding-inline-end: 36px;
  background-image: var(--armory-select-chevron);
  background-position: right 13px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
}
@media (forced-colors: active) {
  .raid-fields select { appearance: auto; background-image: none; padding-inline-end: 11px; }
}
.raid-name-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 7px; }
.raid-name-fields legend { padding: 0 0 7px; }
.raid-name-fields label { color: var(--raid-muted); font-size: 12px; font-weight: 400; }
.raid-character-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .85fr); gap: 10px; margin: 7px 0; }
.raid-name-fields label, .raid-character-fields label { display: block; margin-bottom: 7px; }
.raid-visibility, .raid-feedback { margin: 0; color: var(--raid-muted); font-size: 13px; line-height: 1.45; }
.raid-visibility { margin-block: 3px 5px; }
.raid-feedback { margin-top: 11px; }
.raid-feedback:empty { display: none; }
.raid-feedback.raid-error { color: #ffc0ae; }
#raid-retry { margin-top: 10px; }

.raid-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; }
.raid-counts > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 6px;
  min-height: 82px;
  padding: 8px;
  border: 1px solid #3b5162;
  border-radius: 5px;
  background: #1b2d3c;
}
.raid-counts dt { color: var(--raid-muted); font-size: 12px; line-height: 1.2; overflow-wrap: anywhere; }
.raid-counts dd { margin: 0; color: var(--raid-cream); font: 400 26px/1 Georgia, serif; font-variant-numeric: tabular-nums; }
.raid-counts [data-category="yes"] { border-color: #557968; background: #1e3836; }
.raid-counts [data-category="maybe"] { border-color: #81664b; background: #3b3129; }
.raid-class-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 0; }
.raid-class-counts > div { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 6px 0; border-bottom: 1px solid #46657a55; }
.raid-class-counts dt { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.raid-class-counts dd { margin: 0; color: var(--raid-cream); font-variant-numeric: tabular-nums; }

.raid-roster-panel { margin-top: 16px; }
.raid-roster-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.raid-roster-heading h2 { margin: 0; }
.raid-roster { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; color: var(--raid-text); }
.raid-roster :is(th, td) { padding: 11px 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.raid-roster th { background: #1d3040; color: var(--raid-muted); font-size: 12px; font-weight: 600; }
.raid-roster th:nth-child(-n+2) { width: 14%; }
.raid-roster th:nth-child(3) { width: 12%; }
.raid-roster th:nth-child(4) { width: 14%; }
.raid-roster th:nth-child(5) { width: 16%; }
.raid-roster th:nth-child(6) { width: 7.5%; }
.raid-roster th:last-child { width: 112px; }
.raid-roster tbody tr { border-bottom: 1px solid #46657a55; }
.raid-roster tbody tr:nth-child(odd) { background: #12202cb3; }
.raid-roster tbody tr:nth-child(even) { background: #203344a8; }
.raid-roster tbody tr:last-child { border-bottom: 0; }
.raid-entry-name, .raid-entry-class { font-weight: 600; }
.raid-entry-name-missing, .raid-entry-discord { color: var(--raid-muted); }
.raid-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.raid-with-icon img { display: block; flex: none; width: 18px; height: 18px; border: 1px solid var(--raid-line); border-radius: 3px; }
.raid-entry-note {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}
.raid-note-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  flex: 1;
  min-width: 0;
  max-height: 3em;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.raid-note-more { flex: none; align-self: center; color: var(--raid-cream); font-size: 18px; line-height: 1; }
.raid-entry-note:hover { color: var(--raid-cream); }
.raid-note-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  width: max-content;
  max-width: min(380px, calc(100vw - 24px));
  max-height: min(55dvh, 350px);
  padding: 12px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #708b9f;
  border-radius: 5px;
  background: #1c3040;
  color: var(--raid-text);
  box-shadow: 0 12px 35px #0009;
  font: 14px/1.5 Arial, sans-serif;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.raid-entry-date { color: var(--raid-muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.raid-entry-interest {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 4px;
  background: #2b3d4c;
  color: #c8d6df;
  font-size: 12px;
}
.raid-entry-interest[data-category="yes"] { background: #224638; color: #abe2bc; }
.raid-entry-interest[data-category="maybe"] { background: #4b3929; color: #f1d0a3; }
#raid-empty { margin: 0; color: var(--raid-muted); }

.profile-dialog.raid-planning-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1160px, calc(100vw - 32px));
  max-width: 1160px;
  max-height: calc(100dvh - 40px);
  border: 1px solid #8c7954;
  border-radius: 10px;
  background: #0e1823;
  color: var(--raid-text);
  box-shadow: 0 32px 110px #000d, 0 0 0 4px #8d755218;
  overscroll-behavior: contain;
}
.raid-dialog-content { padding: 28px 32px; }
.raid-planning-dialog .raid-intro { padding-right: 32px; }
.raid-planning-dialog .raid-intro h2 { font-size: 36px; }

@media (max-width: 760px) {
  .raid-page-header { min-height: 75px; }
  .raid-fields :is(input, select, textarea) { font-size: 16px; }
  .profile-dialog.raid-planning-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 20px); }
  .raid-dialog-content { padding: 24px 17px; }
  .raid-planning-dialog .raid-intro h2 { font-size: 30px; }
}
@media (max-width: 1160px) {
  .raid-roster, .raid-roster tbody { display: block; }
  .raid-roster thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .raid-roster tbody tr {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "character character character character interest interest"
      "discord discord discord discord interest interest"
      "class class class specialization specialization specialization"
      "role role role role role role"
      "note note note note note note"
      "changed changed changed changed changed changed";
    gap: 8px 10px;
    padding: 12px 10px;
  }
  .raid-roster td { display: block; padding: 0; }
  .raid-roster td:nth-child(1) { grid-area: character; }
  .raid-roster td:nth-child(2) { grid-area: discord; }
  .raid-roster td:nth-child(3) { grid-area: interest; justify-self: end; text-align: right; }
  .raid-roster td:nth-child(4) { grid-area: class; }
  .raid-roster td:nth-child(5) { grid-area: specialization; }
  .raid-roster td:nth-child(6) { grid-area: role; }
  .raid-roster td:nth-child(7) { grid-area: note; }
  .raid-roster td:nth-child(8) { grid-area: changed; display: flex; align-items: baseline; gap: 7px; }
  .raid-roster td:not(:nth-child(3))::before { display: block; margin-bottom: 2px; color: var(--raid-muted); font-size: 11px; content: attr(data-label); }
  .raid-roster td:nth-child(8)::before { margin-bottom: 0; }
}
@media (max-width: 520px) {
  .raid-character-fields { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .raid-class-counts { grid-template-columns: 1fr; }
  .raid-roster tbody tr {
    grid-template-areas:
      "character character character interest interest interest"
      "discord discord discord interest interest interest"
      "class class class class class class"
      "specialization specialization specialization specialization role role"
      "note note note note note note"
      "changed changed changed changed changed changed";
  }
}
