:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #f5f7fb;
  color: #111827;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: #f5f7fb; }
#app { display: flex; flex: 1; flex-direction: column; min-width: 0; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }

.site-footer {
  flex: 0 0 auto;
  padding: 12px 18px;
  border-top: 1px solid #dfe6f2;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: #1d4ed8; text-decoration: underline; }

.login-page {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #dfe6f2;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  padding: 28px;
}

.login-panel h1, .page-title h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.login-panel p, .muted { color: #64748b; }
.field { display: grid; gap: 6px; margin: 14px 0; }
.field span { font-size: 12px; font-weight: 700; color: #475569; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.primary { background: #2563eb; color: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.secondary { background: #fff; color: #1e293b; border: 1px solid #cfd8e6; border-radius: 10px; padding: 9px 13px; font-weight: 700; }
.danger { background: #ef4444; color: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.success { background: #16a34a; color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.ghost { background: transparent; color: #2563eb; padding: 8px; }
.error { color: #dc2626; min-height: 22px; }

.app-shell { flex: 1; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid #dfe6f2;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 18px; font-weight: 800; }
.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav button { background: transparent; color: #475569; padding: 8px 10px; border-radius: 9px; }
.nav button.active { background: #eaf1ff; color: #1d4ed8; }
.user-chip { display: flex; gap: 10px; align-items: center; color: #475569; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e2e8f0;
  color: #334155;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
  pointer-events: none;
}

.page { min-width: 0; padding: 14px 18px 18px; }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.team-page-title { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.team-heading-copy { display: grid; gap: 3px; min-width: 0; padding-top: 7px; }
.team-page-title h1 { font-size: 21px; white-space: nowrap; }
.team-heading-copy .muted { font-size: 11px; white-space: nowrap; }
.team-message-preview {
  grid-column: 1;
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 82px;
  padding: 7px 9px;
  border: 1px solid #d5dfec;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  text-align: left;
}
.team-message-preview:hover { border-color: #93b4ea; background: #f8fbff; }
.team-message-preview strong { color: #1d4ed8; font-size: 14px; }
.team-message-preview > span { display: grid; gap: 3px; min-width: 0; }
.team-message-preview i {
  overflow: hidden;
  color: #64748b;
  font-size: 13px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-data-entry {
  grid-column: 2;
  grid-row: 1 / 3;
  display: grid;
  place-content: center;
  gap: 5px;
  width: 68px;
  height: 82px;
  padding: 7px;
  border: 1px solid #86efac;
  border-radius: 8px;
  background: #ecfdf5;
  color: #15803d;
}
.team-data-entry:hover { border-color: #22c55e; background: #dcfce7; }
.data-chart-icon {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  width: 24px;
  height: 21px;
  margin: 0 auto;
  padding: 2px 3px;
  border-bottom: 2px solid currentColor;
}
.data-chart-icon i {
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}
.data-chart-icon i:nth-child(1) { height: 7px; }
.data-chart-icon i:nth-child(2) { height: 13px; }
.data-chart-icon i:nth-child(3) { height: 17px; }
.team-data-entry strong { font-size: 14px; }
.team-page-title .toolbar { justify-content: flex-end; gap: 6px; }
.team-page-title .toolbar > button { padding: 8px 10px; }
.team-page-title .toolbar-field { height: 38px; padding: 0 8px; }
.team-page-title .team-management {
  display: grid;
  grid-template-columns: minmax(180px, 250px) 68px minmax(190px, .8fr) minmax(420px, 1.6fr);
  grid-template-rows: 38px 38px;
  align-items: stretch;
  column-gap: 6px;
  row-gap: 6px;
  min-width: 0;
}
.team-page-title .team-management.is-viewer {
  grid-template-columns: 68px minmax(190px, 1fr) auto;
}
.team-management.is-viewer .team-data-entry { grid-column: 1; }
.team-management.is-viewer .team-order-entry,
.team-management.is-viewer .pick-strip { grid-column: 2; }
.team-management.is-viewer .team-settings-row,
.team-management.is-viewer .team-actions-row { grid-column: 3; }
.team-order-entry {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
.team-settings-row {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
}
.team-actions-row {
  grid-column: 4;
  grid-row: 2;
  justify-self: end;
}
.team-page-title .pick-strip {
  grid-column: 3;
  grid-row: 2;
  justify-self: center;
}
.team-settings-row, .team-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.team-settings-row > button, .team-actions-row > button {
  box-sizing: border-box;
  height: 38px;
  padding: 0 10px;
}
.team-order-entry .full-order-entry {
  box-sizing: border-box;
  height: 38px;
  padding: 0 10px;
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}
.team-order-entry .full-order-entry:hover {
  border-color: #1d4ed8;
  background: #dbeafe;
}
.deleted-user-mark {
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

@media (min-width: 761px) {
  .team-page-title .team-order-entry,
  .team-page-title .pick-strip {
    position: absolute;
    grid-column: auto;
    grid-row: auto;
    left: 50%;
    z-index: 1;
    transform: translateX(-50%);
  }
  .team-page-title .team-order-entry {
    top: 0;
  }
  .team-page-title .pick-strip {
    top: 44px;
    width: clamp(250px, 22vw, 328px);
  }
}
.stats-player-button:disabled {
  cursor: default;
  opacity: 0.78;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.panel {
  background: #fff;
  border: 1px solid #dfe6f2;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  padding: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 17px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-title-row h2 { margin: 0; }
.user-table-panel { min-width: 0; }
.user-table-scroll { overflow-x: auto; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.page-title .toolbar { margin-bottom: 0; }
.toolbar input, .toolbar select { border: 1px solid #cfd8e6; border-radius: 10px; padding: 9px 10px; background: #fff; }
.toolbar-field {
  display: inline-grid;
  grid-template-columns: auto 68px;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #cfd8e6;
  border-radius: 12px;
}
.toolbar-field span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.toolbar-field .number-input {
  width: 68px;
  height: 30px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
  font-weight: 800;
}
.toolbar-field .number-input:focus {
  outline: 2px solid #93c5fd;
  background: #fff;
}
.toolbar-field select {
  min-width: 74px;
  height: 30px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 800;
}
.toolbar-field select:disabled { color: #94a3b8; cursor: not-allowed; }
.choice-panel {
  display: grid;
  gap: 10px;
  margin: -6px 0 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid #dfe6f2;
  border-radius: 14px;
}
.choice-group {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.choice-group > span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.choice-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.choice {
  width: 34px;
  height: 30px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid #d6e0ee;
  color: #334155;
  font-weight: 800;
}
.choice:hover { background: #edf5ff; }
.choice.selected {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}
.pick-strip {
  grid-area: current;
  justify-self: stretch;
  box-sizing: border-box;
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 4px 6px;
  background: #eef4ff;
  border: 1px solid #c7d9ff;
  border-radius: 9px;
  color: #334155;
}
.pick-strip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-window {
  display: grid;
  grid-template-columns: repeat(5, 46px);
  gap: 4px;
  width: auto;
}
.pick-chip {
  min-width: 0;
  height: 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c7d9ff;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.pick-chip.current {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.22);
  transform: scale(1.05);
}
.pick-chip.empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.pick-empty {
  color: #64748b;
  font-size: 13px;
}
.pick-complete {
  padding: 0 8px;
  color: #15803d;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.team-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.teams { display: grid; align-self: start; align-content: start; gap: 10px; min-width: 0; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); align-items: start; gap: 10px; }
.team-grid.balanced-grid { grid-template-columns: repeat(var(--team-columns), minmax(0, 1fr)); }
.match-section, .result-section { display: grid; align-content: start; gap: 8px; }
.section-label { color: #475569; font-size: 13px; font-weight: 800; }
.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.match-card {
  overflow: hidden;
  border: 1px solid #aebed3;
  border-radius: 10px;
  background: #eaf0f8;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.09);
}
.match-card > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  background: #172033;
  color: #fff;
}
.match-card > header strong { font-size: 13px; }
.match-card > header span { color: #cbd5e1; font-size: 11px; }
.match-pair {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 8px;
}
.match-pair::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: #94a3b8;
  z-index: 0;
}
.match-pair .team {
  position: relative;
  z-index: 1;
  min-height: 112px;
  padding: 8px;
  border-width: 1px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
}
.match-pair .team.side-a { border-top: 3px solid #2563eb; }
.match-pair .team.side-b { border-top: 3px solid #e11d48; }
.versus {
  position: relative;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  border: 2px solid #172033;
  border-radius: 50%;
  background: #fff;
  color: #172033;
  font-weight: 900;
  font-size: 11px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}
.versus small { color: #64748b; font-size: 7px; font-weight: 800; }
.versus strong { line-height: 1; }
.team, .pool { min-height: 150px; padding: 12px; }
.member-pools {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.pool {
  max-height: none;
  overflow: visible;
}
.captain-pool {
  border-color: #86b7a8;
  background: #f3fbf8;
}
.captain-pool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.pool-list, .team-members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 5px;
}
.team.active-pick {
  border: 3px solid #1d4ed8;
  background: #f0f6ff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.18), 0 22px 52px rgba(37, 99, 235, 0.24);
  transform: translateY(-3px);
}
.team.active-pick .team-head {
  margin: -10px -10px 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
}
.team.active-pick .team-head .muted {
  color: #fff;
  font-weight: 800;
}
.match-result-controls, .result-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.match-result-controls button { flex: 1; padding: 6px 8px; font-size: 12px; }
.result-controls { justify-content: space-between; }
.result-controls .secondary { padding: 6px 9px; font-size: 12px; }
.result-win { color: #15803d; }
.result-loss { color: #dc2626; }
.team-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.team-title { font-weight: 800; }
.pool-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.pool-members-button { padding: 5px 8px; font-size: 12px; }
.pool-self-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.pool-self-status.present {
  border-color: #60a5fa;
  background: #eff6ff;
  color: #1d4ed8;
}
.roll-entry { position: relative; }
.unread-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #dc2626;
}
.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  margin-right: 7px;
  padding: 3px 5px;
  border-radius: 6px;
  background: #eaf1ff;
  color: #1d4ed8;
  font-size: 12px;
}
.ranking-grid .team:first-child { border-color: #eab308; box-shadow: 0 16px 42px rgba(202, 138, 4, 0.16); }
.champion-team {
  position: relative;
  overflow: hidden;
  border: 2px solid #eab308;
  background: #fffdf2;
  animation: champion-pulse 2.2s ease-in-out infinite;
}
.champion-effect, .sad-effect {
  position: relative;
  height: 25px;
  display: grid;
  place-items: center;
  margin: 8px -4px -4px;
  overflow: hidden;
  border-radius: 7px;
}
.champion-effect { background: #fef3c7; color: #92400e; }
.champion-effect strong, .sad-effect strong { position: relative; z-index: 2; font-size: 11px; letter-spacing: 0; }
.champion-effect i { position: absolute; color: #eab308; font-style: normal; animation: champion-star 1.8s ease-in-out infinite; }
.champion-effect i::before { content: "★"; }
.champion-effect i:nth-child(1) { left: 12%; animation-delay: -0.4s; }
.champion-effect i:nth-child(2) { left: 48%; animation-delay: -1.1s; }
.champion-effect i:nth-child(3) { right: 12%; animation-delay: -0.8s; }
.last-place-team { position: relative; overflow: hidden; border: 2px solid #94a3b8; background: #f8fafc; filter: saturate(0.72); }
.sad-effect { background: #e8f1fb; color: #475569; }
.sad-effect i {
  position: absolute;
  top: -8px;
  width: 5px;
  height: 10px;
  border-radius: 50% 50% 55% 55%;
  background: #60a5fa;
  animation: sad-rain 1.6s linear infinite;
}
.sad-effect i:nth-child(1) { left: 18%; animation-delay: -0.4s; }
.sad-effect i:nth-child(2) { left: 52%; animation-delay: -1.1s; }
.sad-effect i:nth-child(3) { right: 16%; animation-delay: -0.8s; }
@keyframes champion-pulse { 0%, 100% { box-shadow: 0 10px 30px rgba(202, 138, 4, 0.12); } 50% { box-shadow: 0 14px 38px rgba(202, 138, 4, 0.3); } }
@keyframes champion-star { 0%, 100% { opacity: 0.35; transform: translateY(4px) scale(0.75); } 50% { opacity: 1; transform: translateY(-3px) scale(1.1); } }
@keyframes sad-rain { 0% { opacity: 0; transform: translateY(-4px); } 20% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(38px); } }
.team-members > .member {
  min-height: 50px;
  gap: 7px;
  margin-bottom: 0;
  padding: 5px;
  border-radius: 8px;
}
.team-members > .member .avatar { width: 30px; height: 30px; font-size: 10px; }
.team-members > .member .member-meta { font-size: 10px; }
.team-members > .member .member-detail-line { font-size: 10px; }
.member {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
  user-select: none;
}
.member[draggable="true"] { cursor: grab; }
.member-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  flex: 1;
}
.member.compact-member {
  gap: 6px;
  min-height: 50px;
  margin-bottom: 0;
  padding: 5px;
  border-radius: 8px;
}
.member.compact-member .avatar {
  width: 30px;
  height: 30px;
  font-size: 10px;
}
.member-avatar-wrap {
  position: relative;
  display: flex;
  flex: 0 0 36px;
  align-items: flex-end;
  justify-content: center;
  width: 36px;
  height: 42px;
}
.member.compact-member .member-avatar-wrap {
  flex-basis: 30px;
  width: 30px;
  height: 36px;
}
.member.compact-member .member-name {
  font-size: 12px;
}
.member-name {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.member-name > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.member-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 2px 7px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
}
.member-detail-line {
  color: #475569;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.member.level-mentor {
  border-color: #2dd4bf;
  background: #ecfdf5;
  box-shadow: inset 3px 0 0 #0f766e;
}
.member.level-mentor .member-name { color: #115e59; }
.member.is-self-in-pool {
  border: 2px solid #2563eb;
  background: #eff6ff;
  box-shadow: inset 4px 0 0 #1d4ed8, 0 5px 14px rgba(37, 99, 235, 0.2);
}
.self-member-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 4px;
  background: #1d4ed8;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
}
.captain-badge {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 1;
  padding: 1px 4px;
  border: 1px solid #fff;
  border-radius: 5px;
  background: #16a34a;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.18);
}
.drop-target { outline: 2px dashed #93c5fd; outline-offset: 3px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid #e2e8f0; padding: 10px; text-align: left; vertical-align: middle; }
.table th { font-size: 12px; color: #64748b; }
.table-avatar-upload {
  display: block;
  width: 36px;
  height: 36px;
  padding: 0;
  line-height: 0;
  border-radius: 50%;
  cursor: pointer;
  overflow: visible;
  isolation: isolate;
}
.table-avatar-upload .avatar { pointer-events: none; }
.table-avatar-upload input {
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: pointer !important;
}
.table-avatar-upload::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  padding: 6px 8px;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.table-avatar-upload:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.table-avatar-upload:hover .avatar { outline: 2px solid #93c5fd; outline-offset: 2px; }
.table-action { padding: 6px 9px; font-size: 12px; white-space: nowrap; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #dfe6f2;
  box-shadow: 0 28px 100px rgba(15, 23, 42, 0.24);
  padding: 18px;
}
.modal h2 { margin: 0 0 8px; font-size: 19px; }
.confirm-modal {
  width: min(380px, calc(100vw - 40px));
  text-align: center;
}
.confirm-modal p {
  color: #475569;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.continuation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.continuation-actions button { padding: 9px; }
.continuation-actions button:disabled { cursor: not-allowed; opacity: 0.45; }
.match-setup-modal { width: min(620px, calc(100vw - 40px)); }
.match-setup-modal > .muted { margin: 4px 0 10px; line-height: 1.5; }
.custom-order-modal {
  width: min(500px, calc(100vw - 40px));
  text-align: left;
}
.custom-order-modal > .muted { margin: 4px 0 12px; line-height: 1.5; }
.custom-round-list {
  display: grid;
  gap: 7px;
  max-height: 52vh;
  overflow: auto;
  padding: 1px;
}
.custom-round-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}
.custom-round-row span {
  color: #475569;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
}
.custom-round-row input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #fff;
}
.custom-round-row input:focus { outline: 2px solid #2563eb; outline-offset: 1px; }
.custom-round-empty { margin: 10px 0; text-align: center; }
.match-id-help { font-size: 12px; }
.manual-match-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}
.manual-match-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.manual-match-row.wide-row { grid-column: 1 / -1; }
.manual-match-row strong { color: #475569; font-size: 12px; }
.manual-match-row span { color: #64748b; text-align: center; font-size: 11px; font-weight: 800; }
.manual-match-row select {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #fff;
  padding: 4px 6px;
  font-size: 12px;
}
.check-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 14px 0; }
.check-item { display: flex; gap: 8px; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px; }
.check-item small { color: #64748b; margin-left: auto; }

.context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.2);
  padding: 6px;
  z-index: 80;
}
.context-menu button { display: block; width: 180px; background: #fff; text-align: left; padding: 9px; border-radius: 8px; }
.context-menu button:hover { background: #eff6ff; }

.pick-order-modal {
  width: min(var(--pick-order-width, 420px), calc(100vw - 40px));
  padding: 16px;
}
.pick-order-modal h2 { margin-bottom: 6px; }
.pick-order-modal .modal-actions { margin-top: 10px; }
.pick-rounds {
  display: grid;
  align-items: start;
  gap: 6px;
  max-height: calc(88vh - 108px);
  overflow: auto;
  padding: 1px;
}
.pick-round {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 7px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.pick-round > strong { color: #475569; font-size: 12px; }
.pick-round > div { display: flex; flex-wrap: nowrap; gap: 4px; }
.pick-round .pick-team {
  min-width: 38px;
  padding: 4px 6px;
  border: 1px solid #c7d9ff;
  border-radius: 6px;
  background: #fff;
  color: #1d4ed8;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}
.pick-order-empty {
  margin: 6px 0 2px;
  padding: 14px;
  border: 1px dashed #cfd8e6;
  border-radius: 8px;
  text-align: center;
}
.pick-round .pick-team:hover { border-color: #2563eb; background: #eff6ff; }
.pick-round .pick-team.selected {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.24);
}
.online-modal { width: min(640px, calc(100vw - 40px)); }
.online-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 14px; }
.online-member {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
  cursor: context-menu;
}
.online-member > div { display: grid; gap: 2px; min-width: 0; }
.online-member strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-member span { color: #64748b; font-size: 11px; }
.online-member i {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}
.member-search-modal { width: min(680px, calc(100vw - 40px)); }
.search-field { margin-top: 10px; }
.search-results {
  display: grid;
  gap: 7px;
  min-height: 180px;
  max-height: 52vh;
  overflow: auto;
  padding: 8px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.search-placeholder { margin: auto; text-align: center; }
.search-member {
  display: grid;
  grid-template-columns: 36px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: context-menu;
}
.search-member-main { display: grid; gap: 2px; min-width: 0; }
.search-member-main strong, .search-member-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-member-main span { color: #64748b; font-size: 11px; }
.status-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.status-badges span {
  padding: 3px 6px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 10px;
  font-weight: 800;
}
.roll-modal { width: min(680px, calc(100vw - 40px)); }
.roll-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.roll-messages {
  display: grid;
  gap: 6px;
  min-height: 180px;
  max-height: 50vh;
  overflow: auto;
  padding: 10px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.roll-message {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  background: #fff;
  color: #334155;
}
.roll-message b { color: #1d4ed8; font-size: 16px; }
.roll-message time { flex: 0 0 auto; color: #94a3b8; font-size: 11px; }
.roll-message.mine {
  border: 1px solid #60a5fa;
  background: #eaf3ff;
  box-shadow: inset 4px 0 0 #2563eb;
}
.roll-message.mine strong { color: #1d4ed8; }
.system-message-modal { width: min(760px, calc(100vw - 40px)); }
.message-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; }
.message-toolbar .danger { padding: 7px 10px; flex: 0 0 auto; }
.system-message-list {
  display: grid;
  gap: 6px;
  min-height: 200px;
  max-height: 56vh;
  overflow: auto;
  padding: 9px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.system-message { display: grid; grid-template-columns: 44px 1fr; gap: 9px; align-items: start; padding: 9px; border-radius: 7px; background: #fff; }
.system-message p { margin: 0 0 3px; color: #334155; line-height: 1.45; }
.system-message time { color: #94a3b8; font-size: 10px; }
.message-type { padding: 4px 5px; border-radius: 5px; background: #e2e8f0; color: #475569; text-align: center; font-size: 10px; font-weight: 800; }
.message-type.picking { background: #dbeafe; color: #1d4ed8; }
.message-type.match { background: #fef3c7; color: #92400e; }
.message-type.result { background: #dcfce7; color: #166534; }
.stats-modal { width: min(1040px, calc(100vw - 40px)); }
.stats-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 12px 0 10px;
}
.stats-controls label { display: grid; gap: 5px; min-width: 140px; }
.stats-controls label span { color: #64748b; font-size: 11px; font-weight: 800; }
.stats-controls select {
  height: 38px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  padding: 0 34px 0 10px;
  background: #fff;
  color: #1e293b;
  font-weight: 700;
}
.stats-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 38px;
  padding: 3px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #f8fafc;
}
.stats-levels button {
  min-width: 82px;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-weight: 800;
}
.stats-levels button.active { background: #fff; color: #1d4ed8; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.14); }
.stats-manage-actions { display: flex; gap: 8px; margin-left: auto; }
.stats-activity-status {
  margin: 0 0 10px;
  padding: 8px 11px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}
.stats-activity-status.ended { border-color: #cbd5e1; background: #f8fafc; color: #475569; }
.stats-table-scroll { height: min(58vh, 520px); overflow: auto; border: 1px solid #dfe6f2; border-radius: 8px; }
.stats-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.stats-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #dfe6f2;
  color: #64748b;
  font-size: 11px;
  text-align: left;
}
.stats-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
}
.stats-sort-button:hover, .stats-sort-button.active { color: #1d4ed8; }
.stats-sort-button:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.stats-table td { padding: 9px 12px; border-bottom: 1px solid #eef2f7; color: #334155; }
.stats-table tbody tr:last-child td { border-bottom: 0; }
.stats-table tbody tr:hover { background: #f8fbff; }
.stats-table tbody tr.stats-self-row { box-shadow: inset 4px 0 #2563eb; background: #eff6ff; }
.stats-table tbody tr.stats-self-row:hover { background: #e8f2ff; }
.stats-table tbody tr.stats-top-rank-1 { background: linear-gradient(90deg, rgba(250, 204, 21, 0.20), rgba(255, 255, 255, 0) 52%); }
.stats-table tbody tr.stats-top-rank-2 { background: linear-gradient(90deg, rgba(148, 163, 184, 0.20), rgba(255, 255, 255, 0) 52%); }
.stats-table tbody tr.stats-top-rank-3 { background: linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(255, 255, 255, 0) 52%); }
.stats-table tbody tr.stats-self-row.stats-top-rank { box-shadow: inset 4px 0 #2563eb, inset 0 0 24px rgba(37, 99, 235, 0.06); }
.stats-table td small { display: block; margin-top: 2px; color: #94a3b8; font-size: 10px; }
.stats-rank {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  background: #eaf1ff;
  color: #1d4ed8;
  font-weight: 900;
}
.stats-championship-rank {
  display: inline-flex;
  min-width: 76px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  background: #f8fafc;
  color: #475569;
  font-weight: 900;
}
.stats-championship-rank small { margin-top: 0 !important; color: inherit !important; font-weight: 800; }
.stats-championship-rank-1 { border-color: #facc15; background: #fef9c3; color: #854d0e; box-shadow: 0 0 12px rgba(250, 204, 21, 0.38); }
.stats-championship-rank-2 { border-color: #94a3b8; background: #f1f5f9; color: #334155; box-shadow: 0 0 10px rgba(148, 163, 184, 0.32); }
.stats-championship-rank-3 { border-color: #d97706; background: #ffedd5; color: #9a3412; box-shadow: 0 0 10px rgba(217, 119, 6, 0.28); }
.stats-player { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.stats-player .avatar { width: 30px; height: 30px; }
.stats-player-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  padding: 3px 5px;
  border-radius: 6px;
  background: transparent;
  color: #166534;
  text-align: left;
}
.stats-player-button:hover { background: #ecfdf3; color: #14532d; }
.stats-player-button:focus-visible { outline: 2px solid #86efac; outline-offset: 2px; }
.stats-player-button .avatar { width: 30px; height: 30px; }
.stats-self-badge { flex: none; padding: 2px 5px; border-radius: 999px; background: #2563eb; color: #fff; font-size: 10px; font-weight: 900; }
.stats-empty { height: 160px; color: #64748b !important; text-align: center; }
.stats-child-modal { width: min(760px, calc(100vw - 40px)); }
.radar-modal { width: min(820px, calc(100vw - 40px)); }
.radar-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.radar-summary span { padding: 7px 10px; border-radius: 6px; background: #f1f5f9; color: #475569; }
.radar-summary strong { margin-left: 4px; color: #166534; }
.stats-radar { display: block; width: min(100%, 620px); height: auto; aspect-ratio: 31 / 23; margin: 0 auto; }
.radar-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; }
.radar-values div { padding: 8px; border-bottom: 1px solid #e2e8f0; }
.radar-values dt { color: #64748b; font-size: 11px; font-weight: 800; }
.radar-values dd { margin: 4px 0 0; color: #1e293b; font-weight: 900; }
.best-badge { display: inline-block; margin-left: 6px; padding: 2px 5px; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: 10px; }
.stats-editor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.stats-editor-grid .field { min-width: 0; }
.stats-editor-grid input, .stats-editor-grid select { width: 100%; }
.stats-best-options { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 10px; border: 1px solid #dfe6f2; border-radius: 8px; }
.stats-best-options legend { padding: 0 5px; color: #64748b; font-size: 11px; font-weight: 800; }
.stats-best-options label { display: flex; gap: 6px; align-items: center; color: #334155; font-size: 12px; }
.stats-best-options input { width: auto; }
.form-error { margin: 10px 0 0; color: #b91c1c; font-weight: 700; }
.initialize-actions { display: grid; gap: 8px; margin-top: 16px; }
.initialize-actions button { width: 100%; }

.activity-management-grid { align-items: start; }
.activity-list { display: grid; gap: 9px; }
.activity-entry { overflow: hidden; border: 1px solid #dfe6f2; border-radius: 10px; background: #fff; }
.activity-entry summary {
  padding: 13px 15px;
  color: #1e293b;
  cursor: pointer;
  font-weight: 900;
  list-style-position: inside;
}
.activity-entry[open] summary { border-bottom: 1px solid #e7edf5; background: #f8fafc; }
.activity-detail { padding: 12px; }
.activity-info-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.activity-info-list .activity-description { grid-column: 1 / -1; }
.activity-detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.activity-detail-actions button:disabled { cursor: not-allowed; opacity: 0.55; }

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 14px;
}
.profile-editor {
  width: 100%;
  min-height: calc(100vh - 180px);
}
.profile-editor .field { max-width: 760px; }
.profile-avatar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.profile-avatar .avatar {
  width: 54px;
  height: 54px;
  font-size: 20px;
}
.avatar-upload {
  position: relative;
  overflow: hidden;
}
.avatar-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.credential-result {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  text-align: left;
}
.credential-result div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #f8fafc;
}
.credential-result dt { color: #64748b; font-size: 12px; font-weight: 800; }
.credential-result dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.member-detail-modal { width: min(600px, calc(100vw - 40px)); }
.member-edit-modal { width: min(760px, calc(100vw - 40px)); }
.member-detail-head { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.member-detail-head .avatar { width: 64px; height: 64px; }
.member-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.member-edit-grid .field { margin: 0; }
.member-edit-wide { grid-column: 1 / -1; }
.history-entry summary small {
  padding: 4px 7px;
  border-radius: 6px;
  background: #e8eef7;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}
.history-list { display: grid; gap: 10px; }
.history-entry {
  overflow: hidden;
  border: 1px solid #d7dfeb;
  border-radius: 8px;
  background: #fff;
}
.history-entry summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 13px 15px;
  cursor: pointer;
  list-style-position: inside;
}
.history-entry summary > span { display: inline-flex; gap: 8px; align-items: center; }
.history-entry summary time { color: #64748b; font-size: 12px; }
.history-content { display: grid; gap: 12px; padding: 12px; border-top: 1px solid #e2e8f0; }
.history-content h3 { margin: 0 0 8px; font-size: 14px; }
.history-team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.history-team { padding: 9px; border: 1px solid #dfe6f2; border-radius: 7px; background: #f8fafc; }
.history-team-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.history-team-head span { color: #64748b; font-size: 11px; }
.history-members { display: flex; flex-wrap: wrap; gap: 5px; }
.history-members span { padding: 3px 6px; border-radius: 5px; background: #fff; color: #334155; font-size: 11px; }
.history-round-list { display: grid; gap: 9px; }
.history-round { display: grid; gap: 6px; align-items: start; }
.history-round > strong { color: #475569; font-size: 12px; }
.history-round > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px; }
.history-match { display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr); gap: 7px; align-items: center; min-width: 0; padding: 7px 8px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; }
.history-match b { color: #15803d; font-size: 11px; }
.history-side { display: grid; gap: 2px; }
.history-side small { color: #64748b; font-size: 10px; overflow-wrap: anywhere; }
.history-side.right { text-align: right; }
.history-ranking { display: flex; flex-wrap: wrap; gap: 7px; }
.history-ranking span { padding: 6px 8px; border-radius: 6px; background: #eef4ff; color: #334155; }
.member-detail-name { font-size: 20px; font-weight: 800; }
.member-detail-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dota-info-detail { grid-column: 1 / -1; }
.dota-info-detail dd { display: grid; gap: 4px; }
.dota-info-detail small { color: #64748b; font-size: 12px; }
.recruit-prompt {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  text-align: center;
}
.info-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 0;
}
.info-list div {
  min-width: 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.info-list dt {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}
.info-list dd {
  margin: 0;
  min-height: 20px;
  color: #0f172a;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .team-layout { grid-template-columns: 1fr; }
  .member-pools { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 12px; align-items: flex-start; flex-direction: column; }
  .team-page-title .toolbar { justify-content: flex-start; }
  .profile-grid, .time-row { grid-template-columns: 1fr; }
  .match-pair { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: 1fr; }
  .team-grid.balanced-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match-pair::before { display: none; }
  .versus { justify-self: center; }
}

@media (max-width: 1100px) {
  .team-page-title { grid-template-columns: minmax(0, 1fr); }
  .team-page-title .team-management {
    grid-template-columns: minmax(160px, 220px) 68px minmax(160px, .7fr) minmax(350px, 1.5fr);
  }
}

@media (max-width: 760px) {
  .team-page-title .team-management,
  .team-page-title .team-management.is-viewer {
    grid-template-columns: minmax(0, 1fr) 68px;
    grid-template-rows: 82px 38px 38px auto auto;
  }
  .team-management .team-message-preview { grid-column: 1; grid-row: 1; }
  .team-management .team-data-entry { grid-column: 2; grid-row: 1; }
  .team-management .team-order-entry,
  .team-management.is-viewer .team-order-entry { grid-column: 1 / -1; grid-row: 2; }
  .team-page-title .team-management .pick-strip,
  .team-page-title .team-management.is-viewer .pick-strip { grid-column: 1 / -1; grid-row: 3; width: min(100%, 360px); }
  .team-management .team-settings-row,
  .team-management.is-viewer .team-settings-row { grid-column: 1 / -1; grid-row: 4; justify-self: stretch; }
  .team-management .team-actions-row,
  .team-management.is-viewer .team-actions-row { grid-column: 1 / -1; grid-row: 5; justify-self: stretch; }
  .team-settings-row, .team-actions-row { justify-content: flex-start; }
  .team-management.is-viewer .team-data-entry { grid-column: 2; }
}

.password-change-banner {
  background: #fff3cd;
  border-bottom: 1px solid #e6c76a;
  color: #664d03;
  padding: 10px 20px;
  text-align: center;
  font-weight: 600;
}

@media (min-width: 2200px) {
  .match-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .page { padding: 14px; }
  .team-message-preview { width: 100%; }
  .stats-controls { align-items: stretch; }
  .stats-controls label { flex: 1 1 130px; }
  .stats-levels { flex: 1 1 100%; }
  .stats-manage-actions { width: 100%; margin-left: 0; }
  .stats-manage-actions button { flex: 1; }
  .stats-editor-grid { grid-template-columns: 1fr; }
  .stats-best-options { grid-template-columns: 1fr 1fr; }
  .activity-info-list { grid-template-columns: 1fr; }
  .activity-info-list .activity-description { grid-column: auto; }
  .radar-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick-window { grid-template-columns: repeat(5, 36px); }
  .pick-chip { font-size: 9px; }
  .manual-match-list { grid-template-columns: 1fr; }
  .search-member { grid-template-columns: 36px minmax(0, 1fr); }
  .status-badges { grid-column: 2; justify-content: flex-start; }
  .team-grid.balanced-grid { grid-template-columns: 1fr; }
  .member-edit-grid { grid-template-columns: 1fr; }
  .member-edit-wide { grid-column: auto; }
  .history-entry summary, .history-round { grid-template-columns: 1fr; }
  .history-entry summary { align-items: flex-start; flex-direction: column; }
  .history-match { grid-template-columns: 1fr; }
  .history-side.right { text-align: left; }
}
