:root {
  --bg-0: #08111b;
  --bg-1: #102033;
  --bg-2: #1f3a56;
  --line: rgba(255, 255, 255, 0.14);
  --card: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: #a3b9d1;
  --accent: #ffcc6a;
  --accent-2: #8ff0b0;
  --male-border: #65b5ff;
  --male-bg: linear-gradient(160deg, rgba(30, 74, 130, 0.62), rgba(16, 38, 76, 0.55));
  --female-border: #ff8fb2;
  --female-bg: linear-gradient(160deg, rgba(122, 37, 77, 0.6), rgba(63, 24, 49, 0.52));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Microsoft YaHei", "Segoe UI", "LXGW WenKai", sans-serif;
  color: var(--text);
  background: linear-gradient(140deg, var(--bg-0), var(--bg-1), var(--bg-2));
}

.page-shell {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
  display: grid;
  gap: 14px;
}

.card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  padding: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  color: #c2d8ee;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero h1 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}

.subline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.home-link {
  text-decoration: none;
  color: #dce9f9;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 15, 28, 0.5);
  color: #d8e8f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.icon-button:hover {
  border-color: rgba(255, 219, 144, 0.72);
  background: rgba(255, 204, 106, 0.13);
  color: #ffe3a8;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.planner-section {
  display: grid;
  gap: 12px;
}

.planner-head {
  margin-bottom: 0;
}

.planner-controls {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.planner-mode-field,
.planner-search-field {
  display: grid;
  gap: 6px;
}

.planner-search-field {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.planner-mode-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(155, 218, 255, 0.2);
  background: rgba(8, 18, 30, 0.76);
}

.planner-mode {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #cfe0f2;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.planner-mode.active {
  border-color: rgba(255, 214, 126, 0.72);
  background: rgba(255, 214, 126, 0.18);
  color: #fff3c6;
}

.planner-done-button {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 126, 0.45);
  background: rgba(255, 214, 126, 0.14);
  color: #fff3c6;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.planner-done-button:hover {
  border-color: rgba(255, 214, 126, 0.72);
  background: rgba(255, 214, 126, 0.2);
}

.planner-search-field input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(155, 218, 255, 0.22);
  background: rgba(8, 18, 30, 0.76);
  color: #f5fbff;
  padding: 10px 12px;
  font: inherit;
  font-weight: 800;
}

.planner-search-field input:focus {
  outline: none;
  border-color: rgba(255, 206, 118, 0.76);
  box-shadow: 0 0 0 3px rgba(255, 206, 118, 0.16);
}

.owned-planner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.owned-planner-grid[hidden] {
  display: none;
}

.owned-card {
  border-radius: 12px;
  border: 1px solid rgba(155, 218, 255, 0.16);
  background: rgba(8, 20, 35, 0.48);
  padding: 8px;
}

.owned-card.is-selected {
  border-color: rgba(255, 214, 126, 0.52);
  box-shadow: 0 0 0 2px rgba(255, 214, 126, 0.08);
}

.owned-card.is-disabled {
  opacity: 0.58;
}

.owned-card-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.owned-card-main:disabled {
  cursor: not-allowed;
}

.owned-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

.owned-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.owned-copy strong,
.owned-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owned-copy strong {
  color: #f8fbff;
  font-size: 13px;
}

.owned-copy small {
  color: var(--muted);
  font-size: 11px;
}

.owned-mode-badge {
  justify-self: end;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.owned-mode-badge.is-male {
  border-color: rgba(118, 187, 255, 0.5);
  background: rgba(72, 149, 226, 0.18);
  color: #cde8ff;
}

.owned-mode-badge.is-female {
  border-color: rgba(255, 177, 213, 0.52);
  background: rgba(235, 127, 174, 0.16);
  color: #ffe0ef;
}

.planner-flow {
  display: grid;
  gap: 12px;
}

.planner-flow-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.planner-flow-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.planner-flow-head h3 {
  margin: 0;
  color: #f3f9ff;
  font-size: 14px;
}

.planner-stack {
  display: grid;
  gap: 8px;
}

.compact-pet-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.planner-view {
  display: grid;
  gap: 10px;
}

.planner-route-level {
  border-radius: 12px;
  border: 1px solid rgba(155, 218, 255, 0.14);
  background: rgba(6, 16, 28, 0.32);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.planner-block {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 20, 35, 0.46);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.planner-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.planner-block-head strong {
  color: #fff5d6;
}

.planner-block-head span,
.planner-note {
  color: var(--muted);
  font-size: 12px;
}

.planner-note {
  margin: 0;
}

.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
}

.pet-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  align-items: center;
  justify-items: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 20, 35, 0.52);
  padding: 10px 8px;
  min-height: 118px;
}

.pet-avatar {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(7, 18, 31, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pet-name {
  display: block;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
  color: #d8e8f8;
  word-break: break-all;
}

.season-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 128, 0.34);
  background: rgba(255, 204, 106, 0.12);
  color: #ffe1a3;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-empty {
  margin: 0;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 14px;
  color: #9eb5cf;
  background: rgba(6, 16, 28, 0.38);
}

.footnote {
  text-align: center;
  color: #92a9c1;
  font-size: 12px;
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    gap: 10px;
  }

  .page-shell {
    width: min(1100px, calc(100% - 20px));
    padding: 10px 0 18px;
    gap: 10px;
  }

  .card {
    border-radius: 14px;
    padding: 10px;
  }

  .hero h1 {
    margin: 6px 0 4px;
    font-size: clamp(24px, 7vw, 34px);
  }

  .subline {
    font-size: 12px;
    line-height: 1.5;
  }

  .pet-grid {
    grid-template-columns: repeat(auto-fit, minmax(102px, 1fr));
    gap: 8px;
  }

  .pet-card {
    min-height: 116px;
    padding: 8px 6px;
    border-radius: 12px;
  }

  .pet-avatar {
    width: 56px;
    height: 56px;
  }

  .pet-name {
    font-size: 12px;
  }

  .planner-controls {
    grid-template-columns: auto minmax(180px, 1fr) auto;
    gap: 8px;
  }

  .planner-search-field input {
    border-radius: 10px;
    padding: 8px 10px;
  }

  .owned-planner-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    max-height: 360px;
  }

  .planner-block {
    padding: 8px;
  }

}

@media (max-width: 560px) {
  .planner-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .planner-mode-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .planner-search-field .icon-button {
    width: 32px;
  }

  .planner-done-button {
    width: 100%;
  }

  .owned-planner-grid {
    grid-template-columns: minmax(0, 1fr);
    max-height: 340px;
  }

  .planner-block-head {
    display: grid;
    gap: 4px;
  }

  .section-actions {
    align-items: center;
  }
}
