:root {
  --ak-primary: #4AABEA;
  --ak-primary-dark: #2f7fbb;
  --ak-low: #9C9C9C;
  --ak-basic: #D8DD5A;
  --ak-secondary: #CFC2D1;
  --ak-advanced: #F1C644;

  --bg-0: #070b16;
  --bg-1: #0d1530;
  --bg-2: #122042;
  --bg-3: #18294f;
  --line: rgba(74, 171, 234, 0.35);
  --line-soft: rgba(74, 171, 234, 0.18);
  --text: #e9f1fb;
  --text-dim: #9fb2cf;
  --text-mute: #6e82a3;

  --radius: 4px;
  --bevel: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Noto Sans SC', 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(74,171,234,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(74,171,234,0.08), transparent 60%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 60%, var(--bg-2));
  overflow: hidden;
}

.serif, .brand-title, .detail-title, .modal-title, h1, h2, h3 {
  font-family: 'Noto Serif SC', 'Songti SC', serif;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: linear-gradient(180deg, rgba(18,32,66,0.95), rgba(13,21,48,0.85));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 30;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo {
  color: var(--ak-primary);
  font-size: 20px;
  text-shadow: 0 0 12px rgba(74,171,234,0.7);
  transform: translateY(2px);
}
.brand-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fff, var(--ak-primary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11px; color: var(--text-mute); letter-spacing: 1px; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.search-box input {
  width: 240px; height: 38px;
  padding: 0 14px;
  background: rgba(7,11,22,0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--ak-primary); }

/* ---------------- 按钮（斜切角 AK 风） ---------------- */
.ak-btn {
  font-family: inherit;
  height: 38px; padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(74,171,234,0.10);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  clip-path: var(--bevel);
  transition: all .18s;
  letter-spacing: 1px;
}
.ak-btn:hover { background: rgba(74,171,234,0.22); border-color: var(--ak-primary); }
.ak-btn--primary {
  background: linear-gradient(180deg, var(--ak-primary), var(--ak-primary-dark));
  border-color: var(--ak-primary);
  color: #04111f; font-weight: 700;
  box-shadow: 0 0 18px rgba(74,171,234,0.35);
}
.ak-btn--primary:hover { filter: brightness(1.08); }
.ak-btn--ghost { background: rgba(7,11,22,0.7); }
.ak-btn--sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ---------------- 布局 ---------------- */
.layout {
  position: absolute;
  top: 64px; left: 0; right: 0; bottom: 0;
  display: flex;
}
.sidebar {
  width: 360px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(13,21,48,0.92), rgba(7,11,22,0.92));
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  z-index: 20;
}
.map-wrap { position: relative; flex: 1; }
#map { position: absolute; inset: 0; }

/* ---------------- 侧栏筛选 ---------------- */
.sidebar-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.filters-status { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1; height: 32px;
  background: transparent; border: 1px solid var(--line-soft);
  color: var(--text-dim); font-size: 12px; cursor: pointer;
  clip-path: polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px);
  transition: all .15s;
}
.tab:hover { color: var(--text); border-color: var(--line); }
.tab.active {
  background: rgba(74,171,234,0.18);
  border-color: var(--ak-primary);
  color: #fff;
}
.filters-city { display: flex; align-items: center; gap: 10px; }
#city-select {
  flex: 1; height: 34px; padding: 0 10px;
  background: rgba(7,11,22,0.6); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  font-size: 13px; outline: none;
}
.count { font-size: 12px; color: var(--text-mute); white-space: nowrap; }

/* ---------------- 列表 ---------------- */
.event-list { list-style: none; overflow-y: auto; flex: 1; padding: 10px; }
.event-list::-webkit-scrollbar { width: 8px; }
.event-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.event-card {
  background: linear-gradient(180deg, rgba(24,41,79,0.7), rgba(13,21,48,0.7));
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ak-primary);
  padding: 12px 14px; margin-bottom: 10px;
  cursor: pointer; border-radius: var(--radius);
  transition: all .15s;
}
.event-card:hover { border-color: var(--ak-primary); transform: translateX(2px); background: rgba(24,41,79,0.95); }
.event-card.is-active { border-color: var(--ak-primary); box-shadow: 0 0 0 1px var(--ak-primary) inset; }
.event-card .ec-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.event-card .ec-title { font-size: 15px; font-weight: 700; color: #fff; }
.event-card .ec-meta { font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
.event-card .ec-city { color: var(--ak-primary); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap;
}
.badge--upcoming { color: var(--ak-primary); }
.badge--ongoing { color: var(--ak-advanced); }
.badge--past { color: var(--ak-low); }
.list-empty { padding: 30px 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ---------------- 地图标记 ---------------- */
.ak-marker {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.ak-marker .pin {
  width: 16px; height: 16px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #04111f;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.ak-marker .pulse {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid currentColor; opacity: .5;
  animation: pulse 1.8s infinite ease-out;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: .6; } 100% { transform: scale(1.6); opacity: 0; } }
.ak-marker.is-upcoming { color: var(--ak-primary); }
.ak-marker.is-upcoming .pin { background: var(--ak-primary); }
.ak-marker.is-ongoing { color: var(--ak-advanced); }
.ak-marker.is-ongoing .pin { background: var(--ak-advanced); }
.ak-marker.is-past { color: var(--ak-low); }
.ak-marker.is-past .pin { background: var(--ak-low); }

/* 高德信息窗里的详情 */
.amap-info-content { background: transparent !important; padding: 0 !important; }
.amap-info-close { display: none !important; }

/* ---------------- 图例 ---------------- */
.map-legend {
  position: absolute; left: 14px; bottom: 16px;
  display: flex; gap: 14px;
  background: rgba(7,11,22,0.78); border: 1px solid var(--line-soft);
  padding: 8px 12px; border-radius: var(--radius); font-size: 12px;
  backdrop-filter: blur(4px); z-index: 10;
}
.map-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot--upcoming { background: var(--ak-primary); }
.dot--ongoing { background: var(--ak-advanced); }
.dot--past { background: var(--ak-low); }
.map-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(74,171,234,0.92); color: #04111f; font-weight: 700;
  padding: 8px 18px; border-radius: 999px; font-size: 13px; z-index: 15;
  box-shadow: 0 4px 18px rgba(74,171,234,0.4);
}

/* 坐标解析加载层 */
.map-loading {
  position: absolute; inset: 0; z-index: 16;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  background: rgba(7,11,22,0.55); backdrop-filter: blur(2px);
}
.map-loading.hidden { display: none; }
.ml-spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(74,171,234,0.25);
  border-top-color: var(--ak-primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ml-text {
  font-family: "Noto Sans SC", system-ui, sans-serif;
  color: var(--text); font-size: 14px; letter-spacing: .5px;
  background: rgba(13,21,48,0.82); border: 1px solid var(--line-soft);
  padding: 8px 18px; border-radius: 999px;
}

/* ---------------- 详情面板 ---------------- */
.detail-panel {
  position: absolute; top: 76px; right: 16px; bottom: 16px; width: 380px;
  background: linear-gradient(180deg, rgba(18,32,66,0.97), rgba(7,11,22,0.97));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 25; overflow-y: auto;
  transform: translateX(0); transition: transform .25s;
}
.detail-panel.hidden { transform: translateX(120%); }
.detail-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; z-index: 2;
}
.detail-poster { width: 100%; height: 180px; object-fit: cover; background: var(--bg-2); }
.detail-body { padding: 16px 18px 22px; }
.detail-title { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 4px; padding-right: 24px; }
.detail-sub { font-size: 12px; color: var(--text-mute); margin-bottom: 14px; letter-spacing: 1px; }
.detail-rows { font-size: 13px; line-height: 2; }
.detail-rows .row { display: flex; gap: 8px; border-bottom: 1px dashed var(--line-soft); padding: 6px 0; }
.detail-rows .k { color: var(--text-mute); width: 64px; flex-shrink: 0; }
.detail-rows .v { color: var(--text); flex: 1; word-break: break-word; }
.detail-desc { margin-top: 14px; font-size: 13px; line-height: 1.8; color: var(--text-dim); white-space: pre-wrap; }
.detail-actions { margin-top: 16px; display: flex; gap: 10px; }
.detail-link { color: var(--ak-primary); text-decoration: none; font-size: 13px; }
.detail-link:hover { text-decoration: underline; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,18,0.7);
  backdrop-filter: blur(3px); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 460px; max-width: 94vw; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  clip-path: polygon(18px 0,100% 0,100% calc(100% - 18px),calc(100% - 18px) 100%,0 100%,0 18px);
  padding: 22px 24px 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-title { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: var(--text-mute); margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; font-size: 13px;
  background: rgba(7,11,22,0.7); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  outline: none; font-family: inherit;
}
.field input:focus, .field textarea:focus { border-color: var(--ak-primary); }
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.modal-actions { display: flex; gap: 12px; margin-top: 8px; }
.modal-actions .ak-btn { flex: 1; }
.modal-switch { text-align: center; margin-top: 14px; font-size: 12px; color: var(--text-mute); }
.modal-switch a { color: var(--ak-primary); cursor: pointer; }
.modal-error { color: #ff8a8a; font-size: 12px; margin-top: 10px; min-height: 16px; }
.coord-pick { font-size: 12px; color: var(--ak-primary); margin-top: 6px; }

/* ---------------- 账户区 ---------------- */
.auth-area { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ak-primary), var(--ak-primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #04111f; font-weight: 700; font-size: 13px;
}
.user-chip .role-admin { font-size: 10px; color: var(--ak-advanced); border: 1px solid var(--ak-advanced); border-radius: 4px; padding: 0 4px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(18,32,66,0.96); border: 1px solid var(--ak-primary);
  color: #fff; padding: 12px 22px; border-radius: var(--radius);
  font-size: 13px; z-index: 80; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.toast.hidden { display: none; }

.mobile-only { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; width: 84vw; max-width: 360px;
    transform: translateX(-100%); transition: transform .25s; z-index: 22;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-block; position: absolute; top: 14px; left: 14px; z-index: 12; }
  .brand-sub { display: none; }
  .search-box input { width: 140px; }
  .detail-panel { width: auto; left: 12px; right: 12px; }
}
