* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1115;
  color: #e8eaf0;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAB72C;
  text-align: center;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.hero.fading {
  opacity: 0;
  transform: scale(1.02);
}

.hero-pattern {
  position: absolute;
  inset: 0;
  background-image: url("/logo-pattern.png");
  background-repeat: repeat;
  background-size: 700px 700px;
  background-position: -140px -140px;
  opacity: 0.3;
  pointer-events: none;
}

.hero-content {
  max-width: 900px;
  position: relative;
  z-index: 1;
}

.hero-logo {
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin-bottom: 24px;
  will-change: filter;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.35));
}
.hero-logo.spinning {
  transform: rotate(720deg);
}

.hero h1 {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.05;
  color: #0a0a0a;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.liga-wrap {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.fantasy-badge {
  position: absolute;
  bottom: -18px;
  right: -30px;
  background: #EE128F;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  padding: 6px 16px;
  transform: rotate(-4deg);
  letter-spacing: 1px;
  text-transform: lowercase;
  font-style: italic;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.hero .subtitle {
  font-size: 20px;
  color: #2a1a00;
  margin-bottom: 40px;
  font-weight: 500;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.cta {
  padding: 18px 56px;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, #EE128F 0%, #ff4db0 50%, #EE128F 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 6px 0 #a30d63;
  position: relative;
  top: 0;
  animation: shine 2.4s ease-in-out infinite;
}

@keyframes shine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #a30d63;
  animation-play-state: paused;
}
.cta:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a30d63;
}

@media (max-width: 900px) {
  .hero h1 { font-size: 40px; letter-spacing: 1px; }
  .fantasy-badge { font-size: 14px; padding: 4px 10px; bottom: -12px; right: -10px; }
  .hero-logo { width: 100px; height: 100px; }
  .hero-pattern { background-size: 120px 120px; }
}

/* Layout */
#app {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(400px, 1.2fr);
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  animation: fadeInApp 0.4s ease;
}
@keyframes fadeInApp {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (max-width: 1000px) {
  #app { grid-template-columns: 1fr; }
}

.panel {
  background: #181c24;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #232833;
}
.panel h2 { font-size: 20px; margin-bottom: 16px; color: #fff; }
.panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7d8494;
  margin: 16px 0 8px;
}

/* Info button */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid #4a5160;
  color: #7d8494;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.15s;
  font-family: Georgia, serif;
  line-height: 1;
  padding: 0;
}
.info-btn:hover {
  border-color: #FAB72C;
  color: #FAB72C;
  background: rgba(250, 183, 44, 0.1);
}

/* Schema */
.schema-block { margin-bottom: 16px; }
.section-label {
  font-size: 14px;
  font-weight: 600;
  color: #e8eaf0;
  margin-bottom: 4px;
}
.schema-caption {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: #7d8494; margin-bottom: 10px;
}
.schema-buttons { display: flex; gap: 8px; }
.schema-btn {
  flex: 1; padding: 10px;
  background: #0f1115; color: #e8eaf0;
  border: 1px solid #2a3038; border-radius: 6px;
  cursor: pointer; font-size: 15px; font-weight: 700;
  transition: all 0.15s;
}
.schema-btn:hover { border-color: #FAB72C; }
.schema-btn.active {
  background: #FAB72C;
  border-color: #FAB72C;
  color: #0a0a0a;
}

/* Bonus */
.bonus-block { margin: 16px 0; }
.bonus-buttons { display: flex; gap: 8px; }
.bonus-btn {
  flex: 1; padding: 10px 8px;
  background: #0f1115; color: #e8eaf0;
  border: 1px solid #2a3038; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}
.bonus-btn:hover:not(:disabled) { border-color: #FAB72C; }
.bonus-btn.active {
  background: #FAB72C;
  border-color: #FAB72C;
  color: #0a0a0a;
}
.bonus-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Calculate */
.calculate-btn {
  width: 100%; padding: 14px; margin-top: 16px;
  background: #FAB72C; color: #0a0a0a;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 800;
  cursor: pointer; transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.calculate-btn:hover:not(:disabled) { background: #FFC94D; }
.calculate-btn:disabled {
  background: #2a3038; color: #5a6270; cursor: not-allowed;
}
.calculate-btn.secondary {
  background: transparent;
  border: 1px solid #FAB72C;
  color: #FAB72C;
}
.calculate-btn.secondary:hover { background: rgba(250, 183, 44, 0.1); }

/* Search + teams */
#search {
  width: 100%; padding: 10px 14px;
  background: #0f1115; border: 1px solid #2a3038;
  border-radius: 8px; color: #e8eaf0; font-size: 14px;
  margin-bottom: 16px;
}
#search:focus { outline: none; border-color: #FAB72C; }
.teams-list {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}
.team-group { margin-bottom: 20px; }
.team-title {
  font-size: 13px; font-weight: 700; color: #FAB72C;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid #232833;
}
#players-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.player-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 6px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}
.player-card:hover { background: #232833; }
.player-card.selected { background: #2a3540; opacity: 0.4; cursor: not-allowed; }
.player-card.gender-MALE { border-left-color: #4a9eff; }
.player-card.gender-FEMALE { border-left-color: #ff6bb5; }
.player-card.gender-MALE:hover { background: rgba(74, 158, 255, 0.1); }
.player-card.gender-FEMALE:hover { background: rgba(255, 107, 181, 0.1); }
.player-card img {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; background: #2a3038;
}
.player-card .info { flex: 1; }
.player-card .name { font-size: 14px; font-weight: 600; }
.player-card .meta { font-size: 12px; color: #7d8494; }

/* Slots */
.slots { display: grid; gap: 8px; }
.slot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: #0f1115;
  border: 1px dashed #2a3038; border-radius: 8px;
  min-height: 60px; transition: all 0.15s;
}
.slot.filled { border-style: solid; cursor: grab; }
.slot.filled:active { cursor: grabbing; }
.slot.filled.gender-MALE { border-color: #4a9eff; }
.slot.filled.gender-FEMALE { border-color: #ff6bb5; }
.slot.filled.captain {
  border-color: #FAB72C;
  box-shadow: 0 0 0 1px #FAB72C inset;
}
.slot.dragging { opacity: 0.4; }
.slot.drop-target {
  background: #2a2018; border-color: #FAB72C;
  border-style: dashed;
}
.slot img {
  width: 36px; height: 36px;
  border-radius: 50%; object-fit: cover;
  pointer-events: none;
}
.slot .slot-label {
  font-size: 11px; color: #7d8494;
  text-transform: uppercase; letter-spacing: 0.5px;
  pointer-events: none;
}
.slot .slot-name { font-size: 14px; font-weight: 600; pointer-events: none; }
.slot .slot-body { flex: 1; pointer-events: none; }

.captain-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; color: #7d8494;
  border: 1px solid #2a3038;
  font-weight: 700; font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.captain-btn:hover:not(:disabled) { border-color: #FAB72C; color: #FAB72C; }
.captain-btn.active {
  background: #FAB72C;
  border-color: #FAB72C;
  color: #0a0a0a;
}
.captain-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.slot .remove-btn {
  background: transparent; border: none;
  color: #7d8494; cursor: pointer;
  font-size: 20px; padding: 0 6px; line-height: 1;
}
.slot .remove-btn:hover { color: #EE128F; }

/* Error */
.error {
  background: #3a1a1a; border: 1px solid #7d2a2a;
  color: #ff8a7a; padding: 10px 14px;
  border-radius: 6px; font-size: 13px; margin: 12px 0;
}

/* Report */
.report-total {
  text-align: center; padding: 24px 0;
  border-bottom: 1px solid #232833; margin-bottom: 16px;
}
.report-total-label {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 2px; color: #7d8494; margin-bottom: 8px;
}
.report-total-value {
  font-size: 64px; font-weight: 900; color: #FAB72C;
  letter-spacing: -2px; line-height: 1;
}
.report-table { margin-bottom: 16px; }
.report-row {
  display: grid;
  grid-template-columns: 1fr 80px 36px 36px 36px 60px;
  gap: 8px; padding: 10px 8px;
  border-bottom: 1px solid #232833;
  align-items: center; font-size: 14px;
}
.report-header {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: #7d8494;
  padding-bottom: 6px; border-bottom: 2px solid #2a3038;
}
.report-row .col-name {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
}
.report-row .col-name img {
  width: 32px; height: 32px;
  border-radius: 50%; object-fit: cover;
  background: #2a3038; flex-shrink: 0;
}
.report-row .col-name .sub {
  font-size: 11px; color: #7d8494; font-weight: 400;
}
.report-row .col-role {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: #7d8494;
}
.report-row .col-num {
  text-align: center; font-variant-numeric: tabular-nums;
}
.report-row .col-pts {
  text-align: right; font-weight: 700;
  color: #FAB72C; font-variant-numeric: tabular-nums;
}
.report-row.bench { opacity: 0.55; }
.report-row.captain .col-pts { color: #FAB72C; }
.report-row.captain .col-name::after {
  content: "⚡"; margin-left: 4px;
}

/* Раскрывающиеся игры */
.report-row.clickable { cursor: pointer; }
.report-row.clickable:hover { background: #1f242e; }
.report-row .expand-icon {
  display: inline-block;
  margin-left: 4px;
  color: #7d8494;
  font-size: 11px;
}
.report-games {
  background: #13171e;
  border-left: 2px solid #2a3038;
  margin: 0 0 4px 0;
  padding: 6px 8px;
}
.report-games.hidden { display: none; }
.game-line {
  display: grid;
  grid-template-columns: 1fr 80px 36px 36px 36px 60px;
  gap: 8px; padding: 6px 8px;
  font-size: 13px;
  border-bottom: 1px solid #1a1f28;
  align-items: center;
}
.game-line:last-child { border-bottom: none; }
.game-opponent { color: #c8ccd4; }
.game-result { font-size: 12px; text-transform: lowercase; }
.game-result.win { color: #6ec97a; }
.game-result.loss { color: #ff7a6a; }
.game-num {
  text-align: center;
  color: #a0a4b0;
  font-variant-numeric: tabular-nums;
}
.game-pts {
  text-align: right;
  font-weight: 700;
  color: #FAB72C;
  font-variant-numeric: tabular-nums;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.modal {
  background: #181c24;
  border: 1px solid #2a3038;
  border-radius: 12px;
  padding: 28px;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.2s;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: transparent; border: none;
  color: #7d8494; font-size: 24px; line-height: 1;
  cursor: pointer; border-radius: 50%;
  transition: all 0.15s;
}
.modal-close:hover { background: #232833; color: #FAB72C; }
.modal h3 {
  font-size: 18px; color: #fff;
  margin-bottom: 16px;
  text-transform: none; letter-spacing: 0;
}
.modal p {
  font-size: 14px; line-height: 1.6;
  color: #c8ccd4; margin-bottom: 12px;
}
.modal ul {
  margin: 12px 0 12px 20px;
  font-size: 14px; line-height: 1.7; color: #c8ccd4;
}
.modal li { margin-bottom: 4px; }
.modal strong { color: #FAB72C; font-weight: 700; }
.modal table {
  width: 100%; border-collapse: collapse;
  margin: 12px 0; font-size: 14px;
}
.modal table th,
.modal table td {
  padding: 8px 12px;
  border-bottom: 1px solid #2a3038;
  text-align: left;
}
.modal table th {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: #7d8494; font-weight: 600;
}
.modal table td:first-child { color: #e8eaf0; font-weight: 600; }
.modal table td:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }

.data-credit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #232833;
  font-size: 12px;
  color: #7d8494;
  text-align: center;
}
.data-credit a {
  color: #FAB72C;
  text-decoration: none;
}
.data-credit a:hover { text-decoration: underline; }