:root {
  --bg: #080d12;
  --panel: #101820;
  --panel-2: #151f29;
  --border: #27333d;
  --text: #e8edf1;
  --muted: #8997a4;
  --gold: #caa760;
  --radiant: #78d28d;
  --dire: #e45c59;
  --str: #e56259;
  --agi: #66c887;
  --int: #65baf0;
  --uni: #bf9fe1;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top, #16202a 0, #070b10 56%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* Главная */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 38px;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 5px; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: 11px; letter-spacing: 3px; }
.dota-mark {
  display: grid;
  place-content: center;
  width: 56px;
  height: 56px;
  background: #9c332c;
  color: #fff;
  font-size: 34px;
  font-weight: bold;
}
.dota-mark.small { width: 32px; height: 32px; font-size: 20px; }
.home-content {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 125px);
  padding-bottom: 100px;
}
.hero-title { margin-bottom: 48px; text-align: center; }
.eyebrow { margin: 0 0 18px; color: var(--gold); font-size: 12px; letter-spacing: 4px; }
.hero-title h2 { margin: 0 0 16px; font-size: 52px; letter-spacing: 4px; text-transform: uppercase; }
.hero-title > p:last-child { color: var(--muted); font-size: 17px; }
.modes { display: flex; gap: 22px; }
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 305px;
  height: 245px;
  padding: 30px;
  border: 1px solid #233d33;
  border-top: 3px solid var(--radiant);
  background: linear-gradient(145deg, #14201d, #101820);
  text-align: left;
  transition: transform .18s, border-color .18s;
}
.mode-card.multi {
  border-color: #402729;
  border-top-color: #cf554d;
  background: linear-gradient(145deg, #211516, #101820);
}
.mode-card:hover { transform: translateY(-4px); border-color: #8c6246; }
.mode-icon { color: var(--gold); font-size: 40px; }
.mode-card strong { font-size: 27px; letter-spacing: 2px; text-transform: uppercase; }
.mode-card small { flex: 1; color: var(--muted); font-size: 14px; }
.mode-card b { color: #d4b06a; font-size: 12px; letter-spacing: 2px; }

/* Диалоги */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #03060bd9;
}
.dialog {
  position: relative;
  width: min(540px, calc(100% - 32px));
  padding: 36px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 30px 100px #000;
}
.small-dialog { width: min(420px, calc(100% - 32px)); }
.dialog h2 { margin: 8px 0 18px; letter-spacing: 2px; text-transform: uppercase; }
.dialog .muted { color: var(--muted); line-height: 1.5; }
.close {
  position: absolute;
  top: 10px;
  right: 15px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}
.close:hover { color: #fff; }
.create-options { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 25px; }
.create-options .primary-btn { grid-column: 1 / 3; }
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
select, input {
  padding: 12px;
  border: 1px solid var(--border);
  outline: none;
  background: #0b1117;
}
select:focus, input:focus { border-color: var(--gold); }
.primary-btn, .secondary-btn {
  padding: 13px 18px;
  border: 1px solid #926338;
  background: #8c3a32;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.primary-btn:hover { background: #a04339; }
.secondary-btn { border-color: var(--border); background: #121b24; }
.secondary-btn:hover { border-color: #7b8791; }
.divider { position: relative; margin: 24px 0; color: var(--muted); text-align: center; }
.divider::before { position: absolute; top: 50%; right: 0; left: 0; height: 1px; background: var(--border); content: ""; }
.divider span { position: relative; padding: 0 14px; background: var(--panel); }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; text-transform: uppercase; }
.error { min-height: 18px; margin: 16px 0 0; color: #e7645c; font-size: 13px; }

/* Верхняя строка драфта */
.draft-screen { height: 100vh; overflow: hidden; background: #070c12; }
.draft-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: #091017;
}
.text-btn { border: 0; background: none; color: var(--muted); font-weight: bold; }
.text-btn:hover { color: #fff; }
.draft-brand { display: flex; align-items: center; gap: 10px; font-weight: bold; letter-spacing: 4px; }
.room-tools { display: flex; align-items: center; gap: 10px; }
.badge { padding: 8px 13px; border: 1px solid #4c4431; color: var(--gold); font-size: 11px; letter-spacing: 2px; }
.secondary-btn.small { padding: 9px 13px; }
.invite-bar {
  display: flex;
  justify-content: center;
  gap: 26px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: #0d151c;
  color: var(--muted);
  font-size: 12px;
}
#connection { color: var(--radiant); }

/* Основная раскладка: герои слева, ход справа */
.arena.dota-layout {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 365px;
  grid-template-areas: "picker board";
  height: calc(100vh - 60px);
  gap: 1px;
}
.invite-bar:not(.hidden) + .arena { height: calc(100vh - 96px); }
.picker-area {
  grid-area: picker;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 12px 12px 12px 18px;
}
.turn {
  flex: 0 0 auto;
  width: 100%;
  padding: 1px 0 11px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.turn p { margin: 0; color: var(--gold); font-size: 12px; letter-spacing: 3.4px; }
.turn h2 { margin: 7px 0 5px; font-size: 22px; letter-spacing: 2.5px; text-transform: uppercase; }
.timer { display: flex; justify-content: center; align-items: center; gap: 20px; height: 31px; }
.timer strong { font-size: 33px; letter-spacing: 3px; }
.timer span { color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.timer span.reserve-time { color: #edc76d; }
.hero-controls {
  display: flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 44px;
}
.hero-controls input { width: 286px; padding: 9px 12px; }
.hero-controls span { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.hero-panel {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  min-height: 0;
  overflow: hidden;
}
.attr-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 7px 5px 5px;
  border: 1px solid #131d25;
  background: #090f15;
}
.attr-title { flex: 0 0 auto; margin-bottom: 6px; font-size: 12px; font-weight: bold; letter-spacing: 3px; text-align: center; }
.attr-column.str .attr-title { color: var(--str); }
.attr-column.agi .attr-title { color: var(--agi); }
.attr-column.int .attr-title { color: var(--int); }
.attr-column.uni .attr-title { color: var(--uni); }
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}
.hero-tile {
  position: relative;
  width: 100%;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1.48;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #111820;
  transition: border-color .12s, box-shadow .12s, filter .12s;
}
.hero-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-tile:hover:not(:disabled) {
  z-index: 2;
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 8px rgba(202, 167, 96, .4);
  filter: brightness(1.08);
}
.hero-tile:disabled { cursor: not-allowed; }
.hero-tile mark {
  display: none;
  position: absolute;
  inset: auto 0 0;
  overflow: hidden;
  padding: 2px;
  background: #080b10dd;
  color: white;
  font-size: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hero-tile:hover mark { display: block; }
.hero-tile.selected { outline: 2px solid var(--gold); outline-offset: -2px; }
.hero-tile.selected-ban { outline-color: #c4403d; }
.hero-tile.selected-ban::after { position: absolute; inset: 0; z-index: 1; background: rgba(162, 19, 19, .38); content: ""; }
.hero-tile.tile-picked img { filter: grayscale(1) brightness(.5); }
.hero-tile.tile-banned img { filter: grayscale(1) brightness(.38); }
.hero-tile .ban-mark { display: none; }
.hero-tile.tile-banned .ban-mark {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -52%);
  color: #d20a0d;
  font-size: 38px;
  font-weight: 300;
  line-height: 1;
  text-shadow: 0 1px 3px #000;
}

/* Правая панель */
.sequence-board {
  grid-area: board;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 8px 8px 8px;
  border-left: 1px solid #28343e;
  background:
    radial-gradient(ellipse at 14% 42%, rgba(20, 120, 65, .37), transparent 50%),
    radial-gradient(ellipse at 86% 42%, rgba(124, 27, 30, .40), transparent 50%),
    linear-gradient(90deg, #112e23 0%, #0b1718 48%, #221318 100%);
}
.sequence-head { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 2px 5px; text-align: center; }
.sequence-head h2 { margin: 0; font-size: 16px; letter-spacing: 1.7px; }
.radiant-title { color: #d1ffd5; text-shadow: 0 0 13px #56d87b, 0 0 3px #fff; }
.dire-title { color: #ffd2d2; text-shadow: 0 0 13px #e15555, 0 0 3px #fff; }
.reserve-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 3px 5px; }
.reserve-row > div {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  padding: 4px 5px;
  border: 1px solid #36414a;
  background: #111a21b8;
  font-size: 10px;
}
.reserve-row span { color: var(--muted); letter-spacing: 1px; }
.reserve-row > div:first-child { box-shadow: inset 0 0 18px rgba(41, 145, 75, .10); }
.reserve-row > div:last-child { box-shadow: inset 0 0 18px rgba(170, 48, 44, .12); }
.draft-timeline {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  margin-bottom: 3px;
  padding: 0 0 3px;
  overflow: hidden;
}
.timeline-phase { display: none; }
.timeline-row {
  display: grid;
  grid-template-columns: 1fr 27px 1fr;
  align-items: center;
  min-height: 27px;
}
.timeline-row.pick { min-height: 40px; }
.turn-number { color: #8e9398; font-size: 12px; text-align: center; text-shadow: 0 1px #000; }
.timeline-row.current .turn-number { color: var(--gold); font-weight: bold; }
.timeline-cell { display: flex; align-items: center; height: 100%; }
.timeline-cell.left { justify-content: flex-end; padding-right: 3px; }
.timeline-cell.right { justify-content: flex-start; padding-left: 3px; }
.timeline-cell.left::after, .timeline-cell.right::before { display: block; width: 14px; height: 1px; background: #5a626b; content: ""; }
.timeline-cell.left::after { order: 2; }
.timeline-cell.blank::before, .timeline-cell.blank::after { display: none; }
.timeline-slot {
  position: relative;
  width: 64px;
  height: 27px;
  overflow: hidden;
  border: 1px solid #5c6873;
  border-radius: 8px;
  background: #020407;
  box-shadow: 0 1px 2px #000;
}
.timeline-slot.pick { width: 90px; height: 40px; border-radius: 10px; }
.timeline-slot.current { border-color: var(--gold); box-shadow: 0 0 9px #caa76075; }
.timeline-slot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.timeline-slot.banned img { filter: grayscale(1) brightness(.58); }
.timeline-slot.banned::after {
  position: absolute;
  top: -6px;
  left: 0;
  z-index: 2;
  color: #ee0d14;
  font-size: 37px;
  font-weight: 300;
  line-height: 1;
  text-shadow: 0 1px 3px #000;
  content: "×";
}
.timeline-slot.banned.pick::after { top: -10px; font-size: 50px; }
.slot-type {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8a949e;
  font-size: 8px;
  letter-spacing: .8px;
}
.timeline-slot.current .slot-type { color: var(--gold); }
.timeline-slot.skipped .slot-type { display: none; }

/* Единая кнопка подтверждения */
.selection-dock {
  display: grid;
  flex: 0 0 70px;
  grid-template-columns: 105px 1fr;
  width: 100%;
  height: 70px;
  margin-top: 4px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #3b4650;
  border-radius: 3px;
  background: linear-gradient(90deg, #10151a, #20262c);
  color: inherit;
  text-align: initial;
}
.selection-dock:disabled { cursor: default; }
.selection-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #0d1217;
  color: #56616a;
  font-size: 9px;
  letter-spacing: 1px;
}
.selection-preview span { text-align: center; }
.selection-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.selection-preview strong {
  position: absolute;
  bottom: 5px;
  left: 6px;
  z-index: 2;
  overflow: hidden;
  max-width: calc(100% - 12px);
  color: #f2f3f3;
  font-size: 10px;
  letter-spacing: .5px;
  text-overflow: ellipsis;
  text-shadow: 0 2px 4px #000;
  white-space: nowrap;
}
.selection-dock.ban .selection-preview::after { position: absolute; inset: 0; background: rgba(162, 18, 22, .42); content: ""; }
.confirm-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  padding: 0 11px;
  border-left: 1px solid #303b44;
  color: #ddd;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.selection-dock:not(:disabled):hover { filter: brightness(1.15); }
.selection-dock.idle .confirm-label { color: #56616a; }
.selection-dock.ban .confirm-label { color: #ece3df; }
.selection-dock.pick .confirm-label { color: #e1f0e3; }
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 100;
  padding: 12px 18px;
  border: 1px solid #566879;
  background: #1c2731;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 900px) and (min-width: 921px) {
  .sequence-head h2 { font-size: 15px; }
  .timeline-row { min-height: 23px; }
  .timeline-row.pick { min-height: 33px; }
  .timeline-slot { width: 58px; height: 23px; border-radius: 7px; }
  .timeline-slot.pick { width: 82px; height: 33px; border-radius: 9px; }
  .selection-dock { flex-basis: 60px; grid-template-columns: 92px 1fr; height: 60px; }
  .confirm-label { font-size: 13px; }
}
@media (max-width: 1280px) and (min-width: 921px) {
  .arena.dota-layout { grid-template-columns: minmax(570px, 1fr) 350px; }
  .hero-grid { gap: 4px; }
  .timeline-row { min-height: 23px; }
  .timeline-row.pick { min-height: 33px; }
  .timeline-slot { width: 54px; height: 23px; }
  .timeline-slot.pick { width: 76px; height: 33px; }
  .selection-dock { grid-template-columns: 94px 1fr; }
  .confirm-label { padding: 0 8px; font-size: 13px; }
}
@media (max-width: 920px) {
  .home-content { padding: 28px 16px; }
  .hero-title h2 { font-size: 36px; }
  .modes { flex-direction: column; }
  .draft-screen { height: auto; overflow: visible; }
  .draft-top { height: auto; flex-wrap: wrap; gap: 12px; padding: 12px; }
  .room-tools { width: 100%; justify-content: center; }
  .arena.dota-layout { display: flex; flex-direction: column; height: auto; }
  .picker-area { height: 82vh; order: 1; }
  .sequence-board { min-height: 700px; order: 2; }
  .hero-grid { overflow-y: auto; scrollbar-gutter: stable; }
  .timeline-slot { width: 64px; height: 27px; }
  .timeline-slot.pick { width: 90px; height: 40px; }
  .selection-dock { flex-basis: 72px; grid-template-columns: 110px 1fr; height: 72px; }
}

/* AI-анализ завершённого драфта */
.ai-btn { border-color: #805f33; color: #e2c177; }
.ai-btn:hover { border-color: var(--gold); }
.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 6, 11, .84);
  backdrop-filter: blur(3px);
}
.analysis-card {
  position: relative;
  width: min(790px, 100%);
  max-height: min(880px, calc(100vh - 32px));
  overflow-y: auto;
  padding: 30px 34px 22px;
  border: 1px solid #394651;
  background:
    radial-gradient(circle at 12% 10%, rgba(43, 133, 79, .16), transparent 35%),
    radial-gradient(circle at 88% 10%, rgba(176, 50, 45, .16), transparent 35%),
    linear-gradient(160deg, #131c24, #090f15 70%);
  box-shadow: 0 30px 100px #000;
}
.analysis-card h2 {
  margin: -3px 0 22px;
  font-size: 26px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.analysis-loading {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 120px;
  padding: 22px;
  border: 1px solid #2e3943;
  background: #0a1117;
  color: #bcc6ce;
}
.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 2px solid #44515b;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: analysis-spin .85s linear infinite;
}
@keyframes analysis-spin { to { transform: rotate(360deg); } }
.analysis-error {
  padding: 21px;
  border: 1px solid #673334;
  background: rgba(86, 29, 29, .3);
}
.analysis-error strong { display: block; margin-bottom: 9px; color: #f08c84; letter-spacing: 1px; }
.analysis-error p { margin: 0; color: #d1c5c4; line-height: 1.5; }
.analysis-winner {
  display: grid;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid #2f4037;
  background: #0d1519;
}
.analysis-winner.radiant-win { box-shadow: inset 4px 0 0 #55b976; }
.analysis-winner.dire-win { border-color: #4d3234; box-shadow: inset 4px 0 0 #d2504b; }
.analysis-winner small { color: var(--gold); font-size: 11px; letter-spacing: 2px; }
.analysis-winner strong { font-size: 30px; letter-spacing: 3px; }
.analysis-winner.radiant-win strong { color: #97dda7; }
.analysis-winner.dire-win strong { color: #f07a73; }
.analysis-winner span { color: #bac4cb; font-size: 14px; }
.analysis-summary { margin: 18px 0; color: #dbe1e5; line-height: 1.55; }
.analysis-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.analysis-side, .decisive {
  padding: 16px 17px;
  border: 1px solid #29353e;
  background: rgba(8, 14, 19, .64);
}
.analysis-side.radiant { border-top: 2px solid #4ea46c; }
.analysis-side.dire { border-top: 2px solid #c34c48; }
.analysis-side h3, .decisive h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
}
.analysis-side ul, .decisive ul { margin: 0; padding-left: 18px; color: #d4dbe0; }
.analysis-side li, .decisive li { margin: 0 0 8px; line-height: 1.4; }
.analysis-side li:last-child, .decisive li:last-child { margin-bottom: 0; }
.decisive { margin-top: 13px; border-top-color: var(--gold); }
.analysis-caveat {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 2px solid #73808b;
  color: #aeb8bf;
  font-size: 13px;
  line-height: 1.45;
}
.analysis-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 21px; }
.analysis-note {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #222d35;
  color: #74818d;
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 640px) {
  .analysis-card { padding: 25px 18px 18px; }
  .analysis-columns { grid-template-columns: 1fr; }
  .analysis-winner strong { font-size: 25px; }
}
