:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.feedback-link {
  color: var(--accent);
  font-weight: 700;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 22px clamp(16px, 4vw, 40px) 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.site-footer a {
  color: var(--accent);
  font-weight: 700;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 380px);
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 42px);
}

h2 {
  margin: 8px 0;
  font-size: 18px;
}

p {
  margin: 0;
}

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

.search-form {
  display: flex;
  gap: 8px;
}

input,
button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
}

input {
  min-width: 0;
  flex: 1;
  padding: 0 12px;
  background: #fff;
}

button {
  padding: 0 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

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

@media (max-width: 720px) {
  .team-grid {
    grid-template-columns: 1fr;
  }
}

.team-card,
.empty-state,
.detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail {
  padding: 24px;
}

.team-id {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.rental-code {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #e6f4f1;
  color: #075e56;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.pokemon-sprites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 10px;
}

.pokemon-sprite {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: linear-gradient(180deg, #f9fbfc 0%, #eef4f2 100%);
}

.pokemon-sprite img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sprite-fallback {
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.pokemon-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

.pokemon-chips span {
  display: inline-flex;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--accent);
}

.meta-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 18px;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.pokemon-detail-list {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pokemon-set {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.pokemon-set h3 {
  margin: 0;
  font-size: 16px;
}

.pokemon-set-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pokemon-set-header img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.pokemon-set-header .item-icon {
  width: 30px;
  height: 30px;
  margin-left: auto;
}

.pokemon-set pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.analysis-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.analysis-panel h2,
.analysis-panel h3 {
  margin: 0 0 10px;
}

.analysis-panel h3 {
  margin-top: 18px;
  font-size: 16px;
}

.analysis-panel p {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}


@media (max-width: 720px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .search-form {
    flex-direction: column;
  }

  .detail {
    padding: 16px;
  }

  .meta-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .meta-list dt {
    font-weight: 500;
  }

  .pokemon-set-header {
    flex-wrap: wrap;
  }

  .pokemon-set-header h3 {
    order: 1;
    width: 100%;
  }

  .pokemon-set-header img {
    order: 2;
  }

  .pokemon-set-header .item-icon {
    order: 3;
    margin-left: 0;
  }

}
