:root {
  --paper: #f4efe3;
  --paper-bright: #fffdf7;
  --ink: #173436;
  --muted: #647575;
  --red: #c94b33;
  --teal: #2f776e;
  --gold: #d6942e;
  --line: rgba(23, 52, 54, .16);
  --shadow: 0 18px 50px rgba(25, 57, 55, .16);
  --radius: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--paper); font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(214, 148, 46, .44); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 8px; font: 800 10px/1 ui-monospace, monospace; letter-spacing: .18em; color: var(--red); }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 20px/1 Georgia, serif; box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .22); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, rgba(214, 148, 46, .22), transparent 30%), radial-gradient(circle at 90% 80%, rgba(47, 119, 110, .2), transparent 28%), var(--paper); }
.login-card { width: min(440px, 100%); padding: 42px; background: var(--ink); color: #fff; border-radius: 28px; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 32px; }
.login-card h1 { margin: 0; font: 700 38px/1.05 Georgia, "Noto Serif SC", serif; }
.login-card p:not(.eyebrow) { color: rgba(255, 255, 255, .68); line-height: 1.7; }
.login-card label { display: block; margin: 28px 0 8px; font-size: 13px; }
.login-card input { width: 100%; padding: 14px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 14px; background: rgba(255, 255, 255, .08); color: #fff; outline: none; }
.login-card input:focus { border-color: #efc978; box-shadow: 0 0 0 3px rgba(239, 201, 120, .18); }
.login-card button { width: 100%; margin-top: 14px; padding: 14px; border: 0; border-radius: 14px; background: #efc978; font-weight: 900; }
.form-status { min-height: 20px; margin-top: 12px; color: #ffb0a3; font-size: 13px; }

.workspace { min-height: 100vh; }
.topbar { height: 72px; padding: 10px 20px; display: flex; align-items: center; gap: 20px; justify-content: space-between; background: rgba(255, 253, 247, .96); border-bottom: 1px solid var(--line); box-shadow: 0 8px 30px rgba(23, 52, 54, .06); position: relative; z-index: 1000; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.tabs { display: flex; padding: 5px; border-radius: 999px; background: rgba(23, 52, 54, .08); }
.tab { min-height: 40px; padding: 9px 15px; border: 0; border-radius: 999px; background: transparent; font-weight: 800; transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease); }
.tab:hover { transform: translateY(-1px); }
.tab.active { background: var(--ink); color: #fff; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions a, .ghost { padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-bright); text-decoration: none; font-size: 13px; }

.editor { height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1fr) 410px; overflow: hidden; }
.map-wrap { min-width: 0; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: radial-gradient(circle at 8% 0%, rgba(214, 148, 46, .13), transparent 25%), radial-gradient(circle at 100% 100%, rgba(47, 119, 110, .12), transparent 30%); }
.compare-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 2px 4px; }
.compare-heading h2 { margin: 0; font: 700 25px/1.1 Georgia, "Noto Serif SC", serif; }
.compare-heading p:last-child { max-width: 360px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: right; }
.dual-map-grid { min-height: 0; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.map-card { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-bright); box-shadow: var(--shadow); }
.map-card > header { min-height: 66px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, rgba(255, 255, 255, .92), rgba(244, 239, 227, .82)); }
.map-card > header > div { display: flex; align-items: center; gap: 9px; }
.map-card h3 { margin: 0; font: 700 18px/1.1 Georgia, "Noto Serif SC", serif; }
.map-card header small { color: var(--muted); font: 700 10px/1.4 ui-monospace, monospace; text-align: right; }
.overlay-controls { display: flex; align-items: center; gap: 10px; }
.overlay-switch { min-height: 34px; padding: 7px 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(47, 119, 110, .24); border-radius: 10px; background: rgba(47, 119, 110, .08); font-size: 11px; font-weight: 900; white-space: nowrap; }
.overlay-switch input { accent-color: var(--teal); }
.opacity-control { display: grid; gap: 3px; color: var(--muted); font-size: 9px; font-weight: 800; text-align: right; }
.opacity-control output { color: var(--ink); font-variant-numeric: tabular-nums; }
.opacity-control input { width: 104px; height: 16px; accent-color: var(--red); cursor: ew-resize; }
.map-kicker { display: inline-flex; align-items: center; min-height: 26px; padding: 5px 8px; border-radius: 8px; color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.map-kicker.live { background: var(--teal); }
.map-kicker.image { background: var(--gold); }
.admin-map { width: 100%; height: 100%; min-height: 420px; background: #dce3da; }
#admin-map-image { background: #e7dfcf; }
.map-hint { min-height: 40px; padding: 10px 14px; display: flex; align-items: center; justify-content: center; border-radius: 13px; background: var(--ink); color: rgba(255, 255, 255, .9); font-size: 12px; box-shadow: 0 10px 24px rgba(23, 52, 54, .18); }
.map-hint.syncing { background: var(--red); }

.sidebar { padding: 24px 20px; overflow: auto; position: relative; border-left: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sidebar h2 { margin: 0; font: 700 28px/1 Georgia, "Noto Serif SC", serif; }
.add, .save, .apply { padding: 11px 14px; border: 0; border-radius: 13px; background: var(--red); color: #fff; font-weight: 900; }
.campus-tools { margin: 18px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.campus-tools button { min-height: 40px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-bright); font-size: 12px; }
.campus-tools span { grid-column: 1 / -1; color: var(--muted); font: 700 10px/1.4 ui-monospace, monospace; text-align: center; }
.source-legend { margin: -6px 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-bright); overflow: hidden; }
.source-legend summary { padding: 10px 12px; cursor: pointer; color: var(--teal); font-size: 12px; font-weight: 900; }
.source-legend img { width: 100%; max-height: 320px; display: block; object-fit: contain; border-top: 1px solid var(--line); background: #fff; }
.poi-list { max-height: 240px; padding-right: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow: auto; }
.poi-item { min-height: 66px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-bright); text-align: left; font-size: 12px; transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.poi-item:hover { transform: translateY(-1px); }
.poi-item.active { border-color: var(--red); box-shadow: 0 0 0 2px rgba(201, 75, 51, .13); }
.poi-item i { width: 25px; height: 25px; margin-right: 6px; display: inline-grid; place-items: center; border-radius: 8px; color: #fff; font-style: normal; }
.poi-item small { margin: 5px 0 0 31px; display: block; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.poi-form { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper-bright); }
.form-title { display: flex; align-items: start; justify-content: space-between; }
.form-title h3 { margin: 0; font: 700 22px/1.2 Georgia, "Noto Serif SC", serif; }
.danger { padding: 8px 10px; border: 1px solid rgba(201, 75, 51, .3); border-radius: 10px; background: #fff4f0; color: var(--red); }
.poi-form label { display: block; margin-top: 13px; font-size: 12px; font-weight: 800; }
.poi-form input:not([type=checkbox]), .poi-form textarea, .poi-form select { width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
.poi-form input:focus, .poi-form textarea:focus, .poi-form select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 119, 110, .12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { padding-top: 22px; display: flex !important; align-items: center; gap: 8px; }
.coordinate-box { margin-top: 14px; padding: 12px; border: 1px solid rgba(47, 119, 110, .22); border-radius: 13px; background: rgba(47, 119, 110, .06); }
.coordinate-box > strong, .coordinate-box > small { display: block; }
.coordinate-box > strong { color: var(--teal); font-size: 12px; }
.coordinate-box > small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.apply { width: 100%; margin-top: 14px; background: var(--teal); }
.savebar { position: sticky; bottom: -24px; margin: 20px -20px -24px; padding: 14px 20px; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); background: rgba(244, 239, 227, .96); backdrop-filter: blur(12px); }
.savebar div { color: var(--muted); font-size: 12px; }
.save:disabled { opacity: .42; cursor: not-allowed; }

.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 9px !important; }
.leaflet-marker-draggable {
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab !important;
}
.leaflet-marker-draggable:active { cursor: grabbing !important; }
.leaflet-marker-icon.selected .admin-pin, .admin-marker.selected .admin-pin { box-shadow: 0 0 0 6px rgba(201, 75, 51, .25), 0 6px 14px rgba(0, 0, 0, .28); transform: rotate(-45deg) scale(1.08); }
.admin-marker { border: 0; background: transparent; }
.amap-marker-content .admin-marker { width: 34px; height: 34px; }
.admin-pin { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 12px 12px 12px 3px; background: var(--red); color: #fff; box-shadow: 0 5px 14px rgba(0, 0, 0, .24); transform: rotate(-45deg); transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.admin-pin span { font-size: 12px; font-weight: 900; transform: rotate(45deg); }

@media (max-width: 1180px) {
  .editor { height: auto; min-height: calc(100vh - 72px); grid-template-columns: 1fr; overflow: visible; }
  .map-wrap { min-height: 720px; }
  .dual-map-grid { min-height: 570px; }
  .sidebar { border-top: 1px solid var(--line); border-left: 0; }
  .savebar { bottom: 0; }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 70px; flex-wrap: wrap; }
  .brand small, .top-actions a { display: none; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; }
  .top-actions { margin-left: auto; }
  .map-wrap { min-height: 0; padding: 10px; }
  .compare-heading { align-items: start; }
  .compare-heading p:last-child { display: none; }
  .dual-map-grid { min-height: 0; grid-template-columns: 1fr; }
  .map-card { min-height: 560px; }
  .overlay-controls { gap: 6px; }
  .opacity-control input { width: 82px; }
  .admin-map { min-height: 490px; }
  .sidebar { padding: 18px; }
  .savebar { margin: 20px -18px -18px; padding: 12px 18px; }
  .poi-list { max-height: none; }
}

@media (max-width: 470px) {
  .brand strong { font-size: 13px; }
  .brand-mark { width: 38px; height: 38px; }
  .map-card > header { min-height: 58px; }
  .map-card header small { display: none; }
  .map-card:first-child > header { align-items: flex-start; flex-direction: column; }
  .overlay-controls { width: 100%; justify-content: space-between; }
  .poi-list, .two { grid-template-columns: 1fr; }
  .check { padding-top: 0; }
  .savebar { grid-template-columns: 1fr 1fr; }
  .savebar div { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
