:root {
  --bg: #f4efe6;
  --bg-2: #efe2d1;
  --ink: #231f18;
  --muted: #6c6254;
  --accent: #0f8b8d;
  --accent-2: #ef6f4c;
  --accent-3: #184a45;
  --card: #fff9f1;
  --stroke: #e4d6c2;
  --shadow: 0 18px 35px rgba(35, 31, 24, 0.12);
  --radius: 16px;
}

:root[data-theme="dark"] {
  --bg: #0f1316;
  --bg-2: #161c22;
  --ink: #f5efe6;
  --muted: #b8aa9b;
  --accent: #7ddad6;
  --accent-2: #f4a07a;
  --accent-3: #f0c36b;
  --card: #141a20;
  --stroke: #28323a;
  --shadow: 0 18px 35px rgba(5, 7, 9, 0.45);
}

* {
  box-sizing: border-box;
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 15%, rgba(239, 111, 76, 0.18), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(15, 139, 141, 0.18), transparent 40%),
    radial-gradient(circle at 30% 85%, rgba(24, 74, 69, 0.12), transparent 45%),
    repeating-linear-gradient(135deg, rgba(35, 31, 24, 0.04), rgba(35, 31, 24, 0.04) 1px, transparent 1px, transparent 7px);
  background-attachment: fixed;
}

:root[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 12% 15%, rgba(244, 160, 122, 0.14), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(125, 218, 214, 0.16), transparent 40%),
    radial-gradient(circle at 30% 85%, rgba(240, 195, 107, 0.12), transparent 45%),
    repeating-linear-gradient(135deg, rgba(245, 239, 230, 0.04), rgba(245, 239, 230, 0.04) 1px, transparent 1px, transparent 7px);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", "Space Grotesk", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.2px;
}

p {
  margin: 0;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 12px;
}

.nav-controls,
.toggles {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-controls {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px 8px;
}

.brand h1 {
  font-size: 28px;
  color: var(--accent-3);
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

main {
  padding: 12px 32px 32px;
  max-width: 1120px;
  margin: 0 auto;
}

.hidden {
  display: none;
}

.panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.6s ease both;
  animation-delay: var(--delay, 0s);
}

.panel + .panel {
  margin-top: 16px;
}

.list-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

.input {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fffdf7;
  color: var(--ink);
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: rgba(15, 139, 141, 0.6);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.15);
}

.select-input {
  min-width: 120px;
}

.button-row,
.summary-actions,
.kill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(35, 31, 24, 0.12);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #18a5a8);
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-2), #f08b6e);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--muted);
}

.btn-danger {
  background: #2e1610;
  color: #fff;
}

.raidRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.6);
  margin-bottom: 10px;
}

.raidInfo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.raidCreator {
  font-size: 12px;
}

.raid-view {
  margin-top: 8px;
}

.raid-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.raid-summary {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.timer-card {
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(15, 139, 141, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.timer-label {
  font-size: 12px;
  color: var(--muted);
}

#raidTimer {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-3);
}

.players-block h3 {
  margin-bottom: 10px;
}

.host-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 139, 141, 0.12);
  border: 1px solid rgba(15, 139, 141, 0.25);
  font-size: 12px;
  color: var(--accent-3);
}

.host-badge span {
  color: var(--muted);
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.player-card {
  background: rgba(15, 139, 141, 0.08);
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(15, 139, 141, 0.2);
}

.remove-player-btn {
  border: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(46, 22, 16, 0.15);
  color: var(--accent-3);
  font-size: 11px;
  cursor: pointer;
}

.player-roll {
  background: rgba(35, 31, 24, 0.08);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}

.loot-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-input {
  padding: 8px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.gallery img {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid rgba(35, 31, 24, 0.08);
}

.thumb-container {
  position: relative;
}

.thumb-container .remove-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  opacity: 0.9;
}

.remove-btn {
  background: #2e1610;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.won-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.won-list .won-item {
  background: rgba(239, 111, 76, 0.08);
  border: 1px solid rgba(239, 111, 76, 0.2);
  padding: 10px;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.won-item .remove-btn {
  margin-left: auto;
  background: var(--accent-2);
}

.kill-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checked-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.howto-panel {
  margin-top: 16px;
}

.howto-panel h3 {
  margin-bottom: 8px;
}

.role-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.role-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(15, 19, 22, 0.7);
  font-size: 12px;
  color: var(--muted);
}

.role-option input {
  margin: 0;
}

.group-card {
  border: 1px solid var(--stroke);
  background: rgba(15, 19, 22, 0.7);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.group-card .meta {
  color: var(--muted);
  font-size: 12px;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.lobby-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-pill {
  background: rgba(15, 139, 141, 0.12);
  border: 1px solid rgba(15, 139, 141, 0.2);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.ready-panel {
  border: 1px dashed var(--stroke);
  padding: 12px;
  border-radius: 12px;
  background: rgba(15, 139, 141, 0.08);
}

.ready-info {
  margin: 10px 0;
  font-size: 13px;
  color: var(--muted);
}

.request-panel {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 19, 22, 0.7);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-card {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.request-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.kill-list {
  max-height: 220px;
  overflow: auto;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.6);
}

.kill-list .entry {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(35, 31, 24, 0.06);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fffdf7;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  gap: 16px;
  max-width: 920px;
  width: 100%;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  position: relative;
}

.modal-top-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2;
}

.modal-form {
  flex-direction: column;
  max-width: 520px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 14px;
}

.option-pill input {
  margin: 0;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.modal-content img {
  max-height: 360px;
  width: 320px;
  border-radius: 12px;
  object-fit: cover;
}

.modal-close {
  position: static;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#modalPlayers .player-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(35, 31, 24, 0.06);
  margin-bottom: 8px;
  align-items: center;
}

#modalPlayers .player-row.winner {
  background: rgba(15, 139, 141, 0.18);
}

:root[data-theme="dark"] #modalPlayers .player-row.winner {
  background: rgba(125, 218, 214, 0.22);
  border: 1px solid rgba(125, 218, 214, 0.4);
  box-shadow: 0 0 0 1px rgba(125, 218, 214, 0.15);
}

:root[data-theme="dark"] .host-badge {
  background: rgba(125, 218, 214, 0.14);
  border-color: rgba(125, 218, 214, 0.3);
  color: var(--accent-3);
}

#modalPlayers .player-row .name {
  font-weight: 600;
}

#modalPlayers .player-row button {
  border: none;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--accent-3);
  color: #fff;
  cursor: pointer;
}

#assignLog {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

:root[data-theme="dark"] .input {
  background: #0f1419;
  color: var(--ink);
  border-color: rgba(245, 239, 230, 0.08);
}

:root[data-theme="dark"] .raidRow,
:root[data-theme="dark"] .kill-list {
  background: rgba(15, 19, 22, 0.7);
}

:root[data-theme="dark"] .modal-content {
  background: #11161b;
}

:root[data-theme="dark"] .option-pill {
  background: rgba(15, 19, 22, 0.7);
  border-color: rgba(245, 239, 230, 0.12);
}

:root[data-theme="dark"] #modalPlayers .player-row {
  background: rgba(245, 239, 230, 0.06);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-controls,
  .toggles {
    width: 100%;
    justify-content: flex-start;
  }

  main {
    padding: 12px 18px 28px;
  }

  .raid-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    flex-direction: column;
  }

  .modal-content img {
    width: 100%;
    max-height: 260px;
  }
}
