:root {
  --bg-primary: #1e1d1b;
  --bg-secondary: #2a2928;
  --bg-hover: #3a3937;
  --text-primary: #faf9f5;
  --text-secondary: #e2e0da;
  --text-muted: #a8a59e;
  --text-dim: #54504a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.1);
  --accent: #ffed00;
  --accent-bg: rgba(255, 237, 0, 0.1);
  --accent-border: rgba(255, 237, 0, 0.3);
  --spinner-track: rgba(255, 237, 0, 0.2);
  --champion-bg: rgba(30, 29, 27, 0.9);
  --champion-border: rgba(255, 215, 0, 0.3);
}

body.light {
  --bg-primary: #ffffff;
  --bg-secondary: #f0f0f0;
  --bg-hover: #e5e5e5;
  --text-primary: #232127;
  --text-secondary: #3a383f;
  --text-muted: #6b6970;
  --text-dim: #9e9ca3;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --accent: #b8a900;
  --accent-bg: rgba(184, 169, 0, 0.1);
  --accent-border: rgba(184, 169, 0, 0.3);
  --spinner-track: rgba(184, 169, 0, 0.2);
  --champion-bg: rgba(255, 255, 255, 0.9);
  --champion-border: rgba(184, 169, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
}

#app {
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-primary);
  width: 318px;
  max-height: 496px;
  overflow: hidden;
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--spinner-track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 0;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  justify-content: center;
}

.scolia-icon {
  height: 14px;
  width: auto;
}

.scolia-id {
  color: var(--text-muted);
}

.country {
  color: var(--text-muted);
}

.avatar-wrapper {
  position: relative;
}

.champion-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 6px;
  background: var(--champion-bg);
  border: 1px solid var(--champion-border);
  border-radius: 6px;
  font-size: 9px;
  z-index: 2;
  line-height: 1.2;
  text-align: center;
  width: 80px;
}

.champion-icon {
  display: flex;
  align-items: center;
}

.champion-count {
  font-weight: 700;
  color: #ffd700;
  font-size: 14px;
}

.champion-label {
  color: var(--text-muted);
  font-size: 10px;
  display: block;
}

.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 6px 0 4px;
}

.refresh-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, transform 0.3s ease;
}

.refresh-btn:hover {
  opacity: 0.7;
}

.refresh-btn.spinning svg {
  animation: spin 0.6s linear;
  transform-origin: center center;
}

.stats-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.stats-column {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 8px;
  overflow: hidden;
}

.column-title {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.column-row {
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}

.column-label {
  font-size: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.column-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.history {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.match {
  display: grid;
  grid-template-columns: 18px 34px 16px 1fr auto;
  gap: 5px;
  align-items: center;
  padding: 4px 6px;
  background: var(--bg-secondary);
  border-radius: 5px;
  font-size: 11px;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.match:hover {
  background: var(--bg-hover);
}

a.match {
  cursor: pointer;
}

.match-result {
  font-weight: 700;
  font-size: 10px;
}

.match-result.win {
  color: #22c55e;
}

.match-result.loss {
  color: #ef4444;
}

.match-date {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

.match-type {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.match-opponent {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-avg {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.footer {
  margin-top: 8px;
  padding: 8px 0;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.powered-by {
  font-size: 9px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.powered-logo {
  height: 32px;
  width: auto;
  opacity: 0.5;
}

.lang-toggle {
  display: flex;
  gap: 3px;
}

#app {
  position: relative;
}

.lang-btn {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  position: relative;
}

.lang-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
}

.lang-btn:hover {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.lang-btn.lang-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}
