/* The party board (party.html).
 *
 * Uses the app's own tokens from css/style.css — unlike css/card.css this page is
 * never serialised into an SVG, so it may reference them freely.
 */

.party {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) 64px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* ── Intake ─────────────────────────────────────────────────── */

.party-intake {
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.party-intake-title {
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
}

.party-intake-note {
  margin-bottom: var(--space-4);
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.party-intake-note code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.party-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.party-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  line-height: 1.6;
  resize: vertical;
}

.party-input:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 1px;
}

.party-intake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* A label styled as a button, wrapping a hidden file input. */
.party-file-btn { cursor: pointer; }

.party-error {
  margin-top: var(--space-3);
  color: var(--glow-extras);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Whole-page drop target — the button is too small to aim for. */
body.party-dragging .party-intake {
  border-color: var(--accent-bright);
  background: var(--surface-2);
}

/* ── Empty state ────────────────────────────────────────────── */

.party-empty {
  max-width: 560px;
  margin: var(--space-8) auto;
  text-align: center;
  color: var(--text-secondary);
}

.party-empty h2 { margin-bottom: var(--space-3); color: var(--text-primary); font-size: var(--text-xl); }
.party-empty p { margin-bottom: var(--space-4); line-height: 1.6; }

/* ── Sections ───────────────────────────────────────────────── */

/* The board is one child of .party, so its own sections get no spacing from that
 * gap — without this every section title sits flush against the block above it. */
#party-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.party-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.party-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--glow-wildcards);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.party-count {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0;
}

.party-section-note,
.party-none {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.party-fineprint {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* ── Roster ─────────────────────────────────────────────────── */

.party-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.party-member {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.party-member-face {
  width: 56px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

.party-member-face img { width: 100%; height: 100%; object-fit: cover; display: block; }

.party-member-initial {
  color: var(--text-muted);
  font-size: var(--text-xl);
  font-weight: 700;
}

.party-member-body { min-width: 0; }

.party-member-name {
  font-size: var(--text-base);
  font-weight: 700;
  /* Long names must not push the remove button off the card. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: var(--space-4);
}

.party-member-class {
  color: var(--glow-wildcards);
  font-size: var(--text-xs);
  font-weight: 600;
}

.party-member-line {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.party-member-best { color: var(--text-muted); }

.party-member-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.party-member-remove:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ── Overlap grid ───────────────────────────────────────────── */

.party-grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
}

.party-hour {
  /* --fill is the share of the placed roster available in this hour, so the grid
   * reads the same whether the party is 2 people or 9. */
  padding: var(--space-2) 0 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--glow-gaming) calc(var(--fill) * 62%), transparent);
  text-align: center;
}

.party-hour.is-best {
  border-color: var(--glow-gaming);
}

.party-hour-label {
  display: block;
  color: var(--text-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.party-hour-count {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Common ground ──────────────────────────────────────────── */

.party-shared {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.party-shared-group {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.party-shared-title {
  margin-bottom: var(--space-2);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--glow-gaming);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.party-shared-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }

.party-shared-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: baseline;
}

.party-shared-count {
  height: 20px;
  border: 1px solid var(--glow-gaming);
  border-radius: 50%;
  color: var(--glow-gaming);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.party-shared-label {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* Second row of the same grid cell: names sit under the title they share. */
.party-shared-people {
  grid-column: 2;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}

/* ── Only one of you ────────────────────────────────────────── */

.party-solo { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.party-solo-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: var(--text-xs);
}

.party-solo-chip strong { color: var(--text-primary); font-weight: 600; }
.party-solo-chip span { color: var(--text-muted); }

/* ── Classes ────────────────────────────────────────────────── */

.party-classes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.party-class {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--glow-wildcards);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.party-class-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}

.party-class-name { font-size: var(--text-sm); font-weight: 700; }

.party-class-count {
  color: var(--glow-wildcards);
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.party-class-people {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

/* ── Prompts ────────────────────────────────────────────────── */

.party-prompts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 1.4em;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.party-prompts strong { color: var(--text-primary); }

/* ── Narrow ─────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .party { padding: var(--space-4) var(--space-3) 40px; }

  /* 24 columns at phone width gives 8px cells: two rows of 12 stay legible. */
  .party-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}
