:root {
  --bg: #111116;
  --panel: #181820;
  --panel-alt: #20212c;
  --text: #f3f4f8;
  --muted: #9ea4b3;
  --accent: #5b7cfa;
  --line: rgba(255, 255, 255, 0.12);
  --pyro: #ef4444;
  --hydro: #38bdf8;
  --electro: #a855f7;
  --dendro: #22c55e;
  --cryo: #7dd3fc;
  --anemo: #2dd4bf;
  --geo: #f59e0b;
  --all: #94a3b8;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

.gt-shell {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.gt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gt-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gt-brand-icon {
  width: 42px;
  height: 42px;
  color: var(--accent);
  flex: none;
}

.gt-title {
  margin: 0;
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1.25;
}

.gt-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.gt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.gt-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.gt-badge-safe {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
  background: rgba(34, 197, 94, 0.08);
}

.gt-lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.gt-lang-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.gt-lang-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.gt-toast {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(91, 124, 250, 0.4);
  background: rgba(91, 124, 250, 0.14);
  color: var(--text);
  font-size: 13px;
}

.gt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gt-tab {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.gt-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gt-panel {
  display: grid;
  gap: 16px;
}

.gt-panel[hidden] {
  display: none;
}

.gt-source-banner {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  font-size: 13px;
  color: var(--muted);
}

.gt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gt-kpi-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  gap: 6px;
}

.gt-kpi-label {
  font-size: 12px;
  color: var(--muted);
}

.gt-kpi-val {
  font-size: clamp(20px, 3vw, 26px);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.gt-grade {
  color: #fbbf24;
}

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

.gt-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.gt-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gt-card-title {
  margin: 0;
  font-size: 16px;
}

.gt-muted {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.gt-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.gt-btn-primary {
  background: var(--accent);
  color: #fff;
}

.gt-btn-secondary {
  background: var(--panel-alt);
  border-color: var(--line);
  color: var(--text);
}

.gt-btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.gt-textarea,
.gt-input,
.gt-select {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.gt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.gt-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 5px;
}

.gt-dot-early::before { background: #22c55e; }
.gt-dot-mid::before { background: #38bdf8; }
.gt-dot-late::before { background: #f59e0b; }

.gt-pity-bars {
  display: grid;
  gap: 10px;
}

.gt-pity-item {
  display: grid;
  gap: 4px;
}

.gt-pity-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.gt-pity-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  border: 1px solid var(--line);
}

.gt-pity-fill {
  height: 100%;
  border-radius: 999px;
}

.gt-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.gt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.gt-table th,
.gt-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

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

.gt-pill-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.gt-pill-limited {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
}

.gt-pill-standard {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.gt-radar-wrap {
  display: grid;
  place-items: center;
  padding: 6px;
}

.gt-radar-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
}

.gt-advice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-alt);
  font-size: 13px;
  color: var(--muted);
}

.gt-field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.gt-stat-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gt-stat-inputs label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.gt-slot-list {
  display: grid;
  gap: 8px;
}

.gt-slot-row {
  display: grid;
  grid-template-columns: 76px 1fr 1fr 72px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-alt);
}

.gt-slot-name {
  font-size: 12px;
  font-weight: 600;
}

.gt-slot-cv {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fbbf24;
}

.gt-codex-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gt-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gt-pill {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.gt-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gt-filter-row {
  display: flex;
  gap: 8px;
  min-width: 260px;
  flex: 1 1 280px;
  max-width: 440px;
}

.gt-filter-row .gt-select {
  width: 110px;
  flex: none;
}

.gt-codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.gt-codex-card {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  gap: 10px;
  align-content: start;
}

.gt-codex-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gt-elem-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  flex: none;
}

.gt-codex-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.gt-codex-stats {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.gt-codex-effect {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.gt-empty {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .gt-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gt-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .gt-shell {
    padding: 12px;
  }
  .gt-stat-inputs {
    grid-template-columns: 1fr;
  }
  .gt-slot-row {
    grid-template-columns: 1fr 1fr;
  }
  .gt-slot-cv {
    text-align: left;
  }
}
