:root {
  --bg: #080a0f;
  --panel: rgba(17, 22, 31, .86);
  --panel-2: rgba(24, 31, 43, .92);
  --line: rgba(255,255,255,.1);
  --line-strong: rgba(255,255,255,.18);
  --text: #f8fafc;
  --muted: #9aa4b2;
  --soft: #cbd5e1;
  --accent: #ff9f1c;
  --blue: #5ea7ff;
  --green: #35d39d;
  --purple: #8b7cf6;
  --red: #ff6b81;
  --discord: #5865f2;
  --shadow: 0 18px 52px rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(94,167,255,.22), transparent 34rem),
    radial-gradient(circle at 92% 12%, rgba(255,159,28,.16), transparent 30rem),
    linear-gradient(180deg, #090b11, #050608 64%);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(8,10,15,.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 950;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #141414;
  box-shadow: 0 10px 24px rgba(255,159,28,.24);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav a {
  color: var(--soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 18px auto 36px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.panel, .board {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.filters, .detail { padding: 16px; position: sticky; top: 78px; }
.board { padding: 18px; min-height: calc(100vh - 110px); }

.section-title, .board-head, .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin-bottom: 14px;
  color: white;
  font-weight: 950;
}

.board-head {
  margin-bottom: 14px;
}

.board-head h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: 0;
  line-height: 1;
}

.board-head p { margin: 8px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }

label {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 850;
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: rgba(3,7,18,.72);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  padding: 11px 12px;
}

textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(94,167,255,.62); box-shadow: 0 0 0 3px rgba(94,167,255,.12); }

.btn, .icon-btn {
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 950;
}

.btn {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line-strong);
}

.btn.primary { background: linear-gradient(135deg, #ff9f1c, #ff6b35); color: #17120a; border-color: transparent; }
.btn.discord { background: var(--discord); border-color: transparent; }
.btn.ghost { background: rgba(255,255,255,.06); color: var(--soft); }
.btn.small { min-height: 34px; border-radius: 10px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: rgba(255,107,129,.13); color: #ffc4cc; border-color: rgba(255,107,129,.34); }
.btn.ok { background: rgba(53,211,157,.14); color: #9ff8d7; border-color: rgba(53,211,157,.34); }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}

.hidden { display: none !important; }

.login-card, .cost-note, .empty {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  padding: 14px;
  color: var(--muted);
}
.login-card strong, .cost-note strong, .empty strong { color: white; }
.login-card p, .cost-note p, .empty p { margin: 6px 0 0; font-size: 13px; }
.empty.compact { margin-top: 0; }

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.quick-stats div {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  padding: 12px;
}

.quick-stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.quick-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.party-card {
  position: relative;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
}

.party-card.active { border-color: rgba(255,159,28,.72); box-shadow: 0 0 0 3px rgba(255,159,28,.14); }
.party-card-bg {
  position: absolute;
  inset: 0 auto 0 0;
  width: 230px;
  opacity: .24;
  background-position: center;
  background-size: cover;
  mask-image: linear-gradient(90deg, black 0, black 44%, transparent 100%);
}
.party-card-body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
}

.party-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.22;
  letter-spacing: 0;
}

.badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255,255,255,.08);
  color: #dbe5f3;
  font-size: 12px;
  font-weight: 950;
}
.badge.run { background: rgba(94,167,255,.16); color: #cbe4ff; }
.badge.static { background: rgba(139,124,246,.18); color: #ded9ff; }
.badge.open { background: rgba(53,211,157,.14); color: #b5ffe3; }
.badge.closed { background: rgba(255,107,129,.16); color: #ffc4cc; }

.party-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.slots {
  min-width: 112px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}
.slots strong { display: block; font-size: 28px; line-height: 1; color: white; }
.slots span { color: var(--muted); font-size: 12px; font-weight: 800; }

.detail h2 { margin: 0 0 8px; font-size: 22px; }
.detail-sub { color: var(--muted); margin: 0 0 14px; }
.detail-block { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.detail-block h3 { margin: 0 0 10px; font-size: 14px; color: white; }

.member, .applicant {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.045);
}

.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.person-name { font-weight: 950; }
.person-meta { color: var(--muted); font-size: 12px; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.memo { color: #d8dee8; font-size: 13px; white-space: pre-wrap; }

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  width: min(760px, calc(100vw - 28px));
}
.modal.large { width: min(880px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.modal-card {
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #101620;
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.form-grid .wide { grid-column: 1 / -1; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line-strong);
  background: rgba(16,22,32,.96);
  border-radius: 14px;
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .detail {
    position: fixed;
    right: 14px;
    top: 78px;
    bottom: 14px;
    width: min(420px, calc(100vw - 28px));
    z-index: 18;
    overflow: auto;
  }
  .detail:not(.open) { display: none; }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 62px; padding: 10px 14px; align-items: flex-start; }
  .nav { flex-wrap: wrap; justify-content: flex-end; }
  .nav a { display: none; }
  .shell { width: min(100vw - 20px, 640px); grid-template-columns: 1fr; margin-top: 10px; }
  .filters { position: static; }
  .board { padding: 14px; }
  .board-head { align-items: flex-start; flex-direction: column; }
  .quick-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .party-card-body { grid-template-columns: 1fr; }
  .slots { min-width: 0; text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
}
