:root {
  --fighters-blue: #005bac;
  --fighters-deep-blue: #003f7d;
  --fighters-sky: #eaf4ff;
  --fighters-gold: #d5a11e;
  --text: #152033;
  --muted: #65758b;
  --border: #d8e3ef;
  --surface: #ffffff;
  --error: #b42318;
  --error-bg: #fff1f0;
  --success: #176b3a;
  --success-bg: #effaf3;
  --shadow: 0 12px 28px rgba(0, 63, 125, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, #f1f7ff 0%, #ffffff 36%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.container {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
}

.app-header {
  color: #ffffff;
  background: var(--fighters-blue);
}

.header-inner {
  padding: 30px 0 34px;
}

.team-label {
  margin: 0 0 8px;
  color: #d7ecff;
  font-size: 0.88rem;
  font-weight: 700;
}

.version-label {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-mode-badge {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(159, 28, 28, 0.72);
  font-size: 0.86rem;
  font-weight: 900;
}

.game-info-display {
  display: inline-flex;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #f4fbff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.auth-panel {
  display: grid;
  gap: 5px;
  width: min(100%, 520px);
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(0, 44, 89, 0.28);
}

.auth-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #f4fbff;
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 900;
}

.auth-button:hover,
.auth-button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.auth-button.is-primary {
  border-color: #f0d77f;
  color: #2f3b16;
  background: #f7df86;
}

.auth-status {
  min-height: 1.2em;
  margin: 0;
  color: #d7ecff;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-status.is-success {
  color: #d7f8df;
}

.auth-status.is-warning {
  color: #ffe3a1;
}

.auth-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 26, 48, 0.56);
}

.auth-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #cfe1f1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 35, 70, 0.28);
}

.auth-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-dialog-heading h2 {
  color: var(--fighters-deep-blue);
}

.auth-close-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: #f7fbff;
  font-size: 1.4rem;
  line-height: 1;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 4px 0 16px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f1f6fb;
}

.auth-mode-tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 900;
}

.auth-mode-tab.is-selected {
  border-color: #9fc4e7;
  color: var(--fighters-deep-blue);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(25, 54, 82, 0.12);
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form-error {
  min-height: 1.5em;
  margin: 4px 0 0;
  color: var(--error);
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-dialog-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.probable-starter-card {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  color: #f4fbff;
  background: rgba(0, 44, 89, 0.36);
}

.probable-starter-card.is-success {
  border-color: rgba(189, 232, 204, 0.72);
  background: rgba(13, 76, 50, 0.38);
}

.probable-starter-card.is-pending,
.probable-starter-card.is-loading {
  background: rgba(255, 255, 255, 0.14);
}

.probable-starter-card.is-error {
  border-color: rgba(255, 211, 205, 0.8);
  background: rgba(128, 33, 33, 0.4);
}

.probable-starter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.probable-starter-label,
.probable-starter-message,
.probable-starter-meta,
.probable-starter-fetched {
  margin: 0;
}

.probable-starter-label {
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.probable-starter-heading a {
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
}

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

.probable-starter-team {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.probable-starter-team span,
.probable-starter-fetched {
  color: #d7ecff;
  font-size: 0.74rem;
  font-weight: 800;
}

.probable-starter-team strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 0.98rem;
}

.probable-starter-meta,
.probable-starter-message {
  color: #eef7ff;
  font-size: 0.82rem;
  font-weight: 700;
}

.perfect-achievers-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #cfe1f1;
  border-left: 4px solid var(--fighters-gold);
  border-radius: 8px;
  background: #fffdf5;
}

.perfect-achievers-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.perfect-achievers-heading .area-label,
.perfect-achievers-heading h3 {
  margin-bottom: 0;
}

.perfect-achievers-heading h3 {
  color: var(--fighters-deep-blue);
}

.perfect-achievers-count {
  flex: 0 0 auto;
  color: var(--fighters-deep-blue);
  font-size: 0.86rem;
  font-weight: 900;
}

.perfect-achievers-content {
  display: grid;
  gap: 10px;
}

.perfect-achievers-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.perfect-achievers-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #e4d6a2;
  border-radius: 6px;
  background: #ffffff;
}

.perfect-achievers-list li > span {
  color: var(--fighters-gold);
  font-weight: 950;
}

.perfect-achievers-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.perfect-achievers-list time {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.perfect-achievers-message,
.perfect-achievers-total {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.perfect-achievers-message.is-success {
  color: var(--success);
}

.perfect-achievers-message.is-error {
  color: var(--error);
}

.prediction-account-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #f7faff;
}

.prediction-account-status {
  margin: 0;
  color: #40546c;
  font-size: 0.9rem;
}

.prediction-account-status.is-success {
  color: var(--success);
}

.prediction-account-status.is-warning,
.prediction-account-status.is-error {
  color: #9a3f22;
}

.prediction-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.22rem;
  line-height: 1.35;
}

h3 {
  margin: 0 0 10px;
  color: var(--fighters-deep-blue);
  font-size: 0.98rem;
  line-height: 1.35;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: #eef7ff;
}

.app-layout {
  display: grid;
  gap: 18px;
  padding: 22px 0 42px;
}

.area-heading {
  grid-column: 1 / -1;
  padding: 16px 18px;
  border-left: 5px solid var(--fighters-blue);
  border-radius: 8px;
  background: #f7fbff;
}

.area-heading h2 {
  margin-bottom: 4px;
}

.area-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.area-label {
  margin-bottom: 4px;
  color: var(--fighters-blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.result-area-heading {
  border-left-color: var(--fighters-gold);
  background: #fff9e8;
}

.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lineup-card {
  grid-column: 1 / -1;
}

.admin-details {
  grid-column: 1 / -1;
  border: 1px solid #cfd9e5;
  border-radius: 8px;
  background: #f6f8fb;
}

.admin-details summary {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--fighters-deep-blue);
  cursor: pointer;
  font-weight: 900;
}

.admin-details summary::marker {
  color: var(--fighters-blue);
}

.admin-details summary small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.admin-card {
  margin: 0 12px 12px;
  border-style: dashed;
  box-shadow: none;
}

.admin-step {
  background: #6a7a8d;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.step-badge {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--fighters-blue);
  font-weight: 800;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

input {
  padding: 10px 12px;
}

select {
  padding: 10px 38px 10px 12px;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 91, 172, 0.18);
  border-color: var(--fighters-blue);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 0;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.primary-button {
  color: #ffffff;
  background: var(--fighters-blue);
  box-shadow: 0 8px 18px rgba(0, 91, 172, 0.25);
}

.secondary-button {
  color: var(--fighters-deep-blue);
  background: #edf6ff;
  border: 1px solid #b9daf8;
}

.danger-button {
  color: #ffffff;
  background: #9f1c1c;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible {
  outline: 3px solid rgba(213, 161, 30, 0.45);
  outline-offset: 2px;
}

.message {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-weight: 700;
  white-space: pre-wrap;
}

.error-message {
  color: var(--error);
}

.success-message {
  color: var(--success);
}

.npb-message.is-info {
  color: var(--fighters-deep-blue);
}

.npb-message.is-success {
  color: var(--success);
}

.npb-message.is-warning {
  color: #a15c00;
}

.npb-message.is-error {
  color: var(--error);
}

.auto-fetch-message.is-info {
  color: var(--fighters-deep-blue);
}

.auto-fetch-message.is-success {
  color: var(--success);
}

.auto-fetch-message.is-warning {
  color: #a15c00;
}

.auto-fetch-message.is-error {
  color: var(--error);
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbff;
}

.parser-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.npb-fetch-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #cfe1f1;
  border-radius: 8px;
  background: #ffffff;
}

.schedule-loader {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dce7f1;
}

.schedule-loader-title {
  margin: 0;
  color: var(--fighters-deep-blue);
  font-size: 0.9rem;
  font-weight: 900;
}

.schedule-next-summary {
  padding: 9px 10px;
  border: 1px solid #b9daf8;
  border-radius: 7px;
  background: #f3f9ff;
  color: var(--fighters-deep-blue);
  font-size: 0.86rem;
  font-weight: 800;
}

.schedule-loader-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.schedule-loader-row select {
  min-width: 0;
}

.schedule-loader-message.is-success {
  color: var(--success);
}

.schedule-loader-message.is-warning {
  color: #a15c00;
}

.schedule-log-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dce7f1;
}

.schedule-log-panel h3 {
  margin: 0;
  color: var(--fighters-deep-blue);
  font-size: 0.9rem;
}

.schedule-load-log {
  min-height: 88px;
  max-height: 220px;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #cbd8e5;
  border-radius: 7px;
  background: #f7fafc;
  color: #334155;
  font: 0.78rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.schedule-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.probable-starter-admin-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #b9cbe0;
  border-radius: 7px;
  background: #f7fbff;
}

.probable-starter-admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.probable-starter-admin-heading .preview-title,
.probable-starter-admin-heading .field-help {
  margin-bottom: 0;
}

.probable-starter-admin-log {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.probable-starter-admin-log ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
}

.probable-starter-admin-log li {
  overflow-wrap: anywhere;
}

.npb-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auto-fetch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.auto-fetch-summary,
.auto-fetch-validation,
.auto-fetch-log {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.auto-fetch-summary dl {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 0.9rem;
}

.auto-fetch-summary dt {
  color: var(--muted);
  font-weight: 800;
}

.auto-fetch-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.roster-monitor-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  margin: 0 0 10px;
  color: var(--fighters-deep-blue);
  font-size: 0.98rem;
  font-weight: 800;
}

.roster-monitor-title strong {
  padding: 3px 8px;
  border: 1px solid #b8c9d8;
  border-radius: 999px;
  background: #eef3f7;
  color: #425466;
  font-size: 0.82rem;
}

.roster-monitor-title strong.is-monitoring {
  border-color: #8fc6aa;
  background: #edf9f1;
  color: #176b3d;
}

.roster-monitor-title strong.is-fetching {
  border-color: #9fc4e7;
  background: #eef7ff;
  color: #155a91;
}

.roster-monitor-title strong.is-max-attempts,
.roster-monitor-title strong.is-manual {
  border-color: #d8bd82;
  background: #fff8e8;
  color: #805d16;
}

.roster-monitor-title strong.is-error {
  border-color: #e3a9a9;
  background: #fff1f1;
  color: #a52d2d;
}

.auto-fetch-validation ul,
.auto-fetch-log ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
}

.auto-fetch-validation li,
.auto-fetch-log li {
  overflow-wrap: anywhere;
}

.auto-fetch-validation .is-ok {
  color: var(--success);
  font-weight: 800;
}

.auto-fetch-validation .is-ng {
  color: var(--error);
  font-weight: 800;
}

.auto-fetch-log {
  max-height: 180px;
  overflow: auto;
  background: #ffffff;
}

.admin-flow-status {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.admin-flow-status strong {
  color: var(--fighters-deep-blue);
  font-size: 1rem;
}

.admin-flow-status span {
  color: var(--muted);
  font-weight: 700;
}

.admin-flow-status.is-preview {
  border-color: #b9daf8;
  background: #f3f9ff;
}

.admin-flow-status.is-approved {
  border-color: #a8dec0;
  background: var(--success-bg);
}

.admin-flow-status.is-approved strong {
  color: var(--success);
}

.admin-flow-status.is-provisional {
  border-color: #e3c46d;
  background: #fff9e8;
}

.admin-flow-status.is-provisional strong {
  color: #8a6200;
}

.admin-flow-status.is-error {
  border-color: #f2b8b5;
  background: var(--error-bg);
}

.admin-flow-status.is-error strong {
  color: var(--error);
}

.admin-server-scoring {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #b8c9d8;
  border-radius: 8px;
  background: #f5f9fd;
}

.admin-server-scoring-heading h3 {
  margin: 0;
  color: var(--fighters-deep-blue);
  font-size: 1.05rem;
}

.admin-server-scoring-heading p:not(.area-label) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-server-scoring-summary,
.admin-server-scoring-preview {
  padding: 12px;
  border: 1px solid #c8d8e6;
  border-radius: 7px;
  background: #ffffff;
}

.admin-server-scoring-summary dl,
.admin-server-scoring-preview dl {
  display: grid;
  grid-template-columns: minmax(116px, 0.8fr) minmax(0, 1.2fr);
  gap: 6px 12px;
  margin: 0;
}

.admin-server-scoring-summary dt,
.admin-server-scoring-preview dt {
  color: var(--muted);
  font-weight: 800;
}

.admin-server-scoring-summary dd,
.admin-server-scoring-preview dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.admin-server-scoring-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-server-scoring-preview {
  display: grid;
  gap: 10px;
  border-color: #d9b979;
  background: #fffaf0;
}

.admin-server-scoring-errors {
  margin: 0;
  color: var(--error);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.parser-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.compact-button {
  margin-top: 0;
}

.parser-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #b9daf8;
  border-radius: 8px;
  background: #f3f9ff;
}

.preview-title {
  margin: 0;
  color: var(--fighters-deep-blue);
  font-weight: 900;
}

.preview-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-list li {
  display: grid;
  grid-template-columns: 48px 42px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
}

.lineup-builder {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: 16px;
  align-items: start;
}

.lineup-panel,
.player-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.player-list-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 10px;
}

.player-list-heading h3 {
  margin: 0;
}

.player-list-current {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.roster-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
  padding: 4px;
  border: 1px solid #cfe1f1;
  border-radius: 8px;
  background: #edf4fa;
}

.roster-filter-button {
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.roster-filter-button:hover,
.roster-filter-button:focus-visible {
  border-color: #a9c7df;
  background: #ffffff;
  color: var(--fighters-deep-blue);
}

.roster-filter-button.is-selected {
  border-color: #6ca4d0;
  background: #ffffff;
  color: var(--fighters-deep-blue);
  box-shadow: 0 1px 3px rgba(25, 54, 82, 0.12);
}

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

.player-list {
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.lineup-slot {
  display: grid;
  grid-template-columns: 28px 46px minmax(0, 1fr) 42px 34px;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.lineup-slot.is-active {
  border-color: var(--fighters-blue);
  background: var(--fighters-sky);
  box-shadow: 0 0 0 3px rgba(0, 91, 172, 0.14);
}

.lineup-slot.is-drop-target {
  border-color: var(--fighters-gold);
  background: #fff9e8;
  box-shadow: 0 0 0 3px rgba(213, 161, 30, 0.22);
  transform: translateY(-1px);
}

.lineup-slot.has-player {
  background: #ffffff;
}

.player-chip.is-category-catcher,
.lineup-slot.is-category-catcher,
.lineup-list li.is-category-catcher,
.preview-list li.is-category-catcher,
.result-table td.is-category-catcher {
  border-color: #629fcf;
  border-left: 4px solid #2777b5;
  background: #dceeff;
}

.player-chip.is-category-infielder,
.lineup-slot.is-category-infielder,
.lineup-list li.is-category-infielder,
.preview-list li.is-category-infielder,
.result-table td.is-category-infielder {
  border-color: #c7a637;
  border-left: 4px solid #a37a00;
  background: #fff0b8;
}

.player-chip.is-category-outfielder,
.lineup-slot.is-category-outfielder,
.lineup-list li.is-category-outfielder,
.preview-list li.is-category-outfielder,
.result-table td.is-category-outfielder {
  border-color: #6caf7c;
  border-left: 4px solid #38834a;
  background: #dff2e3;
}

.player-chip.is-category-dh,
.lineup-slot.is-category-dh,
.lineup-list li.is-category-dh,
.preview-list li.is-category-dh,
.result-table td.is-category-dh {
  border-color: #bf7da2;
  border-left: 4px solid #9c3c72;
  background: #f5ddec;
}

.lineup-slot.is-duplicate {
  border-color: var(--error);
  background: var(--error-bg);
}

.slot-order {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border-radius: 8px;
  color: var(--fighters-deep-blue);
  background: var(--fighters-sky);
  font-weight: 900;
}

.slot-drag-handle {
  display: inline-grid;
  width: 28px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid #b7c8d8;
  border-radius: 6px;
  color: #46637d;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.05rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.slot-drag-handle:active {
  cursor: grabbing;
}

.slot-drag-handle:hover,
.slot-drag-handle:focus-visible {
  border-color: var(--fighters-blue);
  color: var(--fighters-deep-blue);
  background: #ffffff;
}

.slot-drag-handle.is-disabled {
  opacity: 0.35;
  cursor: default;
}

.slot-player {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-player .player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-empty {
  color: var(--muted);
  font-weight: 700;
}

.position-control {
  position: relative;
  width: 40px;
  height: 40px;
}

.position-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 7px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(25, 54, 82, 0.2);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(0);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.position-button.is-empty {
  color: #6f7f8f;
  background: #f5f7f9;
}

.position-button.is-catcher {
  color: #155f9c;
  background: #dceeff;
}

.position-button.is-infielder {
  color: #775500;
  background: #fff0b8;
}

.position-button.is-outfielder {
  color: #27723d;
  background: #dff2e3;
}

.position-button.is-dh {
  color: #8a295f;
  background: #f5ddec;
}

.position-button:hover,
.position-button:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 7px rgba(25, 54, 82, 0.24),
    0 0 0 3px rgba(0, 91, 172, 0.14);
  filter: brightness(1.025);
  transform: translateY(-1px);
}

.position-button[draggable="true"] {
  cursor: grab;
}

.position-button[draggable="true"]:active {
  cursor: grabbing;
}

.position-button.is-dragging {
  opacity: 0.62;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 7px 14px rgba(25, 54, 82, 0.28);
  transform: translateY(-2px) scale(1.04);
}

.position-button:active {
  box-shadow:
    inset 0 2px 3px rgba(25, 54, 82, 0.18),
    0 1px 2px rgba(25, 54, 82, 0.16);
  filter: brightness(0.98);
  transform: translateY(1px);
}

.result-position-tile {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(25, 54, 82, 0.18);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.result-position-tile.is-empty {
  color: #6f7f8f;
  background: #f5f7f9;
}

.result-position-tile.is-catcher {
  color: #155f9c;
  background: #dceeff;
}

.result-position-tile.is-infielder {
  color: #775500;
  background: #fff0b8;
}

.result-position-tile.is-outfielder {
  color: #27723d;
  background: #dff2e3;
}

.result-position-tile.is-dh {
  color: #8a295f;
  background: #f5ddec;
}

.position-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 36px);
  gap: 5px;
  width: max-content;
  padding: 8px;
  border: 1px solid #9fb8cf;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 46, 72, 0.2);
}

.position-menu-option {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: #f7fbff;
  font-weight: 900;
}

.position-menu-option:hover,
.position-menu-option:focus-visible {
  border-color: var(--fighters-blue);
  background: var(--fighters-sky);
}

.slot-clear {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
}

.slot-clear:hover,
.slot-clear:focus-visible {
  color: #ffffff;
  background: #9f1c1c;
}

.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #c7d7e8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  touch-action: pan-y;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.player-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.roster-status-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid #c9a55c;
  border-radius: 999px;
  background: #fff7df;
  color: #73520e;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.player-with-category,
.saved-lineup-player {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.player-position-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.player-detail-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #b9daf8;
  border-radius: 8px;
  background: #ffffff;
}

.player-detail-panel > strong {
  color: var(--fighters-deep-blue);
  font-size: 1.05rem;
}

.player-detail-panel > span {
  color: var(--muted);
  font-weight: 800;
}

.player-detail-positions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.player-category-badge,
.player-position-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
}

.player-category-badge.is-catcher,
.player-position-badge.is-catcher {
  color: #155f9c;
  background: #e5f3ff;
}

.player-category-badge.is-infielder,
.player-position-badge.is-infielder {
  color: #775500;
  background: #fff4c7;
}

.player-category-badge.is-outfielder,
.player-position-badge.is-outfielder {
  color: #27723d;
  background: #e7f6e9;
}

.player-category-badge.is-dh,
.player-position-badge.is-dh {
  color: #8a295f;
  background: #f8e8f2;
}

.player-chip:hover,
.player-chip:focus-visible {
  border-color: var(--fighters-blue);
  background: #f3f9ff;
}

.player-chip.is-used {
  border-color: #dbe3ec;
  color: var(--muted);
  background: #f2f5f8;
}

.player-chip[draggable="true"] {
  cursor: grab;
}

.player-chip[draggable="true"]:active {
  cursor: grabbing;
}

.player-chip.is-dragging,
.lineup-slot.is-dragging {
  opacity: 0.48;
}

.player-chip.is-flicking {
  border-color: var(--fighters-gold);
  background: #fff8df;
  transform: translateX(-6px);
}

.summary-box {
  display: grid;
  gap: 12px;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.lineup-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lineup-list li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #f7fbff;
}

.result-dashboard {
  display: grid;
  gap: 16px;
}

.result-hero {
  padding: 20px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--fighters-blue), var(--fighters-deep-blue));
}

.result-label {
  margin-bottom: 4px;
  color: #d7ecff;
  font-size: 0.78rem;
  font-weight: 900;
}

.score-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1;
}

.score-total strong {
  font-size: clamp(3.4rem, 12vw, 5.5rem);
  font-weight: 950;
}

.score-total span {
  color: #eaf4ff;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 900;
}

.score-comment {
  display: inline-flex;
  margin: 14px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--fighters-deep-blue);
  background: #ffffff;
  font-weight: 900;
}

.hit-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.breakdown-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7fbff;
}

.breakdown-item span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.breakdown-item strong {
  color: var(--fighters-deep-blue);
  font-size: 1.45rem;
  line-height: 1.2;
}

.breakdown-item small {
  color: var(--muted);
  font-weight: 800;
}

.result-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.result-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

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

.result-table th {
  color: var(--fighters-deep-blue);
  background: var(--fighters-sky);
  font-size: 0.86rem;
  font-weight: 900;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.hit-badge {
  display: inline-grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  border-radius: 50%;
  font-weight: 950;
}

.hit-badge.is-hit {
  color: #ffffff;
  background: var(--fighters-blue);
}

.hit-badge.is-miss {
  color: #ffffff;
  background: #8a99aa;
}

.hidden {
  display: none;
}

.admin-test-tools {
  display: grid;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 18px;
  border: 1px solid #e3a6a6;
  border-radius: 8px;
  background: #fff8f8;
}

.admin-test-tools h3,
.admin-test-tools p {
  margin: 0;
}

.admin-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auto-approve-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 44px;
  cursor: pointer;
}

.auto-approve-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--fighters-blue);
}

@media (min-width: 760px) {
  .app-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .player-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    padding: 24px;
  }

  .result-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 759px) {
  body {
    background: #f7fbff;
  }

  .container {
    width: min(100% - 20px, 960px);
  }

  .header-inner {
    padding: 24px 0 28px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .app-layout {
    gap: 14px;
    padding-top: 14px;
  }

  .area-heading {
    padding: 14px;
  }

  .card {
    padding: 16px;
  }

  .lineup-builder {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lineup-panel,
  .player-panel {
    padding: 10px;
  }

  .parser-actions {
    grid-template-columns: 1fr;
  }

  .admin-server-scoring-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-server-scoring-actions button {
    width: 100%;
  }

  .npb-url-row {
    grid-template-columns: 1fr;
  }

  .schedule-loader-row {
    grid-template-columns: 1fr;
  }

  .roster-filter {
    grid-template-columns: 1fr;
  }

  .auto-fetch-row {
    grid-template-columns: 1fr;
  }

  .hit-breakdown {
    grid-template-columns: 1fr;
  }

  .player-list {
    max-height: 260px;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 52px;
  }

  .admin-details summary {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .admin-card {
    margin: 0 8px 8px;
  }

  .probable-starter-admin-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .probable-starter-admin-heading .compact-button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .container {
    width: min(100% - 22px, 960px);
  }

  .card {
    padding: 16px;
  }

  .probable-starter-grid {
    grid-template-columns: 1fr;
  }

  .lineup-builder {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lineup-panel,
  .player-panel {
    padding: 8px;
  }

  input,
  select,
  textarea {
    min-height: 50px;
  }

  .lineup-slot {
    grid-template-columns: 26px 42px minmax(0, 1fr) 40px 32px;
    gap: 6px;
    padding: 6px;
  }

  .slot-order {
    min-height: 32px;
    font-size: 0.9rem;
  }

  .slot-drag-handle {
    width: 26px;
    height: 34px;
  }

  .slot-player,
  .player-chip,
  .position-button {
    font-size: 0.9rem;
  }

  .player-chip {
    min-height: 42px;
    padding: 8px;
  }

  .slot-clear {
    width: 28px;
    height: 28px;
  }

  .score-total {
    flex-wrap: wrap;
  }

  .perfect-achievers-list li {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .perfect-achievers-list time {
    grid-column: 2;
  }

  .result-table {
    min-width: 780px;
  }
}
