:root {
  color-scheme: dark;
  --bg: #1b1d22;
  --panel: #24262d;
  --border: #3a3d46;
  --text: #e8e8ea;
  --accent: #5b8def;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header h1 { margin: 0; font-size: 1.4rem; }

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  color: var(--accent);
}

.wcl-auth-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wcl-auth-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f2a03d;
}

.wcl-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #f7971e, #d6431f);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.wcl-login-btn:hover { filter: brightness(1.1); }

.wcl-logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}

.wcl-logout-btn:hover {
  border-color: #d6431f;
  color: #f2a03d;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.step {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.step.hidden { display: none; }

.hidden { display: none !important; }

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.field-row label { min-width: 160px; }

.field-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field-column select { min-width: 240px; }

input[type="text"], select, textarea {
  background: #14151a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.95rem;
}

input[type="text"] { flex: 1; min-width: 260px; }

textarea {
  width: 100%;
  font-family: Consolas, "Courier New", monospace;
  resize: vertical;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

button:hover { filter: brightness(1.1); }

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.status { color: #ff9d6f; min-height: 1.2em; }
.status.ok { color: #7fd68a; }

.hint { opacity: 0.75; font-size: 0.9rem; margin-top: -0.5rem; }

#boss-select-wrap {
  margin-top: 1rem;
}

#boss-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.boss-btn {
  background: #2e313a;
  border: 1px solid var(--border);
}

.boss-btn:hover { background: var(--accent); }

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recent-item {
  background: #2e313a;
  border: 1px solid var(--border);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.recent-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.recent-item-time {
  font-size: 0.75rem;
  opacity: 0.65;
}

.recent-item:hover { background: var(--accent); }

.recent-list-column {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}

.recent-list-column .recent-item {
  flex-direction: row;
  justify-content: space-between;
  max-width: none;
}

.recent-list-column .recent-item span { max-width: none; }

#guild-reports-wrap {
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

#roster-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: minmax(90px, auto);
  gap: 0.6rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.role-group-label {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-top: 0.75rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}

.role-group-label:first-child { margin-top: 0; }

.roster-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  color: #111;
  font-weight: 600;
  min-width: 0;
}

.roster-row .char-name {
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
}

.roster-row input[type="text"] {
  background: rgba(255,255,255,0.9);
  color: #111;
  font-weight: 500;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
  padding: 0.35rem 0.4rem;
  font-size: 0.9rem;
}

.assignment-block {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.assignment-block h3 {
  margin: 0;
  padding: 0.6rem 0.9rem;
  color: #111;
}

.assignment-block h3 .unmatched-note {
  font-weight: 400;
  font-size: 0.8rem;
  color: #333;
  margin-left: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  text-align: left;
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--border);
}

table th {
  background: #1a1b20;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.8;
}

.spell-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spell-cell img {
  width: 24px;
  height: 24px;
  border-radius: 3px;
}

.spell-toggle-checkbox {
  cursor: pointer;
  flex-shrink: 0;
}

tr.spell-row-hidden {
  display: none;
}

.spell-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: #1a1b20;
  border-top: 1px solid var(--border);
}

.spell-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.spell-filter-item img {
  width: 20px;
  height: 20px;
  border-radius: 3px;
}

/* ---------- Accordions (character blocks + pull wrappers) ---------- */

.accordion-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem !important;
}

.accordion-header::after {
  content: "\25B8"; /* ▸ */
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.15s ease;
  opacity: 0.8;
}

.accordion-header.is-open::after {
  transform: translateY(-50%) rotate(90deg);
}

.pull-accordion {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.pull-accordion-heading {
  margin: 0;
  padding: 0.7rem 0.9rem;
  background: #2e313a;
  font-size: 1.05rem;
}

.pull-accordion-body {
  padding: 0.9rem;
}

.pull-accordion-body .assignment-block:last-child {
  margin-bottom: 0;
}

.casted-missed { color: #ff6b6b; font-weight: 600; }
.casted-exact { color: #7fd68a; font-weight: 600; }
.casted-offset { color: #f0c674; font-weight: 600; }
.casted-offset-late { color: #ff6b6b; }

.casted-dead {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.casted-dead .casted-icon-skull {
  font-size: 1.1em;
  line-height: 1;
}

/* ---------- Pulls grid (step 4) ---------- */

.pulls-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: #101115;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.pulls-topbar-boss {
  font-weight: 700;
  white-space: nowrap;
}

.pulls-topbar-diff {
  font-weight: 400;
  opacity: 0.7;
}

.pulls-topbar-summary {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  min-width: 260px;
}

.pulls-topbar-summary .pulls-wipe-label {
  color: #ff6b6b;
  font-weight: 600;
}

.pulls-topbar-time {
  opacity: 0.6;
  font-style: italic;
  margin-left: 0.4rem;
}

.pulls-topbar-count {
  opacity: 0.7;
  font-size: 0.85rem;
  white-space: nowrap;
}

.pulls-controls {
  margin-bottom: 0.75rem;
}

.pulls-all-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.pulls-all-btn:hover { text-decoration: underline; }

.pulls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}

.pull-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem 0.5rem;
  background: #14151a;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  min-width: 0;
}

.pull-tile:hover { border-color: var(--accent); }

.pull-tile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.pull-tile-pct {
  font-weight: 700;
}

.pull-tile-number {
  color: #e2723f;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.pull-tile-subrow {
  font-size: 0.72rem;
}

.pull-tile-phase {
  opacity: 0.65;
}

.pull-tile-time {
  opacity: 0.55;
  font-style: italic;
  white-space: nowrap;
}

.pull-tile-underline {
  height: 3px;
  border-radius: 2px;
  margin-top: 0.15rem;
}

.pct-grey { color: #c7c9d1; }
.pct-green { color: #6bcf6b; }
.pct-blue { color: #6ba8f0; }
.pct-purple { color: #b98af9; }
.pct-pink { color: #f06bd8; }
.pct-kill { color: #6bcf6b; }

.pull-tile-underline.pct-grey { background: #c7c9d1; }
.pull-tile-underline.pct-green { background: #6bcf6b; }
.pull-tile-underline.pct-blue { background: #6ba8f0; }
.pull-tile-underline.pct-purple { background: #b98af9; }
.pull-tile-underline.pct-pink { background: #f06bd8; }
.pull-tile-underline.pct-kill { background: #6bcf6b; }

/* ---------- Phase-trigger config panel ---------- */

.phase-config-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #202229;
}

.phase-config-panel h3 { margin-top: 0; }

.phase-config-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.phase-config-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.phase-config-label {
  font-size: 0.9rem;
  opacity: 0.85;
}

.phase-spellid-input, .phase-occurrence-input {
  width: 110px;
}
