:root {
  --bg1: #08111f;
  --bg2: #03070d;
  --panel: rgba(11, 19, 31, 0.96);
  --panel-2: rgba(16, 27, 44, 0.96);
  --line: rgba(200, 170, 110, 0.36);
  --gold: #f0c775;
  --text: #f5f5f5;
  --muted: #a09b8c;
  --blue: #0ac8b9;
  --red: #e04848;
  --green: #40b36d;
  --input: #0d1728;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(8, 88, 116, 0.3), transparent 28%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
  min-height: 100vh;
}

code {
  color: var(--gold);
}

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 22px;
}

.hero {
  padding: 28px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(240, 199, 117, 0.05), transparent);
  pointer-events: none;
}

h1 {
  margin: 0 0 8px;
  font-size: 36px;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.subtitle,
.footer-text {
  color: var(--muted);
  line-height: 1.75;
}

.hero-actions,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
  margin-bottom: 22px;
}

.panel h2 {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(200, 170, 110, 0.18);
}

button {
  appearance: none;
  border: 1px solid rgba(200, 170, 110, 0.44);
  background: linear-gradient(180deg, #17324d, #0e1f31);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(240, 199, 117, 0.12);
}

button.secondary {
  background: linear-gradient(180deg, #1b2330, #121822);
}

button.danger {
  background: linear-gradient(180deg, #5a2222, #3c1717);
  border-color: rgba(224, 72, 72, 0.5);
}

input,
select,
textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid rgba(200, 170, 110, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 199, 117, 0.08);
}

.field label,
.role-block-title {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.note,
.warning,
.success {
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
  line-height: 1.7;
}

.note {
  background: rgba(10, 200, 185, 0.12);
  border: 1px solid rgba(10, 200, 185, 0.3);
}

.warning {
  background: rgba(224, 72, 72, 0.12);
  border: 1px solid rgba(224, 72, 72, 0.3);
}

.success {
  background: rgba(64, 179, 109, 0.12);
  border: 1px solid rgba(64, 179, 109, 0.3);
}

.players-grid {
  display: grid;
  gap: 14px;
}

.player-card {
  border: 1px solid rgba(200, 170, 110, 0.14);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 16px;
}

.player-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.power-grid,
.roles-grid {
  display: grid;
  gap: 10px;
}

.power-grid {
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 12px;
}

.roles-grid {
  grid-template-columns: repeat(5, 1fr);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(200, 170, 110, 0.12);
}

.checkbox-line input {
  width: auto;
  margin: 0;
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(200, 170, 110, 0.12);
  min-height: 58px;
}

.profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(200, 170, 110, 0.18);
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-rank {
  font-size: 12px;
  color: var(--gold);
}

.profile-sub {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.team-card {
  background: linear-gradient(180deg, rgba(16, 27, 44, 0.98), rgba(10, 17, 29, 0.98));
  border: 1px solid rgba(200, 170, 110, 0.22);
  border-radius: 18px;
  padding: 18px;
}

.team-card.blue {
  box-shadow: inset 0 0 0 1px rgba(10, 200, 185, 0.18);
}

.team-card.red {
  box-shadow: inset 0 0 0 1px rgba(224, 72, 72, 0.18);
}

.team-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.team-head h3 {
  margin: 0;
  color: var(--gold);
  font-size: 20px;
}

.score-badge {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(240, 199, 117, 0.1);
  border: 1px solid rgba(240, 199, 117, 0.3);
  font-weight: 700;
}

.assignment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(200, 170, 110, 0.12);
}

.assignment small {
  color: var(--muted);
}

.pill {
  min-width: 48px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(10, 200, 185, 0.12);
  border: 1px solid rgba(10, 200, 185, 0.28);
}

.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(900px, 100%);
  background: linear-gradient(180deg, rgba(12, 21, 34, 0.98), rgba(8, 14, 23, 0.98));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  color: var(--gold);
  font-size: 24px;
}

.modal-close {
  min-width: 44px;
  padding: 10px 14px;
}

.copy-box {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  line-height: 1.65;
  font-family: Consolas, Monaco, monospace;
}

.modal-summary {
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.8;
}

.status-text {
  margin-top: 12px;
}

.hidden-copy {
  position: fixed;
  left: -9999px;
  top: -9999px;
}

@media (max-width: 1100px) {
  .player-top {
    grid-template-columns: 1fr 1fr;
  }

  .power-grid,
  .roles-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .wrap {
    padding: 14px;
  }

  .hero,
  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .player-top {
    grid-template-columns: 1fr;
  }
}