* { box-sizing: border-box; }

body {
  --player-bg: #000;
  --player-card: #0b0e10;
  --player-inset: #111619;
  --player-border: #293036;
  --player-text: #e8e8e8;
  --player-muted: #a3adb5;
  --player-accent: #7adbd2;

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

html.light body {
  --player-bg: #fff;
  --player-card: #fafbfb;
  --player-inset: #f0f3f3;
  --player-border: #dfe4e7;
  --player-text: #171717;
  --player-muted: #56636c;
  --player-accent: #076f67;
}

.player-container { max-width: 1080px; margin: 0 auto; padding: 26px 20px 56px; }
.player-container a { color: var(--player-accent); }
.player-container :focus-visible { outline: 2px solid var(--player-accent); outline-offset: 4px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; color: var(--player-muted); font-size: 13px; }
.breadcrumbs a { text-decoration: none; }
.player-hero { padding: 28px; border: 1px solid var(--player-border); border-radius: 16px; background: var(--player-card); }
.player-hero h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(32px, 5vw, 46px); line-height: 1.1; letter-spacing: -.03em; }
.player-identity { margin: 10px 0 24px; color: var(--player-muted); font-size: 14px; overflow-wrap: anywhere; }
.player-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; }
.player-stats div { display: flex; min-width: 0; flex-direction: column-reverse; gap: 5px; padding-left: 20px; border-left: 1px solid var(--player-border); }
.player-stats div:first-child { padding-left: 0; border-left: 0; }
.player-stats dt { color: var(--player-muted); font-size: 13px; }
.player-stats dd { margin: 0; font-size: clamp(21px, 3vw, 28px); font-weight: 750; overflow-wrap: anywhere; }
.record-note { margin: 20px 0 0; color: var(--player-muted); font-size: 13px; }
.player-history h2 { margin: 32px 0 16px; font-size: 24px; letter-spacing: -.02em; }
.appearance-list { display: flex; flex-direction: column; gap: 20px; }
.appearance-card { min-width: 0; overflow: hidden; border: 1px solid var(--player-border); border-radius: 14px; background: var(--player-card); }
.appearance-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 22px 24px 20px; }
.appearance-main { min-width: 0; }
.appearance-main time { color: var(--player-muted); font-size: 13px; }
.appearance-main h3 { margin: 7px 0 9px; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.appearance-main h3 a { color: inherit; text-decoration: none; }
.appearance-meta { display: flex; flex-wrap: wrap; gap: 5px 16px; margin: 0; color: var(--player-muted); font-size: 13px; }
.appearance-result { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; text-align: right; }
.appearance-result strong { font-size: 30px; line-height: 1.1; }
.appearance-result span { color: var(--player-muted); font-size: 13px; }
.placement-first { color: #e7be52; }
.placement-second { color: #bec7d0; }
.placement-third { color: #d79c70; }
html.light .placement-first { color: #896508; }
html.light .placement-second { color: #596a7a; }
html.light .placement-third { color: #975328; }
.profile-team { padding: 0 24px 22px; }
.profile-sprites { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.profile-pokemon-slot { position: relative; display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 9px; background: var(--player-inset); text-align: center; }
.profile-sprite { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; }
.profile-sprite-ball { width: 28px; height: 28px; margin: 18px; }
.profile-item-icon { position: absolute !important; top: 56px; left: calc(50% + 12px); transform: scale(.7); transform-origin: top left; image-rendering: pixelated; pointer-events: none; }
.profile-pokemon-name { font-size: 13px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.profile-item-name { color: var(--player-muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.team-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.player-container .profile-team-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 8px; background: #087f75; color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; }
.player-container .profile-team-action:hover { background: #076b63; text-decoration: none; }
.source-link { display: inline-flex; min-height: 44px; align-items: center; gap: 5px; font-size: 13px; text-decoration: none; }
.team-unavailable { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin: 0 24px 22px; padding: 12px 16px; border-radius: 9px; background: var(--player-inset); }
.team-unavailable p { margin: 0; color: var(--player-muted); font-size: 14px; line-height: 1.5; }
.round-results { border-top: 1px solid var(--player-border); }
.round-results summary { display: flex; min-height: 52px; align-items: center; gap: 14px; padding: 12px 24px; font-size: 13px; font-weight: 650; list-style: none; cursor: pointer; }
.round-results summary::-webkit-details-marker { display: none; }
.round-summary-label { flex-shrink: 0; }
.round-count { margin-left: 5px; color: var(--player-muted); font-weight: 400; }
.round-streak { display: flex; min-width: 0; flex: 1; justify-content: flex-end; gap: 6px; }
.round-streak-phase { display: flex; min-width: 0; gap: 3px; }
.round-mark { width: 9px; min-width: 2px; height: 14px; flex-shrink: 1; border-radius: 2px; background: currentcolor; }
.round-mark.match-tie { height: 6px; align-self: center; }
.round-mark.match-unknown { border: 1px solid currentcolor; background: transparent; }
.round-chevron { flex-shrink: 0; color: var(--player-muted); }
.round-results[open] .round-chevron { transform: rotate(90deg); }
.round-phases { display: flex; flex-direction: column; gap: 14px; padding: 0 24px 20px; }
.round-phase h4 { margin: 0 0 8px; color: var(--player-muted); font-size: 12px; font-weight: 500; }
.round-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.round-grid li { min-width: 0; }
.round-match { display: grid; min-height: 44px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid transparent; border-radius: 7px; background: var(--player-inset); font-size: 12px; }
.player-container .round-match { color: var(--player-text); text-decoration: none; }
.player-container a.round-match:hover { border-color: var(--player-accent); text-decoration: none; }
.round-number { color: var(--player-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.round-opponent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-result { display: inline-flex; min-width: 22px; height: 24px; align-items: center; justify-content: center; border: 1px solid currentcolor; border-radius: 5px; font-size: 11px; font-weight: 750; }
.match-win { color: #80d6ad; }
.match-loss, .match-double-loss { color: #f7a59e; }
.match-tie, .match-unknown { color: var(--player-muted); }
html.light .match-win { color: #23764e; }
html.light .match-loss, html.light .match-double-loss { color: #b13f36; }
.player-container a:hover { text-decoration: underline; }
.player-data-credit { margin: 24px 0 0; color: var(--player-muted); font-size: 12px; line-height: 1.5; }

@media (width <= 700px) {
  .player-container { padding: 20px 12px 80px; }
  .player-hero { padding: 22px 18px; }
  .player-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
  .player-stats div { padding: 0; border: 0; }
  .appearance-header { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; }
  .appearance-result { flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 12px; text-align: left; }
  .appearance-result strong { font-size: 24px; }
  .appearance-main h3 { font-size: 18px; }
  .profile-team { padding: 0 18px 18px; }
  .profile-sprites { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-pokemon-name { font-size: 12px; }
  .profile-item-name { font-size: 11px; }
  .team-actions { align-items: stretch; }
  .profile-team-action { flex: 1 0 100%; }
  .team-unavailable { margin: 0 18px 18px; }
  .round-results summary { gap: 10px; padding: 12px 18px; }
  .round-phases { padding: 0 18px 18px; }
  .round-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .round-match { gap: 5px; padding: 6px; }
}
