.iwm-app {
  --iwm-bg: #0f172a;
  --iwm-panel: #111827;
  --iwm-panel2: #020617;
  --iwm-text: #e5e7eb;
  --iwm-muted: #94a3b8;
  --iwm-line: rgba(255,255,255,.12);
  --iwm-strong: #f8fafc;
  --iwm-soft: rgba(255,255,255,.06);
  max-width: 980px;
  margin: 28px auto;
  color: var(--iwm-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

.iwm-app * { box-sizing: border-box; }

.iwm-card,
.iwm-result {
  background: linear-gradient(135deg, #1e293b, #020617);
  border: 1px solid var(--iwm-line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
  margin-bottom: 16px;
}

.iwm-hero h2 {
  color: var(--iwm-strong);
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
  margin: 4px 0 10px;
  letter-spacing: -.04em;
}

.iwm-hero p {
  margin: 0 0 12px;
  color: #cbd5e1;
}

.iwm-kicker {
  color: #93c5fd !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.iwm-status {
  display: inline-block;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--iwm-soft);
  color: #cbd5e1;
  font-size: 13px;
}

.iwm-form {
  background: #020617;
}

.iwm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.iwm-grid label span {
  display: block;
  color: var(--iwm-muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.iwm-grid select {
  width: 100%;
  color: var(--iwm-text);
  background: #0f172a;
  border: 1px solid var(--iwm-line);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
}

.iwm-button {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  color: #020617;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.iwm-button-sub {
  background: rgba(255,255,255,.08);
  color: var(--iwm-text);
  border: 1px solid var(--iwm-line);
}

.iwm-match-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.iwm-team-box {
  flex: 1;
  padding: 16px;
  border-radius: 18px;
  background: var(--iwm-soft);
  text-align: center;
  border: 1px solid var(--iwm-line);
}

.iwm-team-box b {
  display: block;
  font-size: clamp(21px, 4vw, 32px);
  line-height: 1.1;
}

.iwm-vs {
  color: var(--iwm-muted);
  font-weight: 900;
}

.iwm-main {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}

.iwm-section {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 18px;
  padding: 16px;
}

.iwm-section h3 {
  margin: 0 0 12px;
  color: var(--iwm-strong);
  font-size: 18px;
}

.iwm-rate-row {
  display: grid;
  grid-template-columns: 112px 1fr 58px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.iwm-rate-label {
  color: #cbd5e1;
  font-size: 14px;
}

.iwm-rate-track {
  height: 15px;
  background: rgba(255,255,255,.10);
  border-radius: 999px;
  overflow: hidden;
}

.iwm-rate-fill {
  height: 100%;
  width: 0;
  background: #e5e7eb;
  border-radius: 999px;
  transition: width .45s ease;
}

.iwm-rate-value {
  font-weight: 900;
  text-align: right;
}

.iwm-score {
  font-size: clamp(30px, 7vw, 52px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.05em;
}

.iwm-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 16px;
}

.iwm-stat {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
}

.iwm-stat small {
  display: block;
  color: var(--iwm-muted);
  margin-bottom: 4px;
}

.iwm-stat b {
  font-size: 18px;
}

.iwm-note {
  margin-top: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
  color: #cbd5e1;
}

.iwm-note b {
  color: var(--iwm-strong);
}

.iwm-source {
  margin-top: 14px;
  color: var(--iwm-muted);
  font-size: 12px;
}

.iwm-error {
  background: rgba(239,68,68,.13);
  border: 1px solid rgba(248,113,113,.35);
  color: #fecaca;
  border-radius: 14px;
  padding: 12px;
}

@media (max-width: 760px) {
  .iwm-grid,
  .iwm-main,
  .iwm-meta-grid {
    grid-template-columns: 1fr;
  }

  .iwm-match-title {
    flex-direction: column;
  }

  .iwm-team-box {
    width: 100%;
  }

  .iwm-rate-row {
    grid-template-columns: 88px 1fr 52px;
  }
}


.iwm-score-ranks {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.iwm-score-rank {
  display: grid;
  grid-template-columns: 48px 1fr 58px;
  gap: 8px;
  align-items: center;
  padding: 10px 11px;
  border-radius: 13px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
}

.iwm-score-rank span {
  color: var(--iwm-muted);
  font-size: 12px;
  font-weight: 800;
}

.iwm-score-rank b {
  color: var(--iwm-strong);
  font-size: 15px;
}

.iwm-score-rank em {
  color: #cbd5e1;
  font-style: normal;
  text-align: right;
  font-size: 13px;
}


.iwm-extra {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.iwm-table-wrap {
  overflow-x: auto;
}

.iwm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  color: #cbd5e1;
  font-size: 13px;
}

.iwm-table th,
.iwm-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  text-align: left;
  white-space: nowrap;
}

.iwm-table th {
  color: var(--iwm-muted);
  font-size: 12px;
  font-weight: 800;
}

.iwm-table td b {
  color: var(--iwm-strong);
}

.iwm-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.iwm-mini-box {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
}

.iwm-mini-box small {
  display: block;
  color: var(--iwm-muted);
  margin-bottom: 5px;
}

.iwm-mini-box b {
  color: var(--iwm-strong);
  font-size: 18px;
}

@media (max-width: 760px) {
  .iwm-mini-grid {
    grid-template-columns: 1fr;
  }
}


/* v0.2.5 mobile overflow fix */
.iwm-app,
.iwm-app * {
  max-width: 100%;
}

.iwm-card,
.iwm-result,
.iwm-section,
.iwm-mini-box {
  overflow: hidden;
}

.iwm-tournament-cards {
  display: grid;
  gap: 12px;
}

.iwm-tournament-card {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
}

.iwm-tournament-card h4 {
  margin: 0 0 10px;
  color: var(--iwm-strong);
  font-size: 15px;
  line-height: 1.35;
}

.iwm-tournament-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.iwm-tournament-team {
  min-width: 0;
  padding: 11px;
  border-radius: 13px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
}

.iwm-tournament-team small {
  display: block;
  color: var(--iwm-muted);
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.iwm-tournament-team b {
  display: block;
  color: var(--iwm-strong);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.iwm-tournament-team span {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  margin-top: 3px;
}

.iwm-table,
.iwm-table th,
.iwm-table td,
.iwm-table tr {
  background: transparent !important;
  color: #cbd5e1 !important;
}

@media (max-width: 760px) {
  .iwm-app {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .iwm-card,
  .iwm-result {
    padding: 16px;
    border-radius: 20px;
  }

  .iwm-section {
    padding: 14px;
  }

  .iwm-tournament-duo {
    grid-template-columns: 1fr;
  }

  .iwm-mini-box b {
    font-size: 17px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .iwm-score-rank {
    grid-template-columns: 42px 1fr;
  }

  .iwm-score-rank em {
    grid-column: 2;
    text-align: left;
  }
}


/* v0.2.6 extra insights */
.iwm-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.iwm-duel-box {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
}

.iwm-duel-box small {
  display: block;
  color: var(--iwm-muted);
  margin-bottom: 6px;
}

.iwm-duel-box b {
  display: block;
  color: var(--iwm-strong);
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.iwm-duel-box div {
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .iwm-split-grid {
    grid-template-columns: 1fr;
  }

  .iwm-duel-box b {
    font-size: 18px;
  }
}


/* v0.2.8 final tuning */
.iwm-select-note {
  margin-top: 8px;
  color: var(--iwm-muted);
  font-size: 12px;
  line-height: 1.5;
}

.iwm-hidden-by-mode {
  display: none !important;
}


/* v0.3.2 upset metric */
.iwm-subline {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
}


/* v0.3.3 upset balanced metric */
.iwm-upset-detail {
  margin-top: 5px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
}


/* v0.3.4 explanation cards */
.iwm-explain {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.iwm-explain-card {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--iwm-line);
  border-radius: 16px;
  padding: 14px;
}

.iwm-explain-card h4 {
  margin: 0 0 6px;
  color: var(--iwm-strong);
  font-size: 15px;
  line-height: 1.4;
}

.iwm-explain-card p {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.7;
}


/* v0.3.5 inline help */
.iwm-inline-help {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.6;
  margin: 4px 0 6px;
}

.iwm-section-help {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.65;
  margin: -4px 0 12px;
}


/* v0.3.8 opponent strength inline */
.iwm-strength-help {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
  margin-top: 4px;
}


/* v0.3.9 strength card */
.iwm-strength-card b {
  font-size: 20px;
}

.iwm-strength-winner {
  margin-top: 5px;
  color: var(--iwm-strong);
  font-weight: 700;
}

.iwm-strength-index {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
  margin-top: 4px;
}
