:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #f9faf7;
  --text: #191d1c;
  --muted: #66706d;
  --line: #d9ded7;
  --green: #2f8069;
  --green-2: #e3f1ec;
  --amber: #bd7f23;
  --amber-2: #fff1d8;
  --red: #b84b4b;
  --shadow: 0 18px 50px rgba(29, 34, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 78px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}

.brand h1,
.panel-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0;
}

.brand p,
.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill,
.status-text {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
  background: var(--surface-2);
}

.status-pill.ready {
  color: var(--green);
  background: var(--green-2);
  border-color: #b7dccf;
}

.status-pill.demo,
.status-pill.warn {
  color: var(--amber);
  background: var(--amber-2);
  border-color: #ebcc96;
}

.switch {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #b7bfba;
  position: relative;
  transition: background 140ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 140ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.switch b {
  font-size: 12px;
  min-width: 28px;
  color: var(--muted);
  font-weight: 700;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.icon-button:hover,
.copy-button:hover,
.career-search button:hover {
  border-color: #aab6af;
  background: #f6f8f5;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layout {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px 22px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 16px;
  flex: 1;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.fireteams-panel {
  padding: 16px;
}

.career-panel {
  padding: 16px;
  align-self: start;
  position: sticky;
  top: 96px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header.stacked {
  align-items: flex-start;
}

.filter-box,
.career-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.filter-box {
  width: min(420px, 48%);
  padding: 0 10px;
}

.filter-box svg {
  color: var(--muted);
  flex: 0 0 auto;
}

.filter-box input,
.career-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  min-height: 38px;
  color: var(--text);
}

.filter-box input {
  padding: 0 0 0 8px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #ebcc96;
  border-radius: 8px;
  color: #7f5619;
  background: var(--amber-2);
  font-size: 13px;
  line-height: 1.5;
}

.notice.error {
  border-color: #e2b5b5;
  color: var(--red);
  background: #fff0f0;
}

.hidden {
  display: none !important;
}

.fireteam-list {
  display: grid;
  gap: 10px;
}

.fireteam-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.fireteam-main {
  min-width: 0;
}

.fireteam-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #dce1dc;
  border: 1px solid var(--line);
}

.fireteam-copy {
  min-width: 0;
}

.fireteam-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fireteam-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 740;
  overflow-wrap: anywhere;
}

.slot {
  flex: 0 0 auto;
  color: var(--green);
  background: var(--green-2);
  border: 1px solid #b7dccf;
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.meta-row,
.tag-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-row {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #3e4643;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  margin: 10px 0 0;
  color: #2f3533;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.join-box {
  min-width: 188px;
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 8px;
}

.username {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: #fff;
  font-weight: 720;
  overflow-wrap: anywhere;
  text-align: right;
}

.username.clickable {
  cursor: pointer;
}

.copy-button,
.career-search button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  font-weight: 720;
}

.copy-button:disabled {
  cursor: not-allowed;
  color: #9aa39f;
  background: #f0f2ef;
}

.career-search {
  gap: 8px;
  padding: 6px;
  margin-bottom: 12px;
}

.career-search input {
  padding: 0 8px;
  min-width: 0;
}

.career-search button {
  flex: 0 0 auto;
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.career-search button:hover {
  background: #303533;
  border-color: #303533;
}

.career-result.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.account-head {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  margin-bottom: 10px;
}

.account-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.account-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.stat-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.stat-tile b {
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.mode-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  min-width: 0;
}

.mode-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.25;
}

.mode-stats {
  display: grid;
  gap: 6px;
}

.mode-stats span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mode-stats b {
  color: var(--text);
  font-size: 12px;
}

.activity-list {
  margin-top: 10px;
  display: grid;
  gap: 7px;
  max-height: 620px;
  overflow: auto;
  padding-right: 2px;
}

.activity-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.activity-row img {
  width: 58px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #dce1dc;
}

.activity-main,
.activity-numbers {
  min-width: 0;
}

.activity-main b {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.activity-main span,
.activity-numbers span,
.activity-empty {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.activity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.activity-tags em {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #ebcc96;
  background: var(--amber-2);
  color: #7f5619;
  font-style: normal;
  font-size: 11px;
  font-weight: 750;
}

.activity-numbers {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.activity-numbers span {
  padding: 5px 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

.activity-numbers b {
  color: var(--text);
}

.activity-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.variant-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
}

.variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.variant-row > span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.variant-row > b {
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.variant-row .activity-tags {
  grid-column: 1 / -1;
  margin-top: 0;
}

.character-list {
  display: grid;
  gap: 8px;
}

.character {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.character img {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: #dce1dc;
}

.character b,
.character span {
  display: block;
}

.character span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.power {
  color: var(--amber);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-height: 40px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  background: rgba(25, 29, 28, 0.94);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

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

  .career-panel {
    position: static;
  }

  .filter-box {
    width: 100%;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .topbar,
  .layout {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .fireteam-card {
    grid-template-columns: 1fr;
  }

  .join-box {
    min-width: 0;
    justify-items: stretch;
  }

  .username {
    justify-content: flex-start;
    text-align: left;
  }

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

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

  .activity-numbers {
    grid-template-columns: 1fr;
  }
}
