:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --line: #d8dee6;
  --text: #20262d;
  --muted: #627083;
  --brand: #246b57;
  --brand-soft: #e4f1ec;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

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

button,
.import-btn {
  min-height: 36px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 7px 11px;
  cursor: pointer;
}

.secondary-btn {
  background: #fff;
  color: var(--danger);
  border-color: #d9a19d;
}

.tracker-shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 16px;
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.tracker-header h1 {
  margin: 0;
  font-size: 24px;
}

.save-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-links,
.profile-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.section-links { margin-top: 10px; }

.section-label,
.profile-select-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-links a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 11px;
  font-size: 13px;
}

.section-links a.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.profile-tools {
  justify-content: flex-end;
  max-width: 680px;
}

.profile-tools select {
  min-width: 180px;
  min-height: 36px;
}

.import-btn {
  display: inline-flex;
  align-items: center;
}

.tracker-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.tracker-nav,
.tracker-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.tracker-nav {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.nav-title {
  padding: 14px 14px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 12px;
}

.section-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--text);
  text-align: left;
}

.section-btn.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: #12382e;
  font-weight: 700;
}

.tracker-panel {
  min-height: calc(100vh - 92px);
  padding: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.summary-pill {
  border-radius: 999px;
  background: #e8edf2;
  color: #334155;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.section-content { padding-top: 16px; }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.full { grid-column: 1 / -1; }

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 9px;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

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

.list-header h3 {
  margin: 0;
  font-size: 16px;
}

.entry-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfcfd;
}

.entry-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-title strong {
  font-size: 14px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

@media (max-width: 980px) {
  .tracker-header,
  .panel-heading {
    flex-direction: column;
  }

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

  .tracker-nav {
    position: static;
    max-height: none;
  }

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

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

@media (max-width: 620px) {
  .tracker-shell { padding: 10px; }
  .form-grid,
  .section-list {
    grid-template-columns: 1fr;
  }

  .profile-summary {
    justify-content: flex-start;
  }

  .summary-pill {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
    white-space: normal;
  }
}

.basic-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 12px;
  align-items: start;
}

.basic-overview-column {
  min-width: 0;
}

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

.status-overview-grid.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ability-grid,
.attack-grid,
.speed-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.save-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-card {
  min-height: 104px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  gap: 8px;
}

.overview-card:hover,
.overview-card.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.overview-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.overview-value {
  color: #102a24;
  font-size: 30px;
  line-height: 1;
}

.overview-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.detail-sidebar {
  position: sticky;
  top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.detail-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.detail-heading span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.detail-heading h3 {
  margin: 4px 0 6px;
  font-size: 20px;
}

.detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.detail-breakdown {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  font-size: 16px;
}

.detail-fields.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .basic-workspace {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .status-overview-grid,
  .status-overview-grid.compact-grid,
  .ability-grid,
  .attack-grid,
  .speed-grid,
  .save-grid,
  .detail-fields.form-grid {
    grid-template-columns: 1fr;
  }

  .overview-card {
    min-height: 86px;
  }

  .overview-value {
    font-size: 26px;
  }
}
/* Collapsible detail drawer overrides. */
.basic-workspace {
  display: block;
}

.basic-workspace.has-detail {
  display: block;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.18);
}

.detail-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(520px, 96vw);
  height: 100vh;
  max-height: none;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: #fff;
  box-shadow: -18px 0 38px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 160ms ease-out;
  overflow: hidden;
}

.detail-sidebar.is-open {
  transform: translateX(0);
}

.detail-drawer {
  height: 100%;
  overflow: auto;
  padding: 16px;
}

.detail-heading {
  position: relative;
  padding-right: 44px;
}

.detail-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 36px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 760px) {
  .detail-sidebar {
    top: auto;
    bottom: 0;
    width: 100vw;
    height: min(78vh, 680px);
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -14px 32px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
  }

  .detail-sidebar.is-open {
    transform: translateY(0);
  }
}
.modifier-section {
  margin-top: 16px;
}

.modifier-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.modifier-table {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.modifier-header,
.modifier-row {
  display: grid;
  grid-template-columns: 92px 120px minmax(0, 1fr) 68px;
  gap: 8px;
  align-items: center;
}

.modifier-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modifier-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.modifier-value,
.modifier-type,
.modifier-source {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 9px;
}

.modifier-remove-btn {
  min-height: 34px;
  padding: 6px 8px;
}

@media (max-width: 520px) {
  .modifier-header {
    display: none;
  }

  .modifier-row {
    grid-template-columns: 1fr;
  }
}
.attack-profile-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfcfd;
}

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

.attack-lines-table {
  display: grid;
  gap: 8px;
  margin: 14px 0 10px;
}

.attack-lines-header,
.attack-line-row {
  display: grid;
  grid-template-columns: 1fr 90px 110px 110px 110px 110px 68px;
  gap: 8px;
  align-items: center;
}

.attack-lines-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.attack-line-row .field {
  gap: 0;
}

.attack-line-row .field label {
  display: none;
}

@media (max-width: 980px) {
  .attack-lines-header {
    display: none;
  }

  .attack-line-row {
    grid-template-columns: 1fr;
  }

  .attack-line-row .field label {
    display: block;
  }
}
.entry-modifier-drawer {
  width: min(720px, 96vw);
}

.entry-modifier-table,
.automatic-modifier-table {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.entry-modifier-header,
.entry-modifier-row {
  display: grid;
  grid-template-columns: 82px minmax(120px, 1fr) minmax(120px, 1fr) minmax(130px, 1fr) minmax(110px, 1fr) 72px 68px;
  gap: 8px;
  align-items: center;
}

.entry-modifier-header,
.automatic-modifier-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.entry-modifier-row,
.automatic-modifier-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.entry-modifier-row input,
.entry-modifier-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 9px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-check input {
  width: auto;
}

.automatic-modifier-header,
.automatic-modifier-row {
  display: grid;
  grid-template-columns: 72px 110px minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
}

.automatic-modifier-row strong {
  color: #102a24;
}

.entry-modifier-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .entry-modifier-header,
  .automatic-modifier-header {
    display: none;
  }

  .entry-modifier-row,
  .automatic-modifier-row {
    grid-template-columns: 1fr;
  }
}
.entry-summary-card {
  display: grid;
  gap: 10px;
}

.entry-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.entry-summary-meta span,
.summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: #12382e;
  padding: 4px 9px;
  line-height: 1.2;
}

.entry-summary-effect {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.entry-summary-modifiers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summary-chip.muted-chip {
  background: #eef2f5;
  color: var(--muted);
}

.entry-editor-drawer {
  width: min(760px, 96vw);
}

.entry-editor-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.entry-editor-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
}
