:root {
  color-scheme: light;
  --display-font: "HYPixel11pxU", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --ui-font: "HYPixel11pxU", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --ultramarine: #2446a6;
  --ultramarine-dark: #162c72;
  --blue-ink: #10245a;
  --sky: #eaf3ff;
  --paper: #fbfcff;
  --panel: #ffffff;
  --panel-blue: #f3f7ff;
  --line: #d8e2f4;
  --line-strong: #b8c9ea;
  --text: #16213c;
  --soft-text: #52617e;
  --muted: #7b88a5;
  --cyan: #24b8c4;
  --mint: #7fd6b5;
  --yellow: #ffd35a;
  --coral: #ff7b6f;
  --shadow: 0 18px 44px rgba(36, 70, 166, 0.14);
  --soft-shadow: 0 10px 26px rgba(36, 70, 166, 0.1);
  font-family: var(--ui-font);
}

@font-face {
  font-family: "HYPixel11pxU";
  src: url("/fonts/HYPixel11pxU-2.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--sky);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(36, 70, 166, 0.12) 0 25%, transparent 25% 100%),
    linear-gradient(45deg, transparent 0 72%, rgba(255, 211, 90, 0.18) 72% 100%),
    linear-gradient(180deg, #f8fbff 0%, #eaf3ff 100%);
  overflow: hidden;
}

body.admin-body {
  overflow: auto;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(36, 70, 166, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(36, 70, 166, 0.05) 1px, transparent 1px),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(36, 70, 166, 0.035) 18px 20px);
  background-size: 38px 38px, 38px 38px, 100% 100%;
  animation: gridDrift 18s linear infinite;
}

button,
input,
textarea {
  font: inherit;
}

button,
.ghost-button,
.detail-actions a {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-ink);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--soft-shadow);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
.ghost-button:hover,
.detail-actions a:hover {
  transform: translateY(-1px);
  border-color: var(--ultramarine);
  background: #f7faff;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 38px 38px, -38px 38px, 0 0; }
}

@keyframes softIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pinPulse {
  0%, 100% { box-shadow: 0 12px 24px rgba(36, 70, 166, 0.22); }
  50% { box-shadow: 0 16px 34px rgba(36, 184, 196, 0.28); }
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(36, 70, 166, 0.42);
  outline-offset: 3px;
}

.glass {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.glass::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(135deg, rgba(36, 70, 166, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(36, 184, 196, 0.08), transparent 24%);
}

.glass > * {
  position: relative;
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 18px;
  height: 100vh;
  width: 100%;
  min-width: 0;
  padding: 18px;
}

.sidebar,
.map-wrap,
.detail,
.admin-shell {
  border-radius: 18px;
}

.sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.sidebar-head {
  display: grid;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  background: #060606;
  box-shadow: 0 14px 28px rgba(36, 70, 166, 0.2);
  font-weight: 900;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1,
.admin-head h1 {
  color: var(--blue-ink);
  font-family: var(--display-font);
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand p,
.admin-head p,
.meta,
.form-message {
  color: var(--muted);
}

.search,
.login-panel label,
.arcade-form label {
  display: grid;
  gap: 8px;
  color: var(--soft-text);
  font-size: 13px;
}

.search {
  margin-bottom: 12px;
}

.search input,
.login-panel input,
.arcade-form input,
.arcade-form textarea,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.search input,
.login-panel input,
.arcade-form input {
  height: 44px;
  padding: 0 13px;
}

.arcade-form textarea,
textarea {
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.5;
}

.search input::placeholder,
.login-panel input::placeholder {
  color: #98a5bd;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.account-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.front-login,
.account-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
}

.register-form {
  display: grid;
  gap: 8px;
}

.register-form input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.front-login input,
.account-form input,
.comment-form select {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

.front-login button,
.account-status button,
.comment-form button,
.register-form button,
.account-form button {
  min-height: 38px;
  padding: 0 12px;
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
  box-shadow: none;
}

.account-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--soft-text);
  font-size: 12px;
  line-height: 1.5;
}

.account-status p {
  flex-basis: 100%;
}

.chip,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--soft-text);
  background: #fff;
  font-family: var(--display-font);
  font-size: 13px;
  box-shadow: none;
}

.chip.active {
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
  font-weight: 700;
}

.arcade-list,
.admin-arcade-list {
  display: grid;
  min-height: 0;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: var(--line-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.arcade-list::-webkit-scrollbar,
.admin-arcade-list::-webkit-scrollbar,
.detail::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.arcade-list::-webkit-scrollbar-thumb,
.admin-arcade-list::-webkit-scrollbar-thumb,
.detail::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.arcade-card,
.admin-arcade-item {
  position: relative;
  width: 100%;
  min-height: 106px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background:
    linear-gradient(135deg, #fff 0 68%, #eef4ff 68% 100%);
  box-shadow: none;
  animation: softIn 280ms ease both;
}

.arcade-card::before,
.admin-arcade-item::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: var(--ultramarine);
  opacity: 0;
}

.arcade-card h3 {
  max-width: 220px;
  font-size: 16px;
  line-height: 1.3;
}

.arcade-card p {
  margin-top: 8px;
  color: var(--soft-text);
  line-height: 1.45;
}

.arcade-card.active,
.admin-arcade-item.active {
  border-color: var(--ultramarine);
  background:
    linear-gradient(135deg, #f7faff 0 66%, rgba(36, 184, 196, 0.18) 66% 100%);
  box-shadow: var(--soft-shadow);
}

.arcade-card.active::before,
.admin-arcade-item.active::before {
  opacity: 1;
}

.admin-arcade-item {
  display: grid;
  min-height: 74px;
  gap: 6px;
}

.admin-arcade-item strong {
  color: var(--blue-ink);
}

.admin-arcade-item span {
  color: var(--muted);
  font-size: 13px;
}

.card-top,
.detail-title,
.admin-head,
.editor-toolbar,
.admin-actions,
.manager-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  color: #4d3600;
  background: var(--yellow);
  font-family: var(--display-font);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.ok {
  color: #06361e;
  background: var(--mint);
}

.content {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(340px, 1.22fr) minmax(292px, 0.78fr);
  gap: 18px;
}

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map {
  height: 100%;
  min-height: 320px;
  background: #edf3ff;
}

.map-fallback {
  display: grid;
  height: 100%;
  min-height: 320px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--blue-ink);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(36, 70, 166, 0.12), transparent 48%),
    linear-gradient(315deg, rgba(36, 184, 196, 0.16), transparent 42%),
    #edf3ff;
}

.map-fallback span {
  color: var(--soft-text);
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-control-zoom a {
  color: var(--blue-ink) !important;
  background: #fff !important;
  border-color: var(--line) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.map-pin {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--ultramarine) 0 58%, var(--coral) 58% 100%);
  box-shadow: 0 12px 24px rgba(36, 70, 166, 0.24);
  font-weight: 900;
  line-height: 42px;
  text-align: center;
  transform: rotate(-45deg);
  animation: pinPulse 2.8s ease-in-out infinite;
}

.map-pin.base {
  background: linear-gradient(135deg, var(--ultramarine) 0 58%, var(--yellow) 58% 100%);
}

.map-pin b {
  display: block;
  font: inherit;
  transform: rotate(45deg);
}

.map-pin.logo-pin {
  overflow: hidden;
  padding: 4px;
  background: #050505;
}

.map-pin.logo-pin img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: rotate(45deg);
}

.map-toolbar {
  position: absolute;
  z-index: 500;
  bottom: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 22px;
}

.admin-link {
  display: none;
}

.mobile-nav {
  display: none;
}

.mobile-topbar,
.mobile-map-peek {
  display: none;
}

.detail {
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.detail-title {
  align-items: flex-start;
}

.detail h2 {
  color: var(--blue-ink);
  font-size: 26px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 14px;
}

.metric,
.route-result,
.route-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-blue);
}

.metric {
  min-height: 82px;
  padding: 12px;
  min-width: 0;
}

.metric span,
.route-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong,
.route-summary strong {
  color: var(--blue-ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tabs,
.route-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  margin-bottom: 12px;
}

.tab,
.mode {
  min-height: 36px;
  padding: 0 12px;
  font-family: var(--display-font);
  box-shadow: none;
}

.tab.active,
.mode.active {
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
  font-weight: 800;
}

.route-panel,
.info-panel {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-route,
.follow-button {
  padding: 0 14px;
}

.primary-route {
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
}

.follow-button {
  border-color: rgba(36, 184, 196, 0.38);
  color: #075c66;
  background: #eafcff;
}

.route-limit {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--soft-text);
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.route-result {
  padding: 13px;
  color: var(--soft-text);
}

.next-query {
  margin-top: 8px;
  color: var(--blue-ink);
  font-weight: 700;
}

.route-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.route-badges span {
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff;
  background: var(--ultramarine);
  font-family: var(--display-font);
  font-size: 12px;
  font-weight: 700;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.route-summary div {
  min-height: 64px;
  padding: 10px;
  min-width: 0;
}

.route-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.route-steps li,
.info-panel p {
  color: var(--soft-text);
  line-height: 1.45;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.comments-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comments-head strong {
  color: var(--blue-ink);
}

.comments-head span,
.comment-login-note {
  color: var(--muted);
  font-size: 13px;
}

.comment-form {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.comment-form label {
  display: grid;
  gap: 6px;
  color: var(--soft-text);
  font-size: 12px;
}

.comment-form textarea {
  min-height: 76px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}

.comment-item div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-item span {
  color: #e0a900;
}

.comment-item p {
  color: var(--soft-text);
  line-height: 1.5;
}

.comment-item time {
  color: var(--muted);
  font-size: 12px;
}

.detail-actions a {
  display: grid;
  place-items: center;
  padding: 0 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.admin-body {
  display: grid;
  overflow: auto;
  place-items: center;
  padding: 24px;
}

.account-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  overflow: auto;
}

.account-shell {
  width: min(920px, 100%);
  border-radius: 18px;
  padding: 20px;
}

.account-hero,
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-hero {
  justify-content: space-between;
  margin-bottom: 18px;
}

.account-app,
.user-view {
  display: grid;
  gap: 12px;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-pane {
  display: grid;
  gap: 12px;
}

.account-form {
  grid-template-columns: 1fr;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--panel-blue);
}

.profile-card img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.my-comment-list {
  display: grid;
  gap: 10px;
}

.user-view {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border-radius: 14px;
}

.admin-shell {
  width: min(1180px, 100%);
  min-height: min(780px, calc(100vh - 48px));
  padding: 22px;
  overflow: hidden;
}

.login-panel,
.admin-auth-panel {
  display: grid;
  max-width: 430px;
  gap: 14px;
  margin-top: 32px;
}

.admin-auth-panel {
  max-width: 560px;
  margin: 34px auto 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  animation: softIn 260ms ease both;
}

.admin-auth-panel strong {
  color: var(--blue-ink);
  font-size: 18px;
}

.admin-auth-panel p {
  margin-top: 6px;
  color: var(--muted);
}

.admin-auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
}

.admin-auth-form input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.admin-auth-form button {
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
}

.login-panel button,
.editor-toolbar button,
#saveBtn,
.manager-list-head button {
  padding-inline: 16px;
}

#saveBtn,
.login-panel button,
.manager-list-head button {
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
}

.manager-panel {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
  min-height: 0;
  align-items: start;
}

.manager-list {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel-blue);
}

.arcade-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  min-width: 0;
}

.admin-workbench {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.user-panel,
.settings-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  animation: softIn 260ms ease both;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 150px auto;
  gap: 8px;
}

.user-form input,
.user-form select,
.settings-form input,
.settings-form select,
.settings-form textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

.user-form input,
.user-form select,
.settings-form input,
.settings-form select {
  height: 40px;
  padding: 0 10px;
}

.settings-form textarea {
  padding: 10px;
  resize: vertical;
}

.user-form button {
  padding: 0 14px;
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: var(--soft-text);
  font-size: 12px;
}

.settings-form .wide,
.settings-form button {
  grid-column: 1 / -1;
}

.settings-form button {
  min-height: 42px;
  border-color: transparent;
  color: #fff;
  background: var(--ultramarine);
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-blue);
}

.user-item div {
  display: grid;
  gap: 3px;
}

.user-item span {
  color: var(--muted);
  font-size: 12px;
}

.user-item button {
  min-height: 34px;
  padding: 0 10px;
  box-shadow: none;
}

.geo-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-blue);
}

.geo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.geo-head strong {
  color: var(--blue-ink);
}

.geo-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.geo-results {
  display: grid;
  gap: 8px;
  max-height: 236px;
  overflow: auto;
  padding-right: 4px;
}

.geo-result-item {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px 12px;
  text-align: left;
  box-shadow: none;
}

.geo-result-item strong {
  color: var(--blue-ink);
}

.geo-result-item span,
.geo-result-item em {
  color: var(--soft-text);
  font-style: normal;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.editor-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.json-tools {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.json-tools textarea {
  min-height: 280px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  body:not(.admin-body) {
    overflow: hidden;
  }

  .mobile-topbar {
    position: fixed;
    top: 12px;
    right: 12px;
    left: 12px;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-topbar-copy {
    min-width: 0;
  }

  .mobile-topbar-copy p,
  .mobile-topbar-copy h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-topbar-copy p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-topbar-copy h2 {
    margin: 0;
    color: var(--blue-ink);
    font-size: 18px;
    line-height: 1.2;
  }

  .mobile-jump-button {
    min-width: 84px;
    padding: 0 12px;
    border-color: transparent;
    color: #fff;
    background: var(--ultramarine);
    box-shadow: none;
  }

  .mobile-jump-button:disabled {
    color: var(--muted);
    background: #edf2fb;
  }

  .shell,
  .manager-panel {
    grid-template-columns: 1fr;
  }

  .shell {
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    min-height: 100vh;
    padding: 72px 12px 72px;
  }

  .shell,
  .content {
    display: block;
  }

  .sidebar,
  .map-wrap,
  .detail,
  .user-view {
    height: 100%;
    overflow: auto;
  }

  .sidebar {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overscroll-behavior: contain;
  }

  .sidebar-head {
    position: sticky;
    top: -14px;
    z-index: 5;
    margin: -14px -14px 12px;
    padding: 14px 14px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(10px);
  }

  .admin-shell {
    overflow: visible;
  }

  .sidebar,
  .map-wrap,
  .detail,
  .admin-shell {
    border-radius: 14px;
  }

  .arcade-list {
    grid-auto-flow: row;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 4px 6px 0;
    min-height: 0;
    touch-action: pan-y;
  }

  .arcade-card {
    min-height: 94px;
    padding: 14px;
  }

  .arcade-card h3 {
    max-width: none;
    font-size: 15px;
  }

  .content {
    width: 100%;
    min-width: 0;
    height: 100%;
  }

  .map,
  .map > div {
    max-width: 100%;
  }

  .map {
    height: 100%;
    min-height: 0;
  }

  .mobile-map-peek {
    position: absolute;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 600;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(184, 201, 234, 0.95);
    border-radius: 16px;
    color: var(--blue-ink);
    text-align: left;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
  }

  .mobile-map-peek.hidden {
    display: none;
  }

  .peek-eyebrow {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-map-peek strong {
    font-size: 16px;
    line-height: 1.3;
  }

  .mobile-map-peek span:last-child {
    color: var(--soft-text);
    font-size: 13px;
  }

  body[data-mobile-view="list"] .content,
  body[data-mobile-view="map"] .sidebar,
  body[data-mobile-view="map"] .detail,
  body[data-mobile-view="map"] .user-view,
  body[data-mobile-view="detail"] .sidebar,
  body[data-mobile-view="detail"] .map-wrap,
  body[data-mobile-view="detail"] .user-view,
  body[data-mobile-view="user"] .sidebar,
  body[data-mobile-view="user"] .map-wrap,
  body[data-mobile-view="user"] .detail {
    display: none;
  }

  body[data-mobile-view="map"] .content,
  body[data-mobile-view="map"] .map-wrap,
  body[data-mobile-view="detail"] .content,
  body[data-mobile-view="detail"] .detail,
  body[data-mobile-view="user"] .content,
  body[data-mobile-view="user"] .user-view {
    display: block;
  }

  .mobile-nav {
    position: fixed;
    z-index: 1200;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(184, 201, 234, 0.86);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 46px rgba(16, 36, 90, 0.2);
    backdrop-filter: blur(18px);
  }

  .mobile-nav-item {
    display: grid;
    min-width: 0;
    min-height: 44px;
    place-items: center;
    gap: 2px;
    border: 0;
    border-radius: 10px;
    color: var(--soft-text);
    background: transparent;
    box-shadow: none;
    font-family: var(--display-font);
    font-size: 11px;
  }

  .mobile-nav-item.active {
    color: #fff;
    background: var(--ultramarine);
  }

  .mobile-nav-icon {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1;
  }

  .detail-grid,
  .route-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .front-login,
  .comment-form,
  .code-row {
    grid-template-columns: 1fr;
  }

  .admin-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-body {
    display: block;
    min-height: 100dvh;
    padding: 12px;
    background:
      linear-gradient(135deg, rgba(36, 70, 166, 0.12) 0 25%, transparent 25% 100%),
      linear-gradient(45deg, transparent 0 72%, rgba(255, 211, 90, 0.18) 72% 100%),
      linear-gradient(180deg, #f8fbff 0%, #eaf3ff 100%);
  }

  .admin-shell {
    width: 100%;
    min-height: auto;
    padding: 16px;
    overflow: visible;
  }

  .manager-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 16px;
  }

  .manager-list {
    grid-template-rows: auto minmax(180px, 34dvh);
  }

  .admin-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .arcade-form {
    gap: 12px;
  }

  .geo-toolbar {
    grid-template-columns: 1fr;
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .admin-auth-form {
    grid-template-columns: 1fr;
  }

  .json-tools textarea {
    min-height: 220px;
  }
}

@media (max-width: 560px) {
  .shell {
    gap: 12px;
  }

  .sidebar,
  .detail,
  .admin-shell {
    padding: 14px;
  }

  .admin-body {
    padding: 10px;
  }

  .mobile-topbar {
    padding: 10px 12px;
  }

  .mobile-topbar-copy h2 {
    font-size: 17px;
  }

  .detail-grid,
  .route-summary,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
  }

  .brand h1,
  .admin-head h1 {
    font-size: 21px;
  }

  .map-toolbar {
    bottom: 72px;
    right: 10px;
  }

  .manager-list-head,
  .editor-toolbar,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .manager-list-head button,
  .editor-toolbar button,
  .admin-actions a,
  .admin-actions button {
    width: 100%;
  }
}

:root {
  --display-font:
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;

  --ui-font:
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;

  --muted: #65718a;
}

body {
  line-height: 1.5;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(36, 70, 166, 0.42);
  outline-offset: 3px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button:disabled:hover {
  transform: none;
  border-color: var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.comment-item span {
  color: #8a6500;
}

.admin-auth-form label {
  display: grid;
  gap: 6px;
  color: var(--soft-text);
  font-size: 12px;
}

.user-form {
  grid-template-columns:
    repeat(3, minmax(0, 1fr))
    140px
    auto;
}

/* 防止较矮的笔记本屏幕出现地图或详情裁切 */
@media (min-width: 901px) and (max-height: 720px) {
  .shell {
    min-height: 0;
  }

  .content {
    grid-template-rows:
      minmax(250px, 1.1fr)
      minmax(210px, 0.9fr);
  }

  .map,
  .map-fallback {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .mobile-topbar {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));

    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .shell {
    padding:
      calc(72px + env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      calc(72px + env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .sidebar-head {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .mobile-map-peek {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .mobile-nav {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));

    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .user-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .account-hero {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .account-hero .ghost-button {
    width: 100%;
  }
}

/* 恢复原项目像素字体 */
@font-face {
  font-family: "HYPixel";
  src: url("/fonts/HYPixel11pxU-2.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --display-font:
    "HYPixel",
    "Microsoft YaHei",
    "PingFang SC",
    sans-serif;

  --ui-font:
    "HYPixel",
    "Microsoft YaHei",
    "PingFang SC",
    sans-serif;
}

body,
button,
input,
select,
textarea {
  font-family: var(--ui-font);
}

h1,
h2,
h3,
.brand,
.brand h1,
.mobile-topbar h2,
.detail h2,
.admin-head h1,
.account-hero h1 {
  font-family: var(--display-font);
}

.sidebar-account-entry {
  margin-top: 14px;
}

.account-entry-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  width: 100%;
  min-height: 42px;
  padding: 9px 14px;

  color: var(--text);
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;

  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(46, 70, 120, 0.08);

  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.account-entry-button:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 70, 166, 0.3);
  box-shadow: 0 10px 24px rgba(46, 70, 120, 0.13);
}

.account-entry-button:active {
  transform: translateY(0);
}

.account-entry-button:focus-visible {
  outline: 2px solid rgba(36, 70, 166, 0.42);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .sidebar-account-entry {
    margin-top: 10px;
  }
}