:root {
  color-scheme: dark;
  --bg: #0c1015;
  --panel: #151b22;
  --panel-strong: #1c242d;
  --text: #f4f6f8;
  --muted: #98a4b3;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #f2b84b;
  --accent-strong: #ffcf65;
  --smoke: #aeb7c2;
  --flash: #f6d94f;
  --molotov: #f05f3b;
  --he: #62c076;
  --combo: #5cb0ff;
  --danger: #ff5f6d;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(242, 184, 75, 0.18), transparent 28%),
    linear-gradient(180deg, #101820 0%, var(--bg) 58%);
  color: var(--text);
}

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

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow,
.sheet-kicker {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.45rem, 7vw, 2.15rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 34, 0.84);
  color: var(--muted);
  font-size: 0.86rem;
}

.status-panel > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 16px currentColor;
}

.status-dot.online {
  background: var(--he);
}

.filter-bar,
.subtype-filter-bar {
  display: grid;
  gap: 8px;
}

.filter-bar {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
}

.subtype-filter-bar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: -2px 0 12px;
}

.subtype-toggle-row {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 12px;
}

.filter-chip,
.subtype-chip,
.subtype-toggle-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 800;
}

.subtype-chip {
  min-height: 36px;
  font-size: 0.82rem;
}

.subtype-add-chip {
  font-size: 1.1rem;
  line-height: 1;
}

.subtype-delete-chip {
  font-size: 1.15rem;
  line-height: 1;
}

.subtype-toggle-button {
  min-width: 84px;
  min-height: 36px;
  padding: 0 12px;
}

.filter-chip.active,
.subtype-chip.active,
.subtype-toggle-button.active {
  border-color: rgba(242, 184, 75, 0.58);
  background: rgba(242, 184, 75, 0.16);
  color: var(--accent-strong);
}

.map-panel {
  position: relative;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(135deg, #f0a83b, #ffd56d);
  color: #21160a;
}

.secondary-button {
  border: 1px solid rgba(242, 184, 75, 0.32);
  background: rgba(242, 184, 75, 0.12);
  color: var(--accent-strong);
}

.danger-button {
  width: 100%;
  background: rgba(255, 95, 109, 0.14);
  color: #ff9aa4;
  border: 1px solid rgba(255, 95, 109, 0.3);
}

.wide {
  width: 100%;
}

.custom-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.add-hint {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(242, 184, 75, 0.35);
  border-radius: 8px;
  background: rgba(242, 184, 75, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
}

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #101319;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  touch-action: none;
}

.map-frame::before {
  content: "双指缩放 · 单指拖动";
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(12, 16, 21, 0.68);
  color: rgba(244, 246, 248, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
}

.map-canvas {
  position: relative;
  width: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.map-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.04;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
}

.marker,
.draft-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.marker {
  display: grid;
  place-items: center;
  background: transparent;
  pointer-events: none;
}

.marker::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--marker-color);
  box-shadow:
    0 0 0 1px rgba(12, 16, 21, 0.9),
    0 4px 10px rgba(0, 0, 0, 0.45);
}

.marker.custom {
  outline: 0;
}

.marker.custom::after {
  box-shadow:
    0 0 0 1px rgba(12, 16, 21, 0.9),
    0 0 0 3px rgba(255, 255, 255, 0.38),
    0 4px 10px rgba(0, 0, 0, 0.45);
}

.marker.multi::before {
  content: attr(data-count);
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 1;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #21160a;
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(12, 16, 21, 0.9);
}

.marker.smoke {
  --marker-color: var(--smoke);
}

.type-badge.smoke {
  background: var(--smoke);
}

.marker.flash {
  --marker-color: var(--flash);
}

.type-badge.flash {
  background: var(--flash);
}

.marker.molotov {
  --marker-color: var(--molotov);
}

.type-badge.molotov {
  background: var(--molotov);
}

.marker.he {
  --marker-color: var(--he);
}

.type-badge.he {
  background: var(--he);
}

.marker.combo {
  --marker-color: var(--combo);
}

.type-badge.combo {
  background: var(--combo);
}

.draft-marker {
  display: grid;
  place-items: center;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.draft-marker:active {
  cursor: grabbing;
}

.draft-marker::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow:
    0 0 0 1px rgba(12, 16, 21, 0.9),
    0 0 0 4px rgba(242, 184, 75, 0.22);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.sheet.open {
  display: block;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
}

.sheet-card {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 760px);
  max-height: min(86vh, 720px);
  margin: 0 auto;
  overflow: auto;
  padding: 10px 16px max(18px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: rgba(21, 27, 34, 0.98);
  box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.56);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

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

.close-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.type-badge,
.subtype-badge,
.custom-badge {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #11161b;
  font-size: 0.76rem;
  font-weight: 900;
}

.custom-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.subtype-badge {
  background: rgba(242, 184, 75, 0.16);
  color: var(--accent-strong);
}

.detail-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06080a;
}

.utility-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.utility-option {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  padding: 0 10px;
}

.utility-option.active {
  border-color: rgba(242, 184, 75, 0.58);
  background: rgba(242, 184, 75, 0.16);
  color: var(--accent-strong);
}

.detail-description {
  margin: 14px 0 0;
  color: #d7dee7;
  line-height: 1.65;
}

.add-form {
  display: grid;
  gap: 12px;
}

.add-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.add-form input,
.add-form select,
.add-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  outline: 0;
}

.add-form input,
.add-form select {
  min-height: 44px;
  padding: 0 12px;
}

.add-form textarea {
  resize: vertical;
  padding: 12px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.reset-view-button {
  margin-left: auto;
}

@media (min-width: 720px) {
  .app-shell {
    padding-inline: 22px;
  }
}
