:root {
  --bg: #121212;
  --bg-elevated: #1e1e1e;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #9a9a9a;
  --accent: #4f9cff;
  --accent-hover: #3a85e8;
  --horde: #e04040;
  --alliance: #4080e0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.header-left {
  flex: 0 0 auto;
}

.header-left h1 {
  font-size: 1.25rem;
  margin: 0;
}

.site-title {
  color: var(--text);
  text-decoration: none;
}

.main-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover {
  color: var(--text);
}

.main-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.account-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.display-name-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  padding: 0.4rem 0.6rem;
  font-weight: 600;
  font-size: 1rem;
}

.display-name-btn:hover {
  background: var(--bg);
  border-color: var(--border);
}

.display-name-input {
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  width: 160px;
}

main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

main.wide-main {
  max-width: none;
}

main.home-main {
  max-width: 1280px;
}

.btn-primary,
button {
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover,
button:hover {
  background: var(--accent-hover);
}

.characters-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.character-card:hover {
  border-color: var(--text-muted);
}

.character-card.selected {
  border-color: var(--accent);
  background: #17233a;
}

.card-image {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-class {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.submit-bar {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  padding-bottom: 2rem;
}

.status {
  color: var(--text-muted);
  min-height: 1.2em;
}

.admin-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-form input {
  flex: 1;
  max-width: 300px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 1rem;
}

.admin-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.admin-table select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.boss-max-players-input {
  width: 70px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.boss-mount-id-input {
  width: 90px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.boss-remove-btn {
  background: transparent;
  border: 1px solid var(--horde);
  color: var(--horde);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-weight: 700;
  cursor: pointer;
}

.boss-remove-btn:hover {
  background: var(--horde);
  color: #0d0d0d;
}

.boss-section {
  margin-bottom: 2rem;
}

.boss-section h3 {
  margin-bottom: 0.75rem;
}

.boss-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.boss-card-row .character-card {
  flex: 0 0 220px;
}

.note-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.note-input:focus {
  outline: none;
  border-color: var(--accent);
}

.role-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.player-section {
  margin-bottom: 2rem;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.player-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.player-card-row .character-card {
  cursor: grab;
}

.player-card-row .character-card.dragging {
  opacity: 0.4;
}

.slot-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.slot-toolbar .slot-publish-btn {
  width: auto;
  padding: 0.5rem 1.25rem;
}

.slot-toolbar-bottom {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.slot-auto-clear-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.slot-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.slot-table {
  border-collapse: collapse;
  width: 100%;
}

.slot-table th,
.slot-table td {
  border: 1px solid var(--border);
  padding: 0.6rem;
  vertical-align: top;
  text-align: left;
}

.slot-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.slot-row-label {
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-elevated);
}

.slot-cell {
  min-width: 180px;
}

.slot-cell.has-gear-request {
  background: #3a2f12;
}

.slot-cell-disabled {
  background: var(--bg);
}

.slot-name-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
}

.slot-name-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.slot-name-btn.slotted {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.slot-name-btn.slotted:hover {
  background: var(--bg-elevated);
}

.slot-name-btn-avatar {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
}

.slot-name-btn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slot-dropdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slot-dropdown-floating {
  position: fixed;
  z-index: 100;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-height: 320px;
  overflow-y: auto;
}

.slot-card {
  width: 100%;
}

.slot-buyer-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.slot-buyer-name-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.slot-dropdown-clear {
  width: 100%;
  background: transparent;
  color: var(--horde);
  border: 1px solid var(--horde);
  border-radius: 6px;
  padding: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.slot-dropdown-clear:hover {
  background: var(--horde);
  color: #0d0d0d;
}

.slot-note-emoji {
  margin-left: 0.4rem;
  cursor: help;
}

.slot-mount-badge {
  margin-left: 0.3rem;
  cursor: help;
}

th.boss-header-cell {
  white-space: normal;
  text-align: center;
}

.boss-header-row {
  display: grid;
  grid-template-columns: 18px 1fr 22px;
  align-items: center;
  gap: 0.4rem;
}

.boss-warning {
  position: relative;
  cursor: help;
  font-size: 0.9rem;
  justify-self: start;
}

.boss-warning[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 125%;
  left: 0;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  white-space: pre-line;
  width: max-content;
  max-width: 220px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.boss-header-name {
  text-align: center;
}

.boss-copy-btn {
  justify-self: end;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
}

.boss-copy-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.boss-slotted-count {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  text-align: center;
  color: var(--text-muted);
}

.slot-name-btn.buyer {
  color: #d4af37;
  border-color: #d4af37;
}

.slot-table tfoot td {
  background: var(--bg);
  border-top: 2px solid var(--border);
  vertical-align: top;
}

.slot-publish-inner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.75rem;
}

.slot-publish-btn {
  width: 100%;
  padding: 0.4rem;
  font-size: 0.85rem;
}

.slot-buyer-btn {
  background: transparent;
  border: 1px solid #d4af37;
  color: #d4af37;
}

.slot-buyer-btn:hover {
  background: #d4af37;
  color: #0d0d0d;
}

.slot-publish-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.boss-tables-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  max-width: 1280px;
  margin: 1.5rem auto 0;
}

.boss-table-card {
  width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.boss-table-title {
  background: var(--accent);
  color: #0d0d0d;
  font-weight: 700;
  text-align: center;
  padding: 0.5rem;
}

.boss-public-table {
  border-collapse: collapse;
  width: 100%;
}

.boss-public-table th,
.boss-public-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  text-align: center;
}

.boss-public-table th {
  color: #0d0d0d;
  font-weight: 700;
}

.boss-public-table th.role-tank {
  background: #c0392b;
}

.boss-public-table th.role-melee {
  background: #7b241c;
}

.boss-public-table th.role-ranged {
  background: #2e6da4;
}

.boss-public-table th.role-healer {
  background: #1e8a6e;
}

.boss-public-table td.role-count {
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
}

.run-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.run-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.4rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.run-tab:hover {
  color: var(--text);
  border-color: var(--accent);
}

.run-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
}
