:root{
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --emerald: #00ff9d;
    --emerald-glow: rgba(0, 255, 157, 0.3);
    --emerald-hover: #33ffb3;
    --text-main: #e6eef8;
    --text-muted: #8a9bb8;
    --dire-red: #ff4a4a;
    --glass: rgba(255,255,255,0.03);
    --slot-size: 104px;
    --search-bg: rgba(0,0,0,0.4);
    --search-border: rgba(255, 255, 255, 0.12);
  }

  * { box-sizing: border-box; }
  html { min-height:100vh; background-color: var(--bg-color); }
  body { min-height:100vh; margin:0; font-family: 'Inter', sans-serif; background-color: transparent; color: var(--text-main); }
  #dotaMapCanvas {
      position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -2; pointer-events: none; opacity: 0.8;
  }

  .ambient-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(0, 255, 157, 0.05) 0%, transparent 50%), radial-gradient(circle at 85% 30%, rgba(255, 74, 74, 0.03) 0%, transparent 50%);
    animation: pulse-bg 15s infinite alternate ease-in-out;
  }
  @keyframes pulse-bg { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.1); opacity: 1; } }

  .container { max-width: 1200px; margin: 0 auto; padding: 24px; position: relative; z-index: 1; }

  header { display:flex; align-items:flex-start; gap:16px; margin-bottom:24px; }
  h1 { margin:0; font-family: 'Outfit', sans-serif; font-size:32px; font-weight:900; color: white; text-shadow: 0 0 20px var(--emerald-glow); }
  .subtitle { color:var(--text-muted); font-size:14px; margin-top:8px; font-weight: 300; }
  header a { color: var(--emerald); text-decoration: none; font-weight: 600; padding: 6px 12px; border-radius: 8px; background: rgba(0, 255, 157, 0.1); border: 1px solid rgba(0, 255, 157, 0.2); transition: all 0.3s; }
  header a:hover { background: rgba(0, 255, 157, 0.2); transform: translateY(-2px); }

  .team, .team-choice, .result-panel, .bottom-area {
    background: var(--panel-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border-color); border-radius: 16px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }

  .top-area { display:flex; gap:24px; align-items:flex-start; margin-bottom:16px; }
  .team { padding:20px; width:calc(50% - 12px); }
  .team h2 { margin:0 0 8px 0; font-size:18px; font-weight: 800; display:flex; align-items:center; gap:8px; color: white; }
  .team .desc { color:var(--text-muted); font-size:13px; margin-bottom:16px; line-height: 1.5; }
  .slots { display:flex; gap:12px; flex-wrap:wrap; }
  .slot { width:var(--slot-size); height:var(--slot-size); background:rgba(0,0,0,0.4); border-radius:12px; display:flex; align-items:center; justify-content:center; flex-direction:column; position:relative; cursor:pointer; border:1px dashed rgba(255,255,255,0.15); transition:all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
  .slot:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05); }
  .slot.selected { transform:translateY(-8px) scale(1.05); border: 2px solid var(--emerald); box-shadow:0 12px 24px rgba(0,255,157,0.2); background: rgba(0,255,157,0.05); }
  .team.dire .slot.selected { border-color: var(--dire-red); box-shadow:0 12px 24px rgba(255,74,74,0.2); background: rgba(255,74,74,0.05); }
  .slot img { width:64px; height:64px; object-fit:cover; border-radius:8px; margin-bottom:6px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
  .slot .name { font-size:11px; color:var(--text-muted); text-align:center; max-width:90px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight: 600; }
  .slot .delete-btn { position:absolute; bottom:-14px; left:50%; transform:translateX(-50%); background:#000; border:1px solid rgba(255,255,255,0.1); color:var(--text-muted); font-size:11px; padding:4px 10px; border-radius:20px; cursor:pointer; display:none; transition: all 0.2s; z-index: 10; font-weight: 600; }
  .slot .delete-btn:hover { background: #ff4a4a; color: white; border-color: #ff4a4a; }
  .slot.filled { border-style: solid; border-color: rgba(255,255,255,0.1); }
  .slot.filled .delete-btn { display:block; }

  .play-team-btn { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 700; transition: all 0.3s; width: 100%; display: block; text-align: center; }
  .play-team-btn:hover { background: rgba(255,255,255,0.1); color: white; }
  .team.radiant.active-team { border-color: var(--emerald); box-shadow: 0 0 20px rgba(0, 255, 157, 0.15); }
  .team.radiant.active-team .play-team-btn { background: rgba(0, 255, 157, 0.15); border-color: var(--emerald); color: var(--emerald); box-shadow: 0 0 15px rgba(0, 255, 157, 0.2); }
  .team.dire.active-team { border-color: var(--dire-red); box-shadow: 0 0 20px rgba(255, 74, 74, 0.15); }
  .team.dire.active-team .play-team-btn { background: rgba(255, 74, 74, 0.15); border-color: var(--dire-red); color: var(--dire-red); box-shadow: 0 0 15px rgba(255, 74, 74, 0.2); }

  .result-panel { margin-top:16px; padding:20px; display:flex; flex-direction:column; gap:16px; }
  .result-header { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap: wrap; }
  .result-title { font-size:20px; font-weight:800; color:white; font-family: 'Outfit', sans-serif; }
  .result-sub { color:var(--text-muted); font-size:13px; margin-top:4px; line-height: 1.5; }

  .submit-btn { background:linear-gradient(135deg, var(--emerald), #00d482); color:black; padding:14px 24px; border-radius:50px; border:none; cursor:pointer; font-weight:800; font-size:14px; display:flex; align-items:center; gap:8px; box-shadow: 0 0 20px rgba(0, 255, 157, 0.4); transition:all 0.3s; }
  .submit-btn:hover { transform:translateY(-2px); box-shadow: 0 8px 25px rgba(0, 255, 157, 0.6); background: linear-gradient(135deg, var(--emerald-hover), var(--emerald)); }
  .submit-btn:active { transform:translateY(1px); }

  .result-list { display:flex; gap:16px; flex-wrap:wrap; padding:12px 4px; }
  .result-hero { min-width:160px; background:rgba(0,0,0,0.3); border-radius:12px; padding:12px; display:flex; gap:12px; align-items:center; border:1px solid rgba(255,255,255,0.05); flex:0 0 auto; transition: transform 0.2s; }
  .result-hero:hover { transform: translateY(-3px); border-color: rgba(0, 255, 157, 0.3); background: rgba(0, 255, 157, 0.05); }
  .result-hero img { width:64px; height:64px; object-fit:cover; border-radius:8px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
  .result-hero .meta .name { font-weight:700; font-size:14px; color: white; }
  .result-hero .meta .id { color:var(--text-muted); font-size:12px; margin-top: 2px; }
  .result-message { color:var(--text-muted); font-size:14px; padding:12px 16px; background:rgba(0,0,0,0.3); border-radius:12px; border:1px solid rgba(255,255,255,0.05); }

  .rank { font-size: 13px; font-weight: 800; margin-top: 4px; color: var(--text-muted); }
  .rank-gold { color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,0.5); }
  .rank-silver { color: #c0c0c0; text-shadow: 0 0 8px rgba(192,192,192,0.5); }
  .rank-bronze { color: #cd7f32; text-shadow: 0 0 8px rgba(205,127,50,0.5); }

  .error-banner { background:rgba(255, 74, 74, 0.1); color:#ffb3b3; padding:12px 16px; border-radius:12px; border:1px solid rgba(255, 74, 74, 0.3); font-size:14px; display:none; }

  /* WIN CHANCE BAR */
  .win-wrap { margin-top:12px; padding:16px; display:flex; flex-direction:column; gap:12px; background: rgba(0,0,0,0.4); border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
  .win-labels { display:flex; justify-content:space-between; align-items:center; font-size:14px; font-weight: 700; }
  #win-rad-label { color: var(--emerald); text-shadow: 0 0 10px rgba(0,255,157,0.3); }
  #win-dir-label { color: var(--dire-red); text-shadow: 0 0 10px rgba(255,74,74,0.3); }
  .win-bar { height:24px; background:rgba(0,0,0,0.6); border-radius:50px; overflow:hidden; display:flex; border:1px solid rgba(255,255,255,0.1); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
  .win-seg { height:100%; display:flex; align-items:center; justify-content:center; font-weight:900; font-size:12px; color:#000; transition:width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
  .win-radiant { background: linear-gradient(90deg, #00d482, var(--emerald)); position: relative; overflow: hidden; }
  .win-radiant::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); animation: shine 2s infinite; }
  .win-dire { background: linear-gradient(90deg, #ff4a4a, #ff6b6b); }
  @keyframes shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

  .bottom-area { margin-top:24px; padding:24px; }
  .controls { display:flex; gap:16px; align-items:center; margin-bottom:20px; }
  .search { flex:1; position: relative; }
  .search input { width:100%; padding:16px 20px; border-radius:12px; border:1px solid var(--search-border); background:var(--search-bg); color:white; font-size:15px; outline:none; transition:all 0.3s; font-family: 'Inter', sans-serif; }
  .search input::placeholder { color: var(--text-muted); font-weight:500; }
  .search input:focus { border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(0, 255, 157, 0.1); background: rgba(0,0,0,0.6); }

  .heroes-list { display:grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap:12px; }
  .hero-card { display:flex; gap:12px; align-items:center; background:rgba(0,0,0,0.3); padding:10px; border-radius:12px; border:1px solid rgba(255,255,255,0.05); transition: all 0.2s; }
  .hero-card:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.03); transform: translateY(-2px); }
  .hero-card img { width:60px; height:60px; object-fit:cover; border-radius:8px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
  .hero-card .info { flex:1; }
  .hero-card .info .name { font-weight:700; font-size: 14px; color: white; }
  .hero-card .info .id { color:var(--text-muted); font-size:12px; margin-top: 2px; }
  .add-btns { display: flex; flex-direction: column; gap: 6px; }
  .hero-card .add-rad-btn { background: rgba(0, 255, 157, 0.1); border: 1px solid rgba(0, 255, 157, 0.2); color: var(--emerald); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 700; transition: all 0.2s; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
  .hero-card .add-rad-btn:hover { background: var(--emerald); color: black; box-shadow: 0 0 15px rgba(0, 255, 157, 0.3); border-color: var(--emerald); }
  .hero-card .add-dire-btn { background: rgba(255, 74, 74, 0.1); border: 1px solid rgba(255, 74, 74, 0.2); color: var(--dire-red); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 700; transition: all 0.2s; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
  .hero-card .add-dire-btn:hover { background: var(--dire-red); color: white; box-shadow: 0 0 15px rgba(255, 74, 74, 0.3); border-color: var(--dire-red); }

  .team.radiant h2::before { content:""; display:inline-block; width:12px; height:12px; border-radius:3px; background:var(--emerald); box-shadow: 0 0 10px var(--emerald-glow); }
  .team.dire h2::before { content:""; display:inline-block; width:12px; height:12px; border-radius:3px; background:var(--dire-red); box-shadow: 0 0 10px rgba(255,74,74,0.3); }
  .team.favorites h2::before { content:""; display:inline-block; width:12px; height:12px; border-radius:3px; background:#ffd700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
  
  .fav-btn { position:absolute; bottom:-10px; right:-10px; background:rgba(0,0,0,0.7); color:rgba(255,255,255,0.85); border:none; border-radius:50%; width:36px; height:36px; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:18px; transition:all 0.2s; z-index:10; backdrop-filter:blur(4px); border: 1px solid rgba(255, 255, 255, 0.15); box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
  .fav-btn:hover { color:white; transform:scale(1.15); background:rgba(0,0,0,0.9); border-color: rgba(255, 215, 0, 0.4); }
  .fav-btn.active { color:#ffd700; text-shadow:0 0 12px rgba(255,215,0,0.8); border-color: rgba(255, 215, 0, 0.6); background: rgba(0,0,0,0.85); box-shadow: 0 4px 15px rgba(255,215,0,0.3); }
  .hero-card { position:relative; overflow:visible; }
  .hero-img-wrapper { position: relative; width: 60px; height: 60px; flex-shrink: 0; overflow:visible; }
  .hero-img-wrapper .fav-btn { bottom: -8px; right: -8px; width: 28px; height: 28px; font-size: 14px; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 2px 8px rgba(0,0,0,0.5); }

  .result-list::-webkit-scrollbar { height:8px; }
  .result-list::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.2); border-radius:8px; }
  .result-list::-webkit-scrollbar-track { background:rgba(0,0,0,0.2); border-radius:8px; }

  @media (max-width:820px) {
    .top-area { flex-direction:column; }
    .team { width:100%; }
    .result-header { flex-direction:column; align-items:flex-start; gap:12px; }
    .submit-btn { width: 100%; justify-content: center; }
  }

  /* MODAL STYLES */
  .modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; animation: fadeIn 0.3s forwards; }
  @keyframes fadeIn { to { opacity: 1; } }
  .modal-content { position: relative; width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8); margin-top: 0; }
  .close-btn { position: absolute; top: 16px; right: 16px; background: rgba(255, 255, 255, 0.1); border: none; color: white; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; z-index: 10; }
  .close-btn:hover { background: rgba(255, 74, 74, 0.8); transform: scale(1.1); }
