:root {
  --paper: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e8f0;
  --blue: #0b8cff;
  --blue-deep: #086dd1;
  --green: #2fc866;
  --red: #ff5b5f;
  --orange: #ff7a1a;
  --shadow: 0 12px 34px rgba(23, 32, 51, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 60px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  grid-column: 2;
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0;
}

.ghost-link {
  justify-self: end;
  color: var(--blue-deep);
  text-decoration: none;
  font-weight: 650;
}

.admin-shell,
.front-shell {
  width: min(100%, 520px);
  margin: 0 auto;
}

.admin-shell {
  padding: 18px 18px 150px;
}

.switch-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.08);
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 42px;
  gap: 8px;
  margin-bottom: 18px;
}

.search-panel input {
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.07);
}

.search-button,
.clear-search-button {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  font-weight: 750;
}

.search-button {
  color: #fff;
  background: var(--blue);
}

.search-button:hover {
  background: var(--blue-deep);
}

.clear-search-button {
  color: #7b8494;
  background: #eef1f6;
  font-size: 22px;
  line-height: 1;
}

.clear-search-button[hidden] {
  display: none;
}

.clear-search-button:hover {
  color: #fff;
  background: var(--red);
}

.switch-panel strong,
.switch-panel span {
  display: block;
}

.switch-panel strong {
  margin-bottom: 4px;
  font-size: 17px;
}

.switch-panel span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.switch {
  position: relative;
  width: 58px;
  height: 34px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b6bfca;
  transition: background 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  content: "";
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.22);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(24px);
}

.editor-list {
  display: grid;
  gap: 16px;
}

.editor-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.content-card {
  min-height: 150px;
  padding: 28px 112px 24px 64px;
  transition: opacity 160ms ease, box-shadow 160ms ease;
}

.admin-item-index {
  position: absolute;
  top: 24px;
  left: 24px;
  color: var(--red);
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
}

.content-card.is-hidden-item {
  opacity: 0.58;
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.08);
}

.content-card.is-search-hidden {
  display: none;
}

.content-card.is-hidden-item::after {
  position: absolute;
  right: 24px;
  bottom: 18px;
  color: var(--muted);
  content: "已隐藏";
  font-size: 13px;
  font-weight: 700;
}

.empty-admin-card {
  min-height: 136px;
  align-content: center;
}

.editor-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
}

.item-count {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #7b8494;
  background: #eef1f6;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  color: #fff;
  background: var(--red);
}

.item-actions {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-switch {
  position: relative;
  display: block;
  width: 42px;
  height: 26px;
}

.mini-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.mini-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c3cad5;
  transition: background 160ms ease;
}

.mini-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  content: "";
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(23, 32, 51, 0.2);
  transition: transform 160ms ease;
}

.mini-switch input:checked + span {
  background: var(--green);
}

.mini-switch input:checked + span::after {
  transform: translateX(16px);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d8dde7;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 150px;
  padding: 14px;
  line-height: 1.65;
  resize: vertical;
}

.simple-body-input {
  min-height: 102px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
}

.simple-body-input::placeholder {
  color: #9098a6;
}

.simple-body-input:focus {
  outline: 0;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--blue);
  outline: 3px solid rgba(11, 140, 255, 0.18);
}

.primary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 17px;
  font-weight: 750;
}

.primary-button:hover,
.save-button:hover {
  background: var(--blue-deep);
}

.savebar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 12px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 14px 18px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.save-button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-size: 16px;
  font-weight: 750;
}

.front-page {
  background: linear-gradient(90deg, #edf7ff 0 10px, var(--paper) 10px calc(100% - 10px), #edf7ff calc(100% - 10px));
}

.front-shell {
  padding: 24px 18px;
}

.front-list {
  display: grid;
  gap: 24px;
}

.front-card {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.front-index {
  position: absolute;
  top: -18px;
  left: -12px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--orange);
  font-size: 18px;
  font-weight: 800;
}

.front-media-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.front-image {
  display: block;
  width: 100%;
  max-height: 370px;
  object-fit: contain;
  border-radius: 8px;
  background: #f0f2f5;
}

.front-title {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  word-break: break-word;
}

a.front-title:hover,
.front-media-link:hover + .front-title {
  color: var(--blue-deep);
}

.front-body {
  margin: 0;
  color: #35445a;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-button {
  min-height: 46px;
  border: 0;
  color: #08b9ff;
  background: transparent;
  font-size: 24px;
  font-weight: 750;
}

.empty-state {
  display: grid;
  min-height: 72vh;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 92px;
  left: 18px;
  z-index: 5;
  width: min(calc(100% - 36px), 484px);
  margin: 0 auto;
  padding: 12px 14px;
  color: #fff;
  text-align: center;
  pointer-events: none;
  background: rgba(23, 32, 51, 0.92);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 380px) {
  .admin-shell,
  .front-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .front-card {
    padding: 24px 18px;
  }

  .front-body {
    font-size: 15px;
  }

  .front-title {
    font-size: 18px;
  }
}
