:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #2563eb;
  --red: #dc2626;
  --green: #168a5b;
  --shadow: 0 18px 40px rgba(21, 32, 54, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.status {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #b9e3ce;
  border-radius: 8px;
  background: #e9f8f0;
  color: #12643f;
  font-weight: 700;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.selector {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.selector label::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 1px;
}

.selector-a label::before {
  background: var(--blue);
}

.selector-b label::before {
  background: var(--red);
}

.combo {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 38px 44px;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
}

.combo input {
  border-radius: 8px 0 0 8px;
  border-right: 0;
}

.combo-clear,
.combo-toggle {
  min-height: 44px;
  padding: 0;
  border-left: 0;
  background: #f8fafc;
  color: var(--ink);
  border: 1px solid #cbd5e1;
}

.combo-clear {
  border-right: 0;
  border-radius: 0;
  color: #64748b;
  font-size: 20px;
  font-weight: 800;
}

.combo-toggle {
  border-radius: 0 8px 8px 0;
}

.combo-clear:hover,
.combo-toggle:hover {
  background: #e8edf5;
  color: var(--ink);
}

input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--blue);
}

button {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: #0f172a;
}

.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.24);
}

.combo-list.open {
  display: block;
}

.combo-option {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 600;
}

.combo-option:hover,
.combo-option.active {
  background: #2563eb;
}

.combo-option small {
  color: #cbd5e1;
  font-weight: 700;
}

.combo-empty {
  padding: 12px;
  color: #cbd5e1;
}

.combo-count {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}

.pokemon-column,
.radar-panel,
.detail-panel {
  min-width: 0;
}

.pokemon-card,
.radar-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pokemon-column {
  display: grid;
  gap: 18px;
}

.pokemon-card {
  padding: 16px;
}

.image-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.image-frame img {
  width: min(170px, 85%);
  max-height: 170px;
  object-fit: contain;
}

.pokemon-card h2 {
  overflow-wrap: anywhere;
  margin-bottom: 6px;
}

.card-a h2 {
  color: var(--blue);
}

.card-b h2 {
  color: var(--red);
}

.type-line,
.total-line {
  margin-bottom: 6px;
  color: var(--muted);
}

.total-line {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.radar-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 800;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.legend-a::before {
  background: var(--blue);
}

.legend-b::before {
  background: var(--red);
}

#radarCanvas {
  width: 100%;
  height: auto;
  min-height: 360px;
  display: block;
}

.summary,
.ai-score,
.model-info,
.roles {
  margin-bottom: 8px;
  line-height: 1.55;
}

.ai-score {
  font-size: 18px;
  font-weight: 900;
}

.model-info {
  color: var(--green);
  font-weight: 800;
}

.detail-panel {
  padding: 18px;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e6ebf2;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.positive {
  color: var(--blue);
  font-weight: 800;
}

.negative {
  color: var(--red);
  font-weight: 800;
}

.recommendations {
  display: grid;
  gap: 8px;
  margin: 0 0 20px 22px;
  padding: 0;
}

.recommendations li {
  line-height: 1.45;
}

.note {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #e6ebf2;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: 220px minmax(360px, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }

  .control-panel,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .pokemon-column {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .pokemon-column {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 14px;
  }
}
