:root {
  --bg-ink: #08110d;
  --bg-forest: #102118;
  --bg-olive: #253824;
  --panel: rgba(14, 24, 19, 0.84);
  --panel-strong: rgba(11, 18, 14, 0.94);
  --line: rgba(240, 221, 179, 0.18);
  --line-strong: rgba(240, 221, 179, 0.36);
  --text: #f6ecd2;
  --muted: #cfbf97;
  --gold: #d7af5b;
  --green: #87b27d;
  --yellow: #f3d74b;
  --orange: #f28f35;
  --red: #de5a48;
  --purple: #9d76d1;
  --black: #121212;
  --success: #84c68d;
  --danger: #f08c7d;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(
      circle at top left,
      rgba(215, 175, 91, 0.14),
      transparent 32%
    ),
    radial-gradient(
      circle at top right,
      rgba(113, 85, 147, 0.18),
      transparent 30%
    ),
    linear-gradient(180deg, var(--bg-forest), var(--bg-ink) 58%);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  background: linear-gradient(180deg, #e0be6d, #a97a31);
  color: #1a1308;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.button-danger {
  background: linear-gradient(180deg, #da7f6e, #9f3b2f);
  color: #fff8ee;
}

.button-success {
  background: linear-gradient(180deg, #99d59c, #4f8455);
  color: #041106;
}

.page-shell {
  width: min(1400px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.topbar {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 4vw, 3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 40rem;
}

.nav-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nav-pills a {
  text-decoration: none;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
}

.nav-pills a.active {
  border-color: var(--gold);
  background: rgba(215, 175, 91, 0.15);
}

.banner,
.card,
.board-card,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.banner {
  border-radius: 18px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.banner-success {
  border-color: rgba(132, 198, 141, 0.4);
}

.banner-error {
  border-color: rgba(240, 140, 125, 0.5);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card,
.board-card,
.detail-card {
  border-radius: 22px;
  padding: 1.1rem;
}

.card h2,
.board-card h2,
.detail-card h2,
.detail-card h3 {
  margin: 0 0 0.85rem;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.rule-grid,
.summary-grid,
.admin-grid,
.claim-grid,
.team-grid {
  display: grid;
  gap: 1rem;
}

.rule-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  height: 52px;
}

.claim-grid {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.admin-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
}

.team-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stat {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.04);
}

.stat-label {
  color: var(--muted);
  display: block;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
}

.field-stack,
.button-row,
.member-list,
.tile-meta,
.entry-list,
.line-stack {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.field-stack {
  flex-direction: column;
}

.line-stack {
  flex-direction: column;
  gap: 0.35rem;
}

label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 14, 11, 0.9);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.pill,
.member-pill,
.entry-pill {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.86rem;
}

.pill-yellow,
.member-yellow {
  background: rgba(219, 195, 79, 0.15);
  border-color: rgba(219, 195, 79, 0.36);
}

.pill-orange,
.member-orange {
  background: rgba(215, 133, 57, 0.16);
  border-color: rgba(215, 133, 57, 0.35);
}

.pill-red,
.member-red {
  background: rgba(185, 75, 61, 0.18);
  border-color: rgba(185, 75, 61, 0.35);
}

.pill-purple {
  background: rgba(113, 85, 147, 0.2);
  border-color: rgba(113, 85, 147, 0.4);
}

.pill-success {
  background: rgba(132, 198, 141, 0.16);
  border-color: rgba(132, 198, 141, 0.32);
}

.pill-danger {
  background: rgba(240, 140, 125, 0.18);
  border-color: rgba(240, 140, 125, 0.35);
}

.leaderboard {
  display: grid;
  gap: 0.7rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.9rem;
  align-items: center;
  border-radius: 18px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--text);
}

.leaderboard-row.active {
  border-color: rgba(215, 175, 91, 0.48);
  background: rgba(215, 175, 91, 0.14);
}

.rank {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(215, 175, 91, 0.16);
  border: 1px solid rgba(215, 175, 91, 0.3);
  font-weight: 700;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 1rem;
  align-items: start;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
}

.tile-cell {
  position: relative;
  min-height: 96px;
  border: 1px solid rgba(255, 248, 224, 0.18);
  border-radius: 18px;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.18);
  text-align: left;
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.tile-cell:hover {
  transform: translateY(-1px);
}

.tile-cell.selected {
  outline: 2px solid rgba(215, 175, 91, 0.7);
}

.tile-cell.complete {
  background:
    radial-gradient(
      circle at top right,
      rgba(206, 255, 189, 0.4),
      transparent 46%
    ),
    linear-gradient(180deg, rgba(92, 183, 101, 0.94), rgba(30, 112, 52, 0.98)) !important;
  border-color: rgba(219, 255, 216, 0.42);
}

.tile-cell.complete::after,
.tile-cell.partial::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.tile-cell.complete::after {
  box-shadow: inset 0 0 0 2px rgba(225, 255, 227, 0.75);
}

.tile-cell.partial::after {
  box-shadow: inset 0 0 0 2px rgba(215, 175, 91, 0.55);
}

.tile-cell-yellow {
  background:
    radial-gradient(
      circle at top right,
      rgba(243, 215, 75, 0.34),
      transparent 44%
    ),
    linear-gradient(180deg, rgba(243, 215, 75, 0.3), rgba(86, 68, 16, 0.88));
}

.tile-cell-orange {
  background:
    radial-gradient(
      circle at top right,
      rgba(242, 143, 53, 0.34),
      transparent 44%
    ),
    linear-gradient(180deg, rgba(242, 143, 53, 0.3), rgba(93, 44, 10, 0.88));
}

.tile-cell-red {
  background:
    radial-gradient(
      circle at top right,
      rgba(222, 90, 72, 0.34),
      transparent 44%
    ),
    linear-gradient(180deg, rgba(222, 90, 72, 0.32), rgba(83, 20, 16, 0.9));
}

.tile-cell-purple {
  background:
    radial-gradient(
      circle at top right,
      rgba(157, 118, 209, 0.38),
      transparent 46%
    ),
    linear-gradient(180deg, rgba(157, 118, 209, 0.34), rgba(45, 28, 71, 0.92));
}

.tile-cell-black {
  background:
    radial-gradient(
      circle at top right,
      rgba(215, 175, 91, 0.24),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(51, 51, 51, 0.72), rgba(17, 17, 17, 0.98));
}

.tile-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.tile-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1rem;
}

.tile-icon-shared,
.tile-icon-event {
  background: rgba(157, 118, 209, 0.26);
}

.tile-icon-rng {
  background: rgba(243, 215, 75, 0.26);
}

.tile-icon-misc {
  background: rgba(255, 255, 255, 0.14);
}

.tile-icon-skilling {
  background: rgba(132, 198, 141, 0.24);
}

.tile-icon-pvm {
  background: rgba(222, 90, 72, 0.24);
}

.tile-points {
  font-size: 0.78rem;
  color: rgba(255, 244, 214, 0.94);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.tile-title {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-progress {
  margin-top: 0.6rem;
  height: 0.42rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 14, 11, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.tile-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(233, 220, 255, 0.95),
    rgba(157, 118, 209, 1)
  );
}

.tile-cell.complete .tile-progress {
  background: rgba(11, 53, 17, 0.32);
  border-color: rgba(225, 255, 227, 0.25);
}

.tile-cell.complete .tile-progress-bar {
  background: linear-gradient(
    90deg,
    rgba(225, 255, 227, 0.94),
    rgba(170, 240, 169, 1)
  );
}

.tile-foot {
  margin-top: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  color: rgba(255, 244, 214, 0.9);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-card {
  position: sticky;
  top: 1rem;
  background: var(--panel-strong);
}

.detail-card p {
  color: var(--muted);
}

.team-summary-card {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.team-summary-grid .stat {
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
}

.team-summary-grid .stat-label {
  font-size: 0.72rem;
}

.team-summary-grid .stat-value {
  font-size: 1.1rem;
}

.entry-list {
  flex-direction: column;
  align-items: stretch;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.photo-item {
  padding-bottom: 0.6rem;
}

.entry-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.entry-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.proof-preview {
  margin-top: 0.65rem;
}

.proof-preview-link {
  display: block;
  width: min(100%, 260px);
  border-radius: 12px;
  overflow: hidden;
}

.proof-preview img {
  display: block;
  width: 100%;
  max-width: none;
  max-height: 260px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
}

.claim-strip-card {
  padding: 0.8rem 0.95rem;
}

.claim-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.claim-strip-main,
.claim-role-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.claim-name {
  font-weight: 700;
  font-size: 1rem;
}

.claim-team {
  color: var(--muted);
  font-size: 0.92rem;
}

.claim-role-button,
.upload-clipboard-button {
  padding: 0.52rem 0.8rem;
  font-size: 0.72rem;
}

.icon-button {
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.claim-strip-note,
.upload-hint {
  margin: 0.55rem 0 0;
}

.team-name-inline {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.team-name-inline input {
  flex: 1 1 220px;
}

.upload-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.upload-preview {
  margin-top: 0.7rem;
  padding: 0.6rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.upload-preview-image-wrap {
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
}

.upload-preview-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.82rem;
}

.busy-indicator {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(11, 18, 14, 0.95);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 1rem;
}

@media (max-width: 1120px) {
  .hero,
  .admin-grid,
  .board-layout {
    grid-template-columns: 1fr;
  }

  .detail-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 1rem, 100%);
    padding-top: 0.8rem;
  }

  .topbar,
  .claim-grid,
  .summary-grid,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .board-grid {
    gap: 0.4rem;
  }

  .tile-cell {
    min-height: 86px;
    padding: 0.5rem;
  }

  .tile-title {
    font-size: 0.78rem;
  }

  .leaderboard-row {
    grid-template-columns: auto 1fr;
  }

  .claim-strip,
  .team-name-inline,
  .upload-control-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .upload-clipboard-button,
  .team-name-inline button {
    width: 100%;
  }
}
