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

html, body {
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #0b0e14;
}

.banner {
  width: 100%;
  line-height: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.banner .banner-bg {
  width: 100%;
  height: auto;
  display: block;
}

.banner-emblem-wrap {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%) scale(1);
  height: 75%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.banner-emblem-wrap:hover {
  transform: translateY(-50%) scale(1.12);
}

.banner-emblem-wrap:active {
  transform: translateY(-50%) scale(1.04);
}

.banner-rotating-emblem {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));
  animation: rotateEmblem 24s linear infinite;
  transform-origin: center center;
  transition: filter 0.3s ease;
}

.banner-emblem-wrap.playing .banner-rotating-emblem {
  filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.85)) drop-shadow(0 0 28px rgba(59, 130, 246, 0.65));
}

@keyframes rotateEmblem {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.main-content {
  flex: 1;
  width: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 24px;
}

.main-content::before {
  content: "";
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  min-height: calc(100% + 40px);
  --tile-w: 160px;
  --tile-h: 128px;
  --blur-amount: 5px;
  background-image: url('images/background.png');
  background-repeat: repeat;
  background-size: var(--tile-w) var(--tile-h);
  background-position: 0 0;
  filter: blur(var(--blur-amount));
  z-index: 0;
  pointer-events: none;
  animation: moveGrid 60s linear infinite;
}

@keyframes moveGrid {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 1600px -1280px;
  }
}

.match-widget-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  margin: 0;
}

.dota-image-card {
  position: relative;
  width: 100%;
  min-height: 390px;
  aspect-ratio: 1024 / 591;
  background-image: url('images/card-bg.jpg');
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.75);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 8px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.dota-image-card.win {
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.dota-image-card.loss {
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.bottom-bar-panel {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.94) 0%, rgba(0, 0, 0, 0.6) 75%, transparent 100%);
  padding: 18px 22px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "hero outcome"
    "hero stats"
    "player player";
  gap: 10px 24px;
  align-items: center;
  box-sizing: border-box;
}

.block-hero {
  grid-area: hero;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding-right: 20px;
}

.hero-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-portrait {
  width: 68px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.rank-medal {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-medal .rank-base {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.75));
}

.rank-medal .rank-star {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.hero-meta {
  display: flex;
  flex-direction: column;
}

.hero-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.match-id {
  font-size: 0.68rem;
  color: #94a3b8;
}

.hero-kda {
  text-align: left;
}

.kda-numbers {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.kda-numbers .kills {
  color: #4ade80;
}

.kda-numbers .deaths {
  color: #f87171;
}

.kda-numbers .assists {
  color: #facc15;
}

.kda-ratio {
  font-size: 0.72rem;
  color: #cbd5e1;
}

.block-outcome {
  grid-area: outcome;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.match-outcome {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.match-outcome.win {
  color: #4ade80;
}

.match-outcome.loss {
  color: #f87171;
}

.match-info {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 500;
}

.block-stats {
  grid-area: stats;
  display: flex;
  gap: 18px;
}

.stat-unit {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.08rem;
  font-weight: 800;
  color: #ffffff;
}

.block-player {
  grid-area: player;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 10px;
  margin-top: 2px;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.player-meta {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.player-sub {
  font-size: 0.68rem;
  color: #cbd5e1;
}

.player-sub .radiant {
  color: #4ade80;
  font-weight: 600;
}

.player-sub .dire {
  color: #f87171;
  font-weight: 600;
}

.block-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}

.block-links a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.block-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.link-sep {
  color: #64748b;
}

.card-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-image: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.65)), url('images/card-bg.jpg');
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.state-text {
  font-size: 0.85rem;
  color: #e2e8f0;
}

@media (max-width: 600px) {
  .main-content {
    padding: 10px 8px;
  }

  .match-widget-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .dota-image-card {
    width: 100%;
    min-height: unset;
    aspect-ratio: 1024 / 591;
    border-radius: 8px;
  }

  .bottom-bar-panel {
    padding: 6px 10px 5px;
    gap: 3px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "outcome"
      "hero"
      "stats"
      "player";
  }

  .block-outcome {
    width: 100%;
    margin-bottom: 0;
  }

  .match-outcome {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
  }

  .match-info {
    font-size: 0.65rem;
  }

  .block-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px;
    width: 100%;
    border-right: none;
    padding-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 0;
  }

  .hero-header-row {
    gap: 5px;
  }

  .hero-portrait {
    width: 42px;
    height: 23px;
  }

  .rank-medal {
    width: 26px;
    height: 26px;
  }

  .hero-name {
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .match-id {
    font-size: 0.6rem;
    line-height: 1.1;
  }

  .hero-kda {
    text-align: right;
  }

  .kda-numbers {
    font-size: 0.92rem;
    line-height: 1.1;
  }

  .kda-ratio {
    font-size: 0.6rem;
    line-height: 1.1;
  }

  .block-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    width: 100%;
    padding: 2px 0;
  }

  .stat-unit {
    align-items: center;
    text-align: center;
  }

  .stat-label {
    font-size: 0.58rem;
    line-height: 1.1;
  }

  .stat-value {
    font-size: 0.85rem;
    line-height: 1.1;
  }

  .block-player {
    padding-top: 4px;
    margin-top: 0;
    width: 100%;
  }

  .player-left {
    gap: 6px;
  }

  .player-avatar {
    width: 22px;
    height: 22px;
  }

  .player-name {
    max-width: 110px;
    font-size: 0.72rem;
  }

  .player-sub {
    font-size: 0.58rem;
  }

  .block-links {
    gap: 6px;
    font-size: 0.65rem;
  }

  .banner-emblem-wrap {
    right: 3%;
    height: 80%;
  }
}

@media (max-width: 360px) {
  .dota-image-card {
    aspect-ratio: 16 / 10;
  }

  .hero-portrait {
    width: 36px;
    height: 20px;
  }

  .rank-medal {
    width: 22px;
    height: 22px;
  }

  .hero-name {
    font-size: 0.7rem;
  }

  .kda-numbers {
    font-size: 0.85rem;
  }

  .stat-value {
    font-size: 0.78rem;
  }

  .player-name {
    max-width: 85px;
  }
}
