:root {
  color-scheme: light;
  --page: #f4f6f3;
  --surface: #ffffff;
  --surface-muted: #eef2ef;
  --ink: #20262b;
  --ink-muted: #5e6972;
  --line: #d8dedb;
  --line-strong: #aab5af;
  --green: #167657;
  --green-hover: #0f6045;
  --green-soft: #e4f3ec;
  --blue: #2867b2;
  --blue-soft: #e9f1fb;
  --red: #bc493e;
  --red-soft: #f9ece8;
  --amber: #a35c0a;
  --amber-soft: #fff3dc;
  --team-a: #2867b2;
  --team-b: #c84b41;
  --content-width: 1320px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
strong, h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 24px; line-height: 1.25; font-weight: 680; }
h2 { margin-bottom: 8px; font-size: 18px; line-height: 1.3; font-weight: 650; }
h3 { margin-bottom: 8px; font-size: 15px; line-height: 1.35; font-weight: 650; }
p { margin-bottom: 12px; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { overflow-wrap: anywhere; }
small, .small { font-size: 12px; color: var(--ink-muted); }
:focus-visible { outline: 3px solid #7ebca2; outline-offset: 2px; }

.site-header { position: relative; z-index: 10; min-height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; align-items: center; gap: 28px; width: min(calc(100% - 48px), var(--content-width)); min-height: 60px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: max-content; color: var(--ink); font-size: 16px; font-weight: 750; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--green); border-radius: 6px; background: var(--green); color: white; font-size: 13px; font-weight: 800; }
.primary-nav { display: flex; align-items: stretch; gap: 4px; min-height: 60px; }
.nav-link { display: inline-flex; align-items: center; padding: 0 12px; color: var(--ink-muted); border-bottom: 2px solid transparent; font-weight: 550; white-space: nowrap; }
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); font-weight: 680; }
.nav-more { position: relative; display: none; align-self: center; }
.nav-more summary { list-style: none; cursor: pointer; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more-menu { position: absolute; top: calc(100% + 7px); right: 0; z-index: 20; display: grid; min-width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 6px 18px rgb(18 28 22 / 12%); }
.nav-more-menu a { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 4px; color: var(--ink); }
.nav-more-menu a:hover, .nav-more-menu a[aria-current="page"] { background: var(--surface-muted); text-decoration: none; }
.header-spacer { flex: 1; }
.header-demo { padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.lucide { width: 17px; height: 17px; flex: none; }
.header-account { display: flex; align-items: center; gap: 8px; flex: none; }
.account-name { display: flex; align-items: center; gap: 6px; color: var(--ink); max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.app-dialog { width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 16px 64px #14221b30; }
.app-dialog-wide { width: min(640px, calc(100% - 24px)); }
.app-dialog::backdrop { background: #101c2a66; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 18px; }
.dialog-content { padding: 22px; }
.form-stack { display: grid; gap: 18px; min-width: 0; }
.form-stack input, .form-stack textarea, .form-stack select { width: 100%; padding: 10px 12px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 4px; background: white; }
.form-stack input[type="radio"] { width: 16px; min-height: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.form-stack textarea { resize: vertical; }
.form-feedback { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.personality-field { margin: 0; padding: 0; border: 0; }
.personality-field legend { font-size: 13px; font-weight: 620; margin-bottom: 8px; }
.personality-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.personality-option { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.personality-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.profile-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-appearance, .appearance-custom { border-top: 1px solid var(--line); padding-top: 14px; }
.profile-appearance summary { cursor: pointer; font-weight: 620; }
.profile-appearance > summary + div, .appearance-custom > div { margin-top: 14px; }
.appearance-fields { display: grid; gap: 12px; min-width: 0; }
.appearance-catalog { min-width: 0; padding: 0; margin: 0; border: 0; }
.appearance-catalog legend { padding: 0; font-weight: 620; }
.appearance-catalog p, .appearance-custom p { margin: 4px 0; }
.appearance-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding-block: 6px; }
.appearance-option { display: grid; justify-items: center; gap: 5px; padding: 4px 2px 6px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-size: 12px; }
.appearance-option img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: 4px; background: #f1f4f2; }
.appearance-option span { display: flex; align-items: center; justify-content: center; gap: 3px; flex-wrap: wrap; }
.appearance-option:hover, .appearance-option:focus-within { border-color: var(--green); }
.appearance-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.appearance-reset, [data-use-custom] { justify-self: start; }
.generation-view { width: 100%; height: 320px; min-width: 0; }
.bomber-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
[data-generation-feedback] { flex: 1 1 180px; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .site-header-inner { gap: 10px; flex-wrap: wrap; padding: 10px 0; }
  .primary-nav { min-height: 36px; order: 4; width: 100%; }
  .nav-link { min-height: 36px; padding: 0 11px; }
  .header-spacer { flex: 1; }
  .header-account { margin-left: auto; }
  .account-name { max-width: 95px; }
  .dialog-content { padding: 18px; }
  .appearance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .profile-options { grid-template-columns: minmax(0, 1fr); }
}

.page { width: min(calc(100% - 48px), var(--content-width)); min-height: calc(100vh - 60px); margin: 0 auto; padding: 28px 0 56px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title-row h1 { margin-bottom: 4px; }
.page-subtitle { margin: 0; color: var(--ink-muted); font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 24px 0 12px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.section-heading p { margin: 3px 0 0; color: var(--ink-muted); font-size: 12px; }
.section-divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.surface-muted { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 8px; }
.surface-pad { padding: 18px; }
.content-section { margin-top: 26px; }
.content-section:first-child { margin-top: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 620; white-space: nowrap; }
.button:hover { border-color: var(--ink-muted); background: var(--surface-muted); text-decoration: none; }
.button-primary { border-color: var(--green); background: var(--green); color: white; }
.button-primary:hover { border-color: var(--green-hover); background: var(--green-hover); color: white; }
.button-soft { border-color: #b8dacb; background: var(--green-soft); color: #105d42; }
.button-danger { border-color: #e7c4bd; background: var(--red-soft); color: #983b32; }
.button-small { min-height: 32px; padding: 0 9px; font-size: 12px; }
.button-compact { min-height: 36px; padding: 0 10px; }
.button-icon { width: 40px; min-width: 40px; padding: 0; }
.button[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.link-button { display: inline; padding: 0; border: 0; background: none; color: var(--blue); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field-label { color: var(--ink); font-size: 13px; font-weight: 620; }
.field input, .field select, .field textarea, .control { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.field textarea { min-height: 94px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); outline: 2px solid #bfe4d2; outline-offset: 1px; }
.field-hint { color: var(--ink-muted); font-size: 12px; }
.field-error { color: var(--red); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-full { grid-column: 1 / -1; }
.search-field { display: flex; align-items: center; min-width: 180px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.search-field input { flex: 1; width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 0; background: transparent; outline: none; }
.search-field:focus-within { border-color: var(--green); outline: 2px solid #bfe4d2; outline-offset: 1px; }
.search-field button { align-self: stretch; padding: 0 10px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink-muted); }
.segmented { display: inline-flex; align-items: stretch; max-width: 100%; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.segmented button, .segmented a { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 11px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-muted); white-space: nowrap; }
.segmented button[aria-pressed="true"], .segmented a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(20 28 24 / 12%); font-weight: 680; }
.segmented button:hover, .segmented a:hover { color: var(--ink); text-decoration: none; }

.tag { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); color: var(--ink-muted); font-size: 11px; font-weight: 620; white-space: nowrap; }
.tag-green { border-color: #bfddcf; background: var(--green-soft); color: #0f6949; }
.tag-blue { border-color: #c6d8ef; background: var(--blue-soft); color: #245d9d; }
.tag-red { border-color: #e8c7c0; background: var(--red-soft); color: #a13c32; }
.tag-amber { border-color: #efdab2; background: var(--amber-soft); color: var(--amber); }
.muted { color: var(--ink-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.mono { font-size: 12px; overflow-wrap: anywhere; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.stat-cell { min-width: 0; padding: 12px 14px; background: var(--surface); }
.stat-label { display: block; color: var(--ink-muted); font-size: 12px; }
.stat-value { display: block; margin-top: 3px; font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; }
.inline-stat { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }

.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.role-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 14px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.role-portrait { width: 84px; height: 84px; aspect-ratio: 1; object-fit: cover; object-position: center; border-radius: 6px; background: #f0f3f1; }
.ranked-portrait { position: relative; display: inline-grid; flex: none; vertical-align: middle; max-width: 100%; line-height: 0; isolation: isolate; }
.ranked-portrait > img { display: block; border-radius: inherit; }
.ranked-portrait > :not(.rank-badge) { line-height: 1.5; }
.rank-badge { position: absolute; z-index: 2; top: -6px; right: -6px; display: block; width: 24px; height: 24px; line-height: 0; filter: drop-shadow(0 1px 1px #14221b55); }
.rank-badge--tiny { width: 20px; height: 20px; top: -5px; right: -5px; }
.rank-badge--medium { width: 36px; height: 36px; top: -7px; right: -7px; }
.rank-badge--large { width: 56px; height: 56px; top: 2px; right: -6px; }
.rank-badge--hero { width: 72px; height: 72px; top: 8px; right: 8px; }
.ranked-portrait > .rank-badge > img { display: block; width: 100%; height: 100%; min-width: 0; max-width: none; padding: 0; margin: 0; border: 0; border-radius: 0; object-fit: contain; background: transparent; }
.ranked-portrait.bomber-portrait-frame, .ranked-portrait.p03-portrait-wrap { overflow: visible; }
.ranked-portrait.public-portrait-frame { display: block; width: 100%; }
.match-portrait-frame > .rank-badge { top: -2px; right: -4px; }
@media (max-width: 600px) {
  .rank-badge--large { width: 40px; height: 40px; }
}
.role-details { min-width: 0; }
.role-name { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 16px; font-weight: 690; }
.role-metadata { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-top: 5px; color: var(--ink-muted); font-size: 12px; }
.role-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.team-mark { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.team-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; }
.team-dot-a { background: var(--team-a); }
.team-dot-b { background: var(--team-b); }
.team-a-text { color: var(--team-a); }
.team-b-text { color: var(--team-b); }

.empty-state, .error-state, .notice, .loading-state { padding: 14px 16px; border-radius: 6px; }
.empty-state { border: 1px dashed var(--line-strong); color: var(--ink-muted); }
.error-state { border: 1px solid #ebc5bf; background: var(--red-soft); color: #923d34; }
.notice { border: 1px solid #cedbd3; background: var(--surface-muted); color: var(--ink-muted); }
.notice-info { border-color: #cad9eb; background: var(--blue-soft); color: #315d8c; }
.notice-success { border-color: #bfddcf; background: var(--green-soft); color: #135e44; }
.loading-state { border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); }
.inline-feedback { min-height: 20px; color: var(--ink-muted); font-size: 12px; }
.page-footnote { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; }

.data-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { background: var(--surface-muted); color: var(--ink-muted); font-size: 12px; font-weight: 650; }
.data-table td { font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #f8faf9; }
.table-secondary { display: block; margin-top: 3px; color: var(--ink-muted); font-size: 12px; }

.dialog-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(26 33 37 / 38%); }
.dialog { width: min(560px, 100%); max-height: min(80vh, 760px); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 36px rgb(18 28 22 / 18%); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (min-width: 1280px) { .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .site-header-inner { gap: 14px; }
  .nav-link { padding-inline: 9px; }
  .header-demo { display: none; }
  .page { width: min(calc(100% - 40px), var(--content-width)); padding-top: 24px; }
}
@media (max-width: 600px) {
  .site-header-inner { width: calc(100% - 28px); min-height: 54px; gap: 10px; }
  .site-header { min-height: 54px; }
  .brand { gap: 7px; font-size: 14px; }
  .brand-mark { width: 26px; height: 26px; }
  .primary-nav { flex: 1; justify-content: flex-end; min-height: 54px; gap: 0; }
  .nav-link { padding-inline: 5px; font-size: 11px; }
  .nav-docs { display: none; }
  .nav-more { display: block; }
  .nav-more summary { min-height: 44px; padding-inline: 8px; font-size: 11px; }
  .nav-more-menu [data-narrow-only] { display: none; }
  .page { width: calc(100% - 32px); min-height: calc(100vh - 54px); padding-top: 18px; }
  .page-title-row { align-items: flex-start; margin-bottom: 16px; }
  h1 { font-size: 22px; }
  .form-grid, .role-grid { grid-template-columns: minmax(0, 1fr); }
  .field-full { grid-column: auto; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell { padding: 10px 11px; }
  .role-row { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .role-portrait { width: 72px; height: 72px; }
  .button { min-height: 44px; }
  .button-small { min-height: 36px; }
  .button-icon { width: 44px; min-width: 44px; }
  .section-heading { align-items: flex-start; }
  .surface-pad { padding: 14px; }
  .data-table-wrap { border-radius: 6px; }
  .data-table th, .data-table td { padding: 10px 9px; }
  .dialog-backdrop { padding: 8px; align-items: end; }
  .dialog { width: 100%; max-height: 90dvh; padding: 16px; border-radius: 8px 8px 0 0; }
}

@media (max-width: 360px) {
  .nav-link.nav-history { display: none; }
  .nav-more-menu [data-narrow-only] { display: flex; }
}

@media (max-width: 600px) {
  .primary-nav { flex: 0 0 100%; justify-content: flex-start; min-height: 36px; }
  .nav-link { min-height: 36px; padding-inline: 9px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
