:root {
  --bg: #f3f4f0;
  --panel: #ffffff;
  --panel2: #f5f7f2;
  --panel3: #eef1e9;
  --line: rgba(28, 32, 27, 0.08);
  --line-strong: rgba(28, 32, 27, 0.15);
  --text: #1b1f1a;
  --muted: #7b8178;
  --muted-2: #9aa199;
  --accent: #2f7d4f;
  --accent-dark: #245c3a;
  --accent-deep: #1c4b30;
  --accent-soft: rgba(47, 125, 79, 0.1);
  --danger: #c2413a;
  --warn: #b45309;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-1: 0 1px 2px rgba(28, 32, 27, 0.03), 0 2px 8px rgba(28, 32, 27, 0.04);
  --shadow-2: 0 1px 2px rgba(28, 32, 27, 0.03), 0 18px 44px -20px rgba(28, 32, 27, 0.14);
  --shadow-3: 0 2px 8px rgba(28, 32, 27, 0.04), 0 40px 90px -36px rgba(28, 32, 27, 0.24);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
html,
body {
  overflow-x: clip;
}
body {
  margin: 0;
  background:
    radial-gradient(1200px 620px at 20% -6%, #eaf1e6 0, transparent 60%),
    radial-gradient(1000px 520px at 96% 4%, #f1efe8 0, transparent 55%), var(--bg);
  color: var(--text);
  font-family: 'Outfit', 'Plus Jakarta Sans', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04';
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.6'/></svg>");
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.center-note {
  padding: 70px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.center-note::after {
  content: '';
  display: block;
  width: 34px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), rgba(47, 125, 79, 0));
  margin: 14px auto 0;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(14px);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
  z-index: 99;
  box-shadow: var(--shadow-3);
  max-width: 82vw;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.error {
  border-color: rgba(194, 65, 58, 0.35);
  color: var(--danger);
}
#toast.warn {
  border-color: rgba(180, 83, 9, 0.4);
  color: var(--warn);
}

/* ---------- buttons ---------- */
.primary {
  border: 0;
  background: linear-gradient(145deg, #3b8d5e, #2f7d4f);
  color: #fff;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow:
    0 12px 30px -12px rgba(47, 125, 79, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    filter 0.2s var(--ease);
}
.primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 16px 36px -14px rgba(47, 125, 79, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  filter: saturate(1.05);
}
.primary:active {
  transform: translateY(0) scale(0.98);
}
.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.primary.big {
  padding: 14px 30px;
  font-size: 15px;
}
.primary.sm {
  padding: 6px 13px;
  font-size: 12px;
  border: 1px solid transparent;
}
.secondary {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.secondary:hover {
  border-color: var(--accent);
}
.danger {
  border: 1px solid rgba(194, 65, 58, 0.3);
  background: #fdf3f2;
  color: var(--danger);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.2s var(--ease);
}
.danger:active {
  transform: scale(0.98);
}
.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.ghost:hover {
  border-color: var(--accent);
  background: #fafcf8;
}
.ghost:active {
  transform: scale(0.98);
}
.ghost-sm {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 99px;
}
.primary svg,
.ghost svg {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
}

/* ---------- topbar / nav ---------- */
.topbar {
  height: 58px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(249, 250, 247, 0.82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  justify-self: center;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  background: linear-gradient(150deg, #3f9665, #2f7d4f 55%, #245c3a);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow:
    0 10px 24px -10px rgba(47, 125, 79, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}
.brand strong {
  font-size: 15px;
  display: block;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand span {
  font-size: 11px;
  color: var(--muted);
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.nav-left {
  justify-self: end;
}
.nav-right {
  justify-self: start;
}
.topbar-right {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.nav-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 99px;
  font-family: inherit;
  cursor: pointer;
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.nav-link:hover {
  color: var(--text);
  background: rgba(28, 32, 27, 0.04);
}
.nav-link.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 800;
}
.nav-link.nav-import {
  color: var(--accent-dark);
  border: 1px solid rgba(47, 125, 79, 0.3);
  background: rgba(47, 125, 79, 0.06);
  padding: 6px 14px;
  font-weight: 800;
}
.nav-link.nav-import:hover {
  background: var(--accent-soft);
}
.top-note {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-weight: 600;
}
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}
.user-menu-btn:hover {
  background: rgba(28, 32, 27, 0.05);
}
.user-menu-btn .caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.2s var(--ease);
}
.user-menu:hover .caret,
.user-menu.open .caret {
  transform: rotate(180deg);
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 158px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-3);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease);
  z-index: 30;
}
.user-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}
.user-menu:hover .user-menu-dropdown,
.user-menu.open .user-menu-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.user-menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  width: 100%;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.user-menu-link:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.user-menu-logout {
  color: var(--danger);
}
.user-menu-logout:hover {
  background: rgba(194, 65, 58, 0.08);
  color: var(--danger);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 79, 0.14);
  animation: dotpulse 2.6s ease-in-out infinite;
}
@keyframes dotpulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(47, 125, 79, 0.14);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(47, 125, 79, 0.06);
  }
}
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 28px 26px;
  position: relative;
  z-index: 1;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, #fff, #fcfdfa);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 40px 38px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    var(--shadow-3);
}
.brand-lg {
  margin-bottom: 30px;
}
.login-card h1 {
  font-size: 28px;
  margin: 0 0 8px;
  font-weight: 800;
}
.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 28px;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-card label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  margin-top: 7px;
}
.form-error {
  background: #fdf3f2;
  border: 1px solid rgba(194, 65, 58, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.login-hint {
  margin: 24px 0 0;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

/* ---------- inputs ---------- */
input[type='text'],
input[type='search'],
input[type='password'],
input[type='date'],
input[type='datetime-local'],
input[type='number'],
input:not([type]),
select {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  width: 100%;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 79, 0.13);
}
input[type='datetime-local'] {
  font-variant-numeric: tabular-nums;
}
input[type='datetime-local']::-webkit-datetime-edit {
  padding: 0;
}
input[type='datetime-local']::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}
input[type='datetime-local']::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  border-radius: 7px;
  padding: 3px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
input[type='datetime-local']::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: var(--accent-soft);
}
input[type='color'] {
  padding: 0;
  border: 0;
  background: transparent;
}

/* ---------- page structure ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  animation: rise 0.55s var(--ease) both;
}
.head-actions {
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(47, 125, 79, 0.16);
  border-radius: 99px;
  padding: 4px 10px;
  font-weight: 800;
  margin: 0 0 8px;
}
.page-head h1 {
  font-size: 25px;
  line-height: 1.1;
  font-weight: 800;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 5px 0 0;
}
.back-link {
  color: var(--muted);
  font-size: 13px;
  display: inline-block;
  margin-bottom: 6px;
  transition: color 0.2s var(--ease);
}
.back-link:hover {
  color: var(--text);
}

/* ---------- stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  animation: rise 0.55s var(--ease) 0.06s both;
}
.stat-card {
  background: linear-gradient(180deg, #fff, #fbfcfa);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    var(--shadow-1);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    var(--shadow-2);
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, #fff, #fbfcfa);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px;
  margin-bottom: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    var(--shadow-1);
  animation: rise 0.55s var(--ease) 0.1s both;
}
.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  font-weight: 800;
}
.dash-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.row-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.row-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.row-card:hover {
  border-color: rgba(47, 125, 79, 0.4);
  box-shadow: 0 10px 28px -16px rgba(28, 32, 27, 0.18);
  transform: translateY(-1px);
}
.row-card.no-link {
  cursor: default;
}
.row-main {
  min-width: 0;
}
.row-main strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}
.row-main span {
  font-size: 12px;
  color: var(--muted);
}
.row-meta {
  display: flex;
  gap: 14px;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.more-link {
  color: var(--accent-dark);
  font-size: 13px;
  display: inline-block;
  margin-top: 10px;
  font-weight: 700;
  transition: color 0.2s var(--ease);
}
.more-link:hover {
  color: var(--accent-deep);
}

/* ---------- empty state ---------- */
.empty-cta {
  border: 1px dashed var(--line-strong);
  border-radius: 26px;
  padding: 42px 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3));
  animation: rise 0.55s var(--ease) both;
}
.empty-cta-mark {
  width: 70px;
  height: 70px;
  margin: 0 auto 16px;
  border-radius: 24px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 34px;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 12px 30px -18px rgba(47, 125, 79, 0.5);
}
.empty-cta-mark svg {
  width: 34px;
  height: 34px;
}
.empty-cta h2 {
  font-size: 20px;
  margin: 0 0 8px;
  font-weight: 800;
}
.empty-cta p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 22px;
}
.empty-cta .primary {
  margin-top: 4px;
}

/* ---------- activities toolbar & table ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .search {
  flex: 1;
  min-width: 160px;
}
.toolbar select {
  width: auto;
  min-width: 120px;
}
.toolbar-spacer {
  flex: 1;
}
.view-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  overflow: hidden;
  flex: 0 0 auto;
}
.view-btn {
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.18s var(--ease),
    color 0.18s var(--ease);
}
.view-btn + .view-btn {
  border-left: 1px solid var(--line-strong);
}
.view-btn:hover {
  color: var(--text);
}
.view-btn.active {
  background: var(--accent);
  color: #fff;
}
.act-table {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.act-head,
.act-row {
  display: grid;
  grid-template-columns: 1fr 122px 80px 92px 118px 86px;
  gap: 14px;
  align-items: center;
}
.act-head {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.act-head span:nth-child(n + 2) {
  text-align: right;
}
.act-row {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.act-row:hover {
  border-color: rgba(47, 125, 79, 0.4);
  box-shadow: 0 10px 28px -16px rgba(28, 32, 27, 0.18);
  transform: translateY(-1px);
}
.act-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-date,
.act-sport,
.act-dist,
.act-dur,
.act-ascent {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.act-dur {
  color: var(--text);
  font-weight: 600;
}
.act-dist {
  color: var(--text);
}
.act-sport {
  text-align: right;
}

/* ---------- activity card grid ---------- */
.act-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  animation: rise 0.55s var(--ease) both;
}
.act-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fbfcfa);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-1);
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.22s var(--ease);
}
.act-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 125, 79, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-2);
}
.act-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.act-card-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}
.act-emoji {
  margin-right: 5px;
}
.act-map {
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: #e6ebe4;
  border: 1px solid var(--line);
  position: relative;
  pointer-events: none;
}
.act-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.act-map * {
  pointer-events: none;
}
.act-card-icon svg {
  width: 20px;
  height: 20px;
}
.act-card-info {
  min-width: 0;
  flex: 1;
}
.act-card-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.act-card-meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}
.act-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.act-card-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.act-card-stats b {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.act-card-stats b small {
  font-size: 9px;
  color: var(--muted);
  margin-left: 2px;
}
.act-card-stats span {
  font-size: 10px;
  color: var(--muted);
}

/* ---------- milestones ---------- */
.ms-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  animation: rise 0.55s var(--ease) 0.08s both;
}
.ms-card {
  background: linear-gradient(180deg, #fff, #fbfcfa);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    var(--shadow-1);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}
.ms-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.ms-badge {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: linear-gradient(150deg, #3f9665, #2f7d4f);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  margin-bottom: 9px;
  box-shadow: 0 8px 20px -8px rgba(47, 125, 79, 0.55);
}
.ms-badge svg {
  width: 16px;
  height: 16px;
}
.ms-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 3px;
}
.ms-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.5;
}
.ms-date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.ms-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ms-chip {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.2s var(--ease);
}
.ms-chip:hover {
  border-color: rgba(47, 125, 79, 0.35);
}
.ms-chip .ms-badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 17px;
  line-height: 1;
  margin: 0;
  flex: 0 0 auto;
}
.ms-chip .ms-badge svg {
  width: 15px;
  height: 15px;
}
.ms-chip strong {
  font-size: 13px;
  display: block;
  font-weight: 700;
}
.ms-chip span {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 成就图鉴 ---------- */
.ms-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.55s var(--ease) both;
}
.ms-group {
  padding: 14px;
}
.ms-group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.ms-group-emoji {
  font-size: 20px;
  line-height: 1;
}
.ms-group-label {
  font-size: 14px;
  font-weight: 800;
}
.ms-group-val {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ms-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.ms-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  color: var(--muted);
}
.ms-tile.achieved {
  border-color: rgba(47, 125, 79, 0.35);
  background: linear-gradient(160deg, #eef7ed, #fbfdfa);
  color: var(--text);
}
.ms-tile-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.ms-tile-check {
  position: absolute;
  top: 8px;
  right: 9px;
  color: var(--accent);
  font-weight: 800;
}
.ms-tile-progress {
  height: 5px;
  border-radius: 99px;
  background: rgba(28, 32, 27, 0.08);
  overflow: hidden;
}
.ms-tile-progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}

/* ---------- detail ---------- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}
.map-card {
  padding: 10px;
}
.detail-map {
  position: relative;
  width: 100%;
  height: clamp(300px, calc(100dvh - 300px), 440px);
  border-radius: 14px;
  background: #101713;
}
.detail-chart-wrap {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  margin: 10px 0 0;
}
.detail-chart-wrap h3 {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 700;
}
.detail-chart-wrap canvas {
  width: 100%;
}
.detail-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field-label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  font-weight: 700;
}
.field-label input,
.field-label select {
  margin-top: 5px;
}
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.edit-grid .field-label input[type='text'] {
  margin-top: 5px;
}
.edit-grid .field-inline {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-top: 5px;
}
.edit-grid .field-inline input[type='text'] {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.edit-grid .field-label input[type='datetime-local'],
.edit-grid .field-inline input[type='text'] {
  height: 42px;
}
.edit-grid .field-inline .ghost {
  flex: 0 0 auto;
  white-space: nowrap;
  padding-left: 14px;
  padding-right: 14px;
  align-self: stretch;
}
.stat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 8px;
}
.stat-list div {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat-list span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 600;
}
.stat-list strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.raw-info {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  margin-top: auto;
}
.raw-info summary {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.raw-info summary::before {
  content: '▸ ';
  color: var(--accent);
}
.raw-info[open] summary::before {
  content: '▾ ';
}
.raw-info .raw-body {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.raw-info strong {
  font-size: 12px;
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 700;
}
.raw-info span {
  font-size: 12px;
  color: var(--text);
  display: block;
  margin-top: 3px;
}
.danger-zone {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.danger-zone p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.danger-confirm {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px dashed rgba(194, 65, 58, 0.4);
  border-radius: 14px;
  background: #fffaf8;
}
.danger-confirm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 280px;
  font-size: 12px;
  color: var(--muted);
}
.danger-confirm input {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.danger-confirm-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.badge-archived {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.card.collapsible {
  padding: 0;
}
.card.collapsible summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.card.collapsible summary::after {
  content: '展开';
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
}
.card.collapsible[open] summary::after {
  content: '收起';
}
.card.collapsible .collapsible-body {
  padding: 2px 15px 15px;
}
.ms-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.ms-tag-hist {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}
.ms-tag-dyn {
  background: rgba(47, 125, 79, 0.12);
  color: var(--accent-dark);
}
.ms-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* ---------- studio ---------- */
.studio-top {
  padding: 6px 28px 0;
  max-width: 1240px;
  margin: 0 auto;
}
.studio-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
  gap: 18px;
  align-items: start;
}
.stage-panel,
.control-panel {
  min-width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 12px;
  gap: 12px;
}
.section-head h1 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
}
.video-frame {
  position: relative;
  margin: auto;
  background: #0c1411;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: 0 24px 70px -24px rgba(20, 30, 24, 0.5);
  transition:
    width 0.35s var(--ease),
    aspect-ratio 0.35s var(--ease);
  border-radius: 28px;
}
.video-frame.portrait {
  width: min(68%, 470px);
  aspect-ratio: 9/16;
}
.video-frame.landscape {
  width: min(100%, calc((100vh - 180px) * 1.7778));
  aspect-ratio: 16/9;
  max-width: 100%;
}
.video-frame #map {
  position: absolute;
  inset: 0;
}
.video-frame.has-route .preview-title,
.video-frame.has-route .telemetry-card {
  display: block;
}
.preview-title {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  background: linear-gradient(180deg, rgba(4, 10, 7, 0.78), transparent);
  padding: 16px 18px 34px;
  display: none;
}
.preview-title strong {
  display: block;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}
.preview-title span {
  font-size: 11px;
  color: #cfdcd5;
  margin-top: 3px;
  display: block;
  letter-spacing: 0.04em;
}
.actor {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  font-size: clamp(22px, 2.4vw, 32px);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
}
.actor svg {
  width: 1.15em;
  height: 1.15em;
  display: block;
  stroke-width: 1.7;
}
.actor[hidden] {
  display: none !important;
}
.telemetry-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 24%;
  min-height: 118px;
  padding: 10px 16px 9px;
  border-radius: 0 0 28px 28px;
  background: linear-gradient(180deg, rgba(4, 10, 7, 0.7), rgba(4, 10, 7, 0.88));
  backdrop-filter: blur(5px);
  display: none;
}
.metrics {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}
.metrics strong {
  font-size: clamp(16px, 1.65vw, 25px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.metrics span {
  font-size: 9px;
  color: #9fb2a8;
  margin-top: 2px;
  display: block;
  letter-spacing: 0.08em;
}
.metrics.secondary {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.metrics.secondary strong {
  font-size: clamp(13px, 1.25vw, 18px);
}
.ascent {
  font-size: 10px;
  color: #b9c8c0;
  margin-top: 4px;
}
#chart {
  height: auto;
  min-height: 22px;
  flex: 1;
  margin-top: 2px;
  width: 100%;
}
.metric-hidden {
  display: none !important;
}
.preview-caption {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}
.control-panel {
  background: linear-gradient(180deg, #fff, #fbfcfa);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    var(--shadow-2);
  position: sticky;
  top: 66px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-self: start;
}
#settingsForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
}
.control-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}
.settings-block {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
}
#settingsForm .settings-block:nth-of-type(1) {
  grid-column: 1/-1;
}
.settings-block h2 {
  font-size: 11px;
  margin: 0 0 7px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.settings-block h3.block-sub {
  font-size: 10px;
  margin: 12px 0 6px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.segmented-sm span {
  font-size: 11px;
  padding: 7px 10px;
}
.settings-block label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.settings-block label em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  position: relative;
  bottom: 26px;
  right: 10px;
  float: right;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 7px;
}
.segmented,
.choice-grid {
  display: grid;
  gap: 6px;
}
.segmented {
  grid-template-columns: 1fr 1fr;
}
.segmented input,
.choice-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span,
.choice-grid span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s var(--ease),
    background 0.18s var(--ease),
    transform 0.18s var(--ease);
  user-select: none;
}
.segmented span svg,
.choice-grid span svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}
.segmented input:checked + span,
.choice-grid input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}
.segmented span:hover,
.choice-grid span:hover {
  border-color: rgba(47, 125, 79, 0.4);
}
.swatch {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.swatch.satellite {
  background: linear-gradient(135deg, #3a7a4a, #12251f);
}
.swatch.light {
  background: linear-gradient(135deg, #e8ede9, #b7c4bc);
}
.swatch.dark {
  background: linear-gradient(135deg, #3a3f42, #16191b);
}
.auto-camera {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel2);
}
.auto-camera input {
  accent-color: var(--accent);
}
.auto-camera strong,
.auto-camera small {
  display: block;
}
.auto-camera strong {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
}
.auto-camera small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.tuning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.tuning-grid label {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  font-size: 11px;
  font-weight: 600;
}
.tuning-grid output {
  float: right;
  color: var(--accent-dark);
  font-weight: 800;
}
.tuning-grid input[type='range'] {
  display: block;
  width: 100%;
  margin: 5px 0 0;
  accent-color: var(--accent);
  height: 12px;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  background: var(--panel2);
  font-weight: 600;
}
.color-row input {
  height: 26px;
  width: 46px;
  border-radius: 7px;
  flex: 0 0 auto;
}
#accentText {
  margin-left: auto;
  font-weight: 800;
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.toggle-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.toggle-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--panel2);
  transition: border-color 0.18s var(--ease);
}
.toggle-list label:hover {
  border-color: rgba(47, 125, 79, 0.35);
}
.toggle-list input {
  accent-color: var(--accent);
}
.generate {
  grid-column: 1/-1;
  border: 0;
  background: linear-gradient(145deg, #3b8d5e, #2f7d4f);
  color: #fff;
  font-weight: 900;
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 15px;
  box-shadow:
    0 14px 32px -14px rgba(47, 125, 79, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    opacity 0.2s var(--ease);
}
.generate:active {
  transform: scale(0.98);
}
.generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.generate small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  opacity: 0.85;
}
.field-note {
  display: block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 700;
}
#zoom:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}
.job-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(47, 125, 79, 0.28);
  border-radius: 15px;
  background: var(--accent-soft);
}
.job-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  gap: 10px;
  font-weight: 600;
}
.job-head strong {
  min-width: 0;
}
.job-head span {
  color: var(--accent-dark);
  font-weight: 800;
}
.progress {
  height: 7px;
  background: rgba(28, 32, 27, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin: 9px 0;
}
.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3f9665, #2f7d4f);
  border-radius: 99px;
  width: 0;
  transition: width 0.35s var(--ease);
}
.download {
  display: inline-block;
  margin-top: 4px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -8px rgba(47, 125, 79, 0.6);
}
.job-result {
  margin-top: 4px;
}
.job-result video {
  width: 100%;
  max-height: 340px;
  border-radius: 12px;
  background: #000;
  display: block;
}
.job-result .download {
  margin-top: 0;
}
.job-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.video-modal-mask .modal-card {
  width: min(560px, 100%);
}
.video-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.video-modal-head strong {
  font-size: 16px;
  font-weight: 800;
}
.video-modal video {
  width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  background: #000;
  display: block;
}
.job-panel details {
  margin-top: 6px;
  font-size: 12px;
}
.job-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.job-panel pre {
  max-height: 150px;
  overflow: auto;
  font-size: 11px;
  color: #cfe0d9;
  background: #0d1411;
  border-radius: 10px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}
.job-history {
  margin-top: 12px;
}
.job-history h3 {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 9px;
  font-weight: 700;
}
.job-hist-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
  transition: border-color 0.2s var(--ease);
}
.job-hist-row:hover {
  border-color: rgba(47, 125, 79, 0.35);
}
.job-hist-row strong {
  font-size: 12px;
  display: block;
  font-weight: 700;
}
.job-hist-row span {
  font-size: 11px;
  color: var(--muted);
}
.maplibregl-ctrl-top-right {
  top: 57%;
  right: 3%;
  transform: translateY(-50%);
  z-index: 7;
}
.maplibregl-ctrl-top-right .maplibregl-ctrl {
  margin: 0;
}
.maplibregl-ctrl button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

/* ---------- entrance motion ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- responsive ---------- */
@media (min-width: 1051px) and (max-height: 850px) {
  .app-main {
    padding-top: 12px;
  }
  .page-head {
    margin-bottom: 10px;
  }
  .stat-grid {
    margin-bottom: 12px;
    gap: 10px;
  }
  .card {
    margin-bottom: 10px;
  }
  .dash-cols {
    gap: 10px;
  }
  .cat-panel {
    margin-bottom: 10px;
  }
  .row-list {
    gap: 6px;
  }
}
@media (max-width: 1050px) {
  .app-main {
    padding: 14px 16px 40px;
  }
  .studio-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 16px 34px;
  }
  .stage-panel {
    order: 2;
  }
  .control-panel {
    order: 1;
  }
  .video-frame.portrait {
    width: min(70%, 360px);
  }
  .video-frame.landscape {
    width: 100%;
    aspect-ratio: 16/9;
  }
  .dash-cols,
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .city-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .city-map-card {
    height: auto;
  }
  .cities-map {
    height: 420px;
    flex: none;
  }
  .city-list-card {
    height: auto;
    max-height: 60dvh;
  }
  .cities-list-body {
    overflow-y: visible;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-map {
    height: 300px;
  }
  #settingsForm {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }
  .brand span {
    display: none;
  }
  .nav {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav-link {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .act-head {
    display: none;
  }
  .act-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 10px 12px;
  }
  .act-date {
    grid-column: 1;
    text-align: left;
    font-size: 11px;
    color: var(--muted);
  }
  .act-sport {
    display: none;
  }
  .act-title {
    grid-column: 1;
    grid-row: 1;
  }
  .act-dist,
  .act-dur,
  .act-ascent {
    grid-column: 2;
    text-align: right;
    font-size: 12px;
  }
  .ms-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}
@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .top-note span:nth-of-type(2) {
    display: none;
  }
  .page-head h1 {
    font-size: 22px;
  }
  .row-meta {
    gap: 8px;
  }
  .stat-value {
    font-size: 22px;
  }
  .city-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .toolbar .search {
    min-width: 100%;
  }
  .toolbar select {
    flex: 1;
    min-width: 0;
  }
  .topbar {
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 10px;
  }
  .brand {
    order: 1;
  }
  .topbar-right {
    order: 3;
    display: contents;
  }
  .top-note {
    order: 2;
    margin-left: auto;
  }
  .nav {
    order: 3;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex: 0 1 auto;
    min-width: 0;
  }
  .nav-left {
    justify-self: auto;
  }
  .nav-right {
    justify-self: auto;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav-link {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .control-panel {
    top: 96px;
  }
  .dash-cols > *,
  .detail-layout > *,
  .city-layout > *,
  .poi-layout > *,
  .studio-layout > * {
    min-width: 0;
  }
  .card,
  .row-card,
  .ms-chip {
    min-width: 0;
  }
  .ms-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .act-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .edit-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cat-cell b {
    font-size: 13px;
  }
}

/* ---------- import dialog ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(28, 32, 27, 0.5);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 18px;
  animation: maskin 0.25s var(--ease);
}
@keyframes maskin {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-mask[hidden] {
  display: none;
}
.modal-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, #fff, #fcfdfa);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 30px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    var(--shadow-3);
  animation: rise 0.35s var(--ease) both;
}
.modal-card h2 {
  font-size: 21px;
  margin: 0 0 8px;
  font-weight: 800;
}
.modal-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.modal-card select {
  width: 100%;
  margin: 6px 0 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .primary {
  flex: 1;
}

/* ---------- 城市手动添加弹窗 ---------- */
.manual-card {
  width: min(520px, 100%);
}
.manual-hint {
  background: var(--accent-soft);
  border: 1px dashed rgba(47, 125, 79, 0.4);
  color: var(--accent-dark);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  margin: 0 0 14px;
}
.manual-map {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #e6ebe4;
}
.manual-result {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.manual-divider {
  margin: 14px 0 8px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.manual-divider::before,
.manual-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.manual-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  max-height: 180px;
  overflow-y: auto;
}
.manual-result-btn {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s var(--ease),
    transform 0.15s var(--ease);
}
.manual-result-btn:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

/* ---------- category cards ---------- */
.cat-panel {
  margin-bottom: 16px;
  animation: rise 0.55s var(--ease) 0.08s both;
}
.cat-head {
  display: grid;
  grid-template-columns: 1fr repeat(3, 96px);
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
  padding: 0 4px;
}
.cat-head span {
  font-weight: 800;
  letter-spacing: 0.02em;
}
.cat-head b {
  text-align: right;
  font-weight: 700;
  font-size: 11px;
}
.cat-grid {
  display: grid;
  gap: 7px;
}
.cat-card {
  display: grid;
  grid-template-columns: 1fr repeat(3, 96px);
  gap: 16px;
  align-items: center;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, #f3f8f1, transparent 70%);
  transition:
    transform 0.22s var(--ease),
    border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease);
}
.cat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 125, 79, 0.4);
  box-shadow: 0 16px 38px -22px rgba(28, 32, 27, 0.22);
}
.cat-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 800;
}
.cat-cell {
  display: flex;
  align-items: baseline;
  gap: 5px;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}
.cat-cell b {
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.cat-cell small {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- cities ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 125, 79, 0.3);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}
.chip-clear {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}
.city-stats {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
}
.city-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.city-map-card {
  padding: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  height: clamp(320px, calc(100dvh - 312px), 480px);
}
.cities-map {
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 14px;
  background: #edf0e9;
}
.city-list-card {
  height: clamp(320px, calc(100dvh - 312px), 480px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cities-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.map-mode-bar {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 5;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(6px);
}
.map-mode-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 11px;
  cursor: pointer;
  transition:
    color 0.15s var(--ease),
    background 0.15s var(--ease);
}
.map-mode-btn + .map-mode-btn {
  border-left: 1px solid var(--line);
}
.map-mode-btn:hover {
  color: var(--text);
}
.map-mode-btn.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.lit-group {
  margin-bottom: 15px;
}
.lit-prov {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}
.lit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 7px;
  background: #fff;
  transition:
    border-color 0.18s var(--ease),
    transform 0.18s var(--ease);
}
.lit-row:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.lit-name {
  font-size: 13px;
  font-weight: 600;
}
.lit-name em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.lit-row b {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- points of interest ---------- */
.poi-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  animation: rise 0.55s var(--ease) both;
}
.poi-map-card {
  padding: 10px;
  position: relative;
  min-height: 0;
}
.poi-map {
  width: 100%;
  height: clamp(360px, calc(100dvh - 250px), 560px);
  border-radius: 14px;
  background: #edf0e9;
}
.poi-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 5;
  background: rgba(27, 31, 26, 0.82);
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.poi-hint .ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
}
.poi-info {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 5;
  width: min(320px, calc(100% - 28px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-3);
}
.poi-info-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.poi-info-head strong {
  font-size: 15px;
  display: block;
}
.poi-info-head span {
  font-size: 11px;
  color: var(--muted);
}
.poi-info p {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0;
  line-height: 1.55;
  word-break: break-word;
}
.poi-info-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.poi-marker {
  width: 30px;
  height: 30px;
  color: var(--poi, #16a34a);
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(28, 32, 27, 0.3));
  transition: transform 0.15s var(--ease);
}
.poi-marker:hover {
  transform: scale(1.12);
}
.poi-marker.visited {
  opacity: 0.55;
}
.poi-marker.draft {
  opacity: 0.9;
}
.poi-marker svg {
  width: 100%;
  height: 100%;
  display: block;
}
.poi-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
  min-height: 0;
}
.poi-panel-head {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 10px;
}
.poi-lists-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.poi-lists-row select {
  flex: 1;
  min-width: 0;
}
.poi-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.poi-filters .search {
  flex: 1;
  min-width: 0;
}
.poi-filters select {
  width: auto;
  min-width: 0;
}
.poi-bounds {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
}
.poi-bounds input {
  width: auto;
  accent-color: var(--accent);
}
.poi-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.poi-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.poi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 9px 12px;
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color 0.15s var(--ease),
    transform 0.15s var(--ease);
}
.poi-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.poi-item-main {
  flex: 1;
  min-width: 0;
}
.poi-item-main strong {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.poi-item-main span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.poi-visited-tag {
  font-style: normal;
  font-size: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 1px 7px;
  font-weight: 800;
}
.poi-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--poi, #16a34a);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(28, 32, 27, 0.06);
}
.poi-item-act {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}
.danger-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 99px;
}
.poi-form {
  width: min(460px, 100%);
}
.poi-place-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 190px;
  overflow-y: auto;
}
.poi-place-note {
  margin: 0;
  padding: 6px 2px;
}
.poi-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 14px;
  cursor: pointer;
}
.poi-check input {
  width: auto;
  accent-color: var(--accent);
}
.poi-lists-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.poi-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.poi-list-row .poi-list-name {
  flex: 1;
  min-width: 0;
}
.poi-new-list {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.poi-new-list input {
  flex: 1;
  min-width: 0;
}

@media (max-width: 1050px) {
  .poi-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .poi-map {
    height: 44dvh;
  }
  .poi-list {
    max-height: 48dvh;
  }
}
@media (max-width: 640px) {
  .poi-hint {
    white-space: normal;
    text-align: center;
    max-width: calc(100% - 20px);
  }
  .poi-filters {
    flex-wrap: wrap;
  }
  .poi-bounds {
    width: 100%;
  }
  .poi-panel,
  .poi-map-card {
    min-width: 0;
  }
  .poi-lists-row,
  .poi-new-list {
    flex-wrap: wrap;
  }
}

/* ---------- 手机端纵向排版 ---------- */
@media (max-width: 640px) {
  .cat-head {
    display: none;
  }
  .cat-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      'name name name'
      'c1 c2 c3';
    gap: 8px 10px;
    padding: 12px;
  }
  .cat-card .cat-label {
    grid-area: name;
  }
  .cat-card > .cat-cell:nth-child(2) {
    grid-area: c1;
  }
  .cat-card > .cat-cell:nth-child(3) {
    grid-area: c2;
  }
  .cat-card > .cat-cell:nth-child(4) {
    grid-area: c3;
  }
  .cat-cell {
    justify-content: flex-start;
  }
  .cat-cell b {
    font-size: 13px;
  }
  .cat-cell small {
    font-size: 10px;
  }
  .head-actions .primary.big {
    padding: 12px 18px;
  }
}
