.party-shell { display: grid; gap: 18px; }
.party-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.party-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.party-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.party-upload-button, .party-action { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; color: var(--text); font: inherit; font-size: .78rem; font-weight: 900; border: 1px solid #38616a; border-radius: 9px; background: #10282e; cursor: pointer; }
.party-action.primary { color: #031315; border-color: var(--cyan); background: var(--cyan); }
.party-action:disabled { opacity: .42; cursor: not-allowed; }
.owned-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.owned-switch input { accent-color: var(--cyan); }
.party-source { color: var(--muted); font-size: .72rem; }
.party-lead-picker { display: grid; grid-template-columns: minmax(220px, .65fr) minmax(300px, 1.35fr); gap: 14px; align-items: center; padding: 13px 14px; border: 1px solid #2e555d; border-radius: 13px; background: linear-gradient(145deg, rgba(17,48,54,.92), rgba(8,25,30,.96)); }
.party-lead-picker-copy strong { display: block; color: var(--cyan); font-size: .72rem; letter-spacing: .055em; text-transform: uppercase; }
.party-lead-picker-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.party-lead-select { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 58px; padding: 7px 9px; color: var(--text); text-align: left; font: inherit; border: 1px solid #42737a; border-radius: 11px; background: rgba(6,22,27,.9); cursor: pointer; }
.party-lead-select:hover, .party-lead-select:focus-visible { border-color: var(--cyan); outline: 2px solid rgba(82,214,208,.2); outline-offset: 2px; }
.party-lead-select-icon { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; color: var(--cyan); font-size: 1.25rem; font-weight: 900; border: 1px solid #315a62; border-radius: 9px; background: #10282e; }
.party-lead-select-icon img { width: 42px; height: 42px; object-fit: contain; }
.party-lead-select-name { display: block; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.party-lead-select-meta { display: block; margin-top: 2px; color: #88aeb2; font-size: .66rem; }
.party-lead-select-action { padding: 6px 8px; color: #071b1d; font-size: .64rem; font-weight: 950; letter-spacing: .05em; text-transform: uppercase; border-radius: 7px; background: var(--cyan); }

/* Lead on top (full width), four supports underneath */
.party-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.party-slot {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(155deg, #0d2026, #09161b);
  overflow: visible;
}
.party-slot.is-lead {
  grid-column: 1 / -1;
  border-color: #3a7d7f;
  background: linear-gradient(145deg, #102a30, #0a1a1f);
  box-shadow: 0 0 0 1px rgba(92,235,220,.08), 0 16px 40px rgba(0,0,0,.2);
}
.party-slot-button {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  align-content: start;
  width: 100%;
  min-height: 100%;
  padding: 42px 12px 12px;
  color: var(--text);
  text-align: left;
  font: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 14px;
}
.party-slot.is-lead .party-slot-button {
  grid-template-columns: 110px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 16px;
  row-gap: 8px;
  padding: 40px 16px 16px;
  align-items: start;
}
.party-slot-button:hover, .party-slot-button:focus-visible {
  background: rgba(82, 214, 208, .055);
  outline: 2px solid rgba(82, 214, 208, .35);
  outline-offset: -2px;
}
.party-slot-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
  gap: 8px;
}
.party-slot.is-lead .party-slot-empty { min-height: 140px; }
.party-slot-empty span:first-child {
  display: grid; place-items: center; width: 54px; height: 54px;
  color: var(--cyan); font-size: 1.7rem; border: 1px dashed #3d6971; border-radius: 13px;
}
.party-slot-empty small { font-size: .72rem; }

.party-pal-art { display: grid; place-items: center; }
.party-slot.is-lead .party-pal-art { grid-row: 1 / span 3; align-self: center; }
.party-pal-art img {
  width: 86px; height: 86px; object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.38));
}
.party-slot.is-lead .party-pal-art img { width: 104px; height: 104px; }

.party-pal-copy { min-width: 0; text-align: center; }
.party-slot.is-lead .party-pal-copy { text-align: left; }
.party-pal-copy b {
  display: block; font-size: .9rem; line-height: 1.25;
  overflow-wrap: anywhere;
}
.party-pal-copy small {
  display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.35;
}

.party-ability {
  display: grid; gap: 6px; min-width: 0; margin-top: 0; padding: 10px;
  text-align: left; border: 1px solid #2d4e57; border-radius: 11px;
  background: linear-gradient(145deg, rgba(21,52,59,.8), rgba(10,27,32,.88));
}
.party-slot.is-lead .party-ability { margin-top: 0; }
.party-ability-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
}
.party-ability-name {
  display: block; min-width: 0; flex: 1 1 8rem;
  color: #71e3dc; font-size: .72rem; font-weight: 900; letter-spacing: .03em; line-height: 1.3;
  overflow-wrap: anywhere;
}
.party-ability-scope {
  flex: 0 1 auto; max-width: 100%;
  padding: 3px 7px; color: #c5e0e3; font-size: .6rem; font-weight: 900;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1.2;
  border: 1px solid #3a5f67; border-radius: 999px; background: rgba(8,24,28,.75);
  white-space: normal; overflow-wrap: anywhere;
}
.party-ability-description {
  display: block; margin: 0; color: #b5d0d4; font-size: .7rem; line-height: 1.45;
  overflow-wrap: anywhere;
  /* full text — was line-clamped and unreadable in narrow 5-up cards */
}

.party-reason {
  display: block; margin: 0; padding: 8px 10px;
  color: #e8fbf9; font-size: .7rem; font-weight: 750; line-height: 1.45;
  border: 1px solid rgba(82,214,208,.28); border-radius: 10px;
  background: rgba(33,105,105,.2);
  overflow-wrap: anywhere;
}
.party-reason::before {
  content: "WHY · "; color: var(--cyan); font-size: .62rem; font-weight: 900; letter-spacing: .06em;
}
.party-slot.is-lead .party-reason { grid-column: 2; }

.party-slot-state {
  position: absolute; z-index: 2; top: 9px; left: 9px;
  padding: 5px 8px; color: #9bb8bc; font: inherit; font-size: .62rem; font-weight: 900;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  border: 1px solid #376169; border-radius: 999px; background: rgba(5, 15, 18, .92); cursor: pointer;
}
.party-slot-state:hover { color: var(--cyan); border-color: #4a8b8a; }
.party-slot-state.is-active {
  color: #062325; border-color: var(--cyan); background: var(--cyan);
  box-shadow: 0 0 18px rgba(82,214,208,.2);
}

.party-slot-clear {
  position: absolute; z-index: 2; top: 8px; right: 8px;
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0; margin: 0;
  color: #b6d0d4; font: inherit; font-size: 1.15rem; font-weight: 700; line-height: 1;
  border: 1px solid #31515a; border-radius: 8px; background: rgba(6, 18, 22, .94); cursor: pointer;
}
.party-slot-clear:hover { color: #fff; border-color: #5a8a90; background: #143238; }

.party-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.party-results { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 14px; }
.party-result-panel { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.party-result-panel h2 { margin: 0 0 5px; font-size: 1rem; }
.party-result-panel > p { margin: 0 0 14px; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.synergy-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.synergy-card { min-width: 0; padding: 12px; border: 1px solid #294851; border-radius: 12px; background: linear-gradient(145deg, #0d2228, #0a191e); }
.synergy-card-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.synergy-card-head img { width: 44px; height: 44px; object-fit: contain; border-radius: 9px; background: #10252b; }
.synergy-card-head b { display: block; overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.synergy-card-head small { display: block; overflow: hidden; margin-top: 2px; color: #78dcd6; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.synergy-card-state { padding: 4px 6px; color: #8fb0b5; font-size: .58rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; border: 1px solid #31515a; border-radius: 999px; }
.synergy-description { margin: 9px 0 0; color: #a7c1c5; font-size: .72rem; line-height: 1.5; overflow-wrap: anywhere; }
.reason-bubbles { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.reason-bubble {
  display: grid; gap: 4px; padding: 8px 9px; color: #d8eeef; font-size: .68rem; line-height: 1.4;
  border: 1px solid #31515a; border-radius: 9px; background: #10252b; overflow-wrap: anywhere;
}
.reason-bubble em {
  color: #77ded7; font-size: .58rem; font-style: normal; font-weight: 950;
  letter-spacing: .06em; text-transform: uppercase;
}
.reason-bubble.status { border-color: #5963a2; background: rgba(71,77,143,.2); }
.reason-bubble.status em { color: #b9bdff; }
.reason-bubble.element { border-color: #397865; background: rgba(39,112,83,.18); }
.reason-bubble.element em { color: #77e2b8; }
.reason-bubble.utility { border-color: #72613b; background: rgba(113,89,37,.16); }
.reason-bubble.utility em { color: #f0cc79; }
.coverage { display: flex; flex-wrap: wrap; gap: 7px; }
.coverage span { padding: 5px 8px; color: #b9d5d8; font-size: .68rem; font-weight: 800; border: 1px solid #31515a; border-radius: 999px; background: #0c2025; }
.party-empty-copy { color: var(--muted); font-size: .72rem; line-height: 1.55; }
.party-source-note { color: var(--muted); font-size: .68rem; line-height: 1.5; }

@media (max-width: 960px) {
  .party-grid { grid-template-columns: 1fr 1fr; }
  .party-results { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .synergy-list { grid-template-columns: 1fr; }
  .party-slot.is-lead .party-slot-button {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .party-slot.is-lead .party-pal-art { grid-row: auto; }
  .party-slot.is-lead .party-reason { grid-column: auto; }
  .party-slot.is-lead .party-pal-copy { text-align: center; }
}
@media (max-width: 620px) {
  .party-grid { grid-template-columns: 1fr; }
  .party-toolbar { align-items: flex-start; flex-direction: column; }
  .party-lead-picker { grid-template-columns: 1fr; }
}
