:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  --background: #080b12;
  --panel: #111722;
  --panel-light: #17202d;
  --border: #293449;
  --text: #f4f6fa;
  --muted: #aab4c5;
  --blue: #1687ff;
  --green: #55d69e;
  --yellow: #f2c94c;
  --red: #ff7b88;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 10px max(16px, calc((100vw - 1000px) / 2));
  background: #0d1119;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--blue);
  border-radius: 4px;
  font-weight: bold;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

nav a:hover {
  color: white;
  text-decoration: underline;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
}

.user-chip img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

main {
  width: min(1000px, calc(100% - 28px));
  margin: 28px auto 70px;
}

.panel,
.event-card,
.map-card,
.member-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 26px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 50px);
}

h2 {
  margin: 0;
  font-size: 26px;
}

h3 {
  margin: 0;
}

.accent {
  color: var(--blue);
}

.hero-description {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions,
.dialog-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions {
  margin-top: 18px;
}

.clan-icon {
  width: 100px;
  height: 100px;
  border: 1px solid var(--border);
  border-radius: 7px;
  object-fit: cover;
}

.stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat {
  padding: 13px;
  background: #0c111a;
  border: 1px solid var(--border);
  border-radius: 5px;
}

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

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 0 13px;
  color: white;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: bold;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #202b3c;
}

.button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.button-primary {
  background: #0969da;
  border-color: #237fe8;
}

.button-primary:hover {
  background: #1177eb;
}

.button-danger {
  color: #ff9da7;
  background: #2a151a;
  border-color: #61303a;
}

.button-small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.page-message {
  min-height: 20px;
  margin: 14px 2px;
  color: var(--green);
}

.page-message.error,
.form-error {
  color: var(--red);
}

.section-block {
  margin-top: 48px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-heading p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
}

.inset-panel {
  padding: 22px;
}

.compact-heading {
  margin-bottom: 14px;
}

.event-grid {
  display: grid;
  gap: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: 170px 1fr;
  overflow: hidden;
}

.event-cover {
  position: relative;
  min-height: 220px;
  background: #151e2c center / cover no-repeat;
  border-right: 1px solid var(--border);
}

.state-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 5px 7px;
  color: white;
  background: #263247;
  border: 1px solid #42516a;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.state-badge.active {
  color: #171000;
  background: var(--yellow);
  border-color: var(--yellow);
}

.state-badge.captured {
  color: #06130d;
  background: var(--green);
  border-color: var(--green);
}

.event-body {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 290px);
  gap: 18px;
  padding: 18px;
}

.event-summary h3 {
  font-size: 21px;
}

.map-line {
  margin: 5px 0;
  color: #72b7ff;
  font-weight: bold;
}

.event-description {
  color: var(--muted);
  line-height: 1.5;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 13px 0;
}

.meta-pill {
  padding: 5px 7px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}

.scoreboard {
  padding: 12px;
  background: #0c111a;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.scoreboard h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.score-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 6px 2px;
  border-top: 1px solid #202a39;
  font-size: 12px;
}

.score-row.me {
  color: #72b7ff;
}

.score-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.score-name img {
  width: 23px;
  height: 23px;
  border-radius: 50%;
}

.score-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-scores,
.hint {
  color: var(--muted);
  font-size: 14px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 15px 0;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: #080d15;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}

input {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
}

.vote-list {
  display: grid;
  gap: 8px;
}

.vote-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #0c111a;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.vote-card > img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
}

.vote-card h3 {
  font-size: 15px;
}

.vote-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.vote-button.selected {
  color: white;
  background: #0969da;
  border-color: #237fe8;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.map-card {
  overflow: hidden;
}

.map-card > img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background: #151e2c;
  border-bottom: 1px solid var(--border);
}

.map-card-body {
  padding: 13px;
}

.map-card h3 {
  font-size: 15px;
}

.map-card p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 12px;
}

.map-card .card-actions {
  margin-top: 10px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
}

.member-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 11px;
  padding: 12px;
  text-decoration: none;
}

.member-card:hover {
  background: var(--panel-light);
}

.member-card img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.member-card h3 {
  font-size: 14px;
}

.member-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 5px;
}

dialog {
  width: min(600px, calc(100% - 24px));
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, .7);
}

.dialog-form {
  padding: 20px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dialog-form label {
  display: grid;
  gap: 6px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: bold;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 24px;
  cursor: pointer;
}

.form-error {
  min-height: 18px;
  margin: 9px 0 0;
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: 16px;
  max-width: 360px;
  padding: 11px 13px;
  color: white;
  background: #1a2d45;
  border: 1px solid #385a82;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
}

.toast.error {
  background: #481c24;
  border-color: #753440;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  nav {
    display: none;
  }

  .auth-area {
    margin-left: auto;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .event-card {
    grid-template-columns: 140px 1fr;
  }

  .event-body {
    grid-template-columns: 1fr;
  }

  .map-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  main {
    width: min(100% - 18px, 1000px);
    margin-top: 12px;
  }

  .topbar {
    padding: 9px;
  }

  .brand small,
  .user-chip span {
    display: none;
  }

  .auth-area .button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .clan-icon {
    grid-row: 1;
    width: 78px;
    height: 78px;
  }

  .event-card,
  .inline-form,
  .two-column,
  .map-grid {
    grid-template-columns: 1fr;
  }

  .event-cover {
    min-height: 160px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .vote-card {
    grid-template-columns: 45px 1fr;
  }

  .vote-card > img {
    width: 45px;
    height: 45px;
  }

  .vote-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
