:root {
  color-scheme: light;
  --bg: #eef4ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(148, 163, 184, 0.22);
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-strong: #2563eb;
  --warning: #b45309;
  --danger: #dc2626;
  --success: #15803d;
  --shadow: 0 24px 56px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font:
    16px/1.65 "Segoe UI",
    "PingFang SC",
    -apple-system,
    BlinkMacSystemFont,
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(29, 78, 216, 0.18), transparent 28%),
    linear-gradient(180deg, #f8fbff, var(--bg));
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  padding: 2px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

pre {
  margin: 0;
  padding: 18px;
  border-radius: 16px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* Layout & Container */
.page {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 40px 0 60px;
}

@media (max-width: 640px) {
  .page {
    width: calc(100% - 24px);
    padding: 24px 0 40px;
  }
}

.hero,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

/* Hero Section */
.hero {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.hero__footer {
  margin-top: auto;
}

.hero__status-group {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.hero .meta-list--inline {
  margin-top: 0;
  display: flex;
  gap: 10px;
}

.hero .meta-item {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: auto;
  flex: 1;
  padding: 12px;
}

.hero .meta-item__label {
  font-size: 12px;
  margin-bottom: 2px;
}

.hero .meta-item__value {
  font-size: 14px;
}

.hero .status {
  padding: 12px 14px;
  font-size: 14px;
}

.status {
  margin-top: 0;
}

.copy-box {
  margin: 24px 0;
  padding: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.copy-box__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.copy-box__value {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-weight: 600;
  word-break: break-all;
  color: var(--text);
  text-decoration: none;
}

.button--small {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .hero {
    padding: 24px;
  }
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.hero h1 {
  margin: 16px 0 0;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero p {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 16px);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

@media (max-width: 640px) {
  .hero__actions {
    flex-direction: column;
    gap: 10px;
  }
  .hero__actions .button {
    width: 100%;
  }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    opacity 0.2s,
    transform 0.1s;
}

.button:active {
  transform: scale(0.98);
}

.button--ghost {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
}

/* Grid Layout */
.layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Main Stack (Content below hero) */
.stack--main {
  margin-top: 24px;
}

/* Layout Footer for full-width bottom items */
.layout-footer {
  margin-top: 24px;
}

.stack {
  display: grid;
  gap: 24px;
}

/* Cards */
.card {
  padding: 32px;
}

@media (max-width: 640px) {
  .card {
    padding: 20px;
  }
}

.card h2 {
  margin: 0;
  font-size: 24px;
}

.card h3 {
  margin: 0;
  font-size: 20px;
}

.card__desc {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Meta List (Info items) */
.hero .meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}

.hero .meta-item {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 140px;
}

.meta-item {
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.meta-item__label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.meta-item__value {
  display: block;
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* Status Banner */
.status {
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 500;
}

.status--warn {
  background: #fff7ed;
  color: var(--warning);
}

/* Forms */
.field-grid {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 640px) {
  .field-grid--two {
    grid-template-columns: repeat(2, 1fr);
  }
}

.field__label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.field__hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  cursor: pointer;
}

.field__checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.field__checkbox-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input {
  height: 50px;
  padding: 0 16px;
}

.textarea {
  min-height: 120px;
  padding: 16px;
  resize: vertical;
}

/* Toggles */
.toggle-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  cursor: pointer;
  /* 防止在手机上点击高亮 */
  -webkit-tap-highlight-color: transparent;
}

.toggle__content {
  flex: 1;
  min-width: 0;
}

.toggle__label {
  display: block;
  font-weight: 600;
}

.toggle__desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.switch {
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  cursor: pointer;
}

/* Footer Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .actions {
    flex-direction: column;
  }
  .actions .button {
    width: 100%;
  }
}

.preview {
  margin-top: 20px;
}

.footer-note {
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 20px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Editor Layout */
.editor-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 1fr;
  height: 600px;
}

@media (max-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.editor-pane,
.preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-textarea {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  min-height: 300px;
}

.editor-textarea.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #f0f9ff;
}

.editor-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.markdown-body {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow-y: auto;
  min-height: 300px;
}

/* Basic Markdown Styles */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}
.markdown-body h1 {
  font-size: 2em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3em;
}
.markdown-body h2 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3em;
}
.markdown-body p {
  margin-bottom: 16px;
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
  margin-bottom: 16px;
}
.markdown-body img {
  max-width: 100%;
  border-radius: 8px;
}
.markdown-body blockquote {
  margin: 0;
  padding: 0 1em;
  color: var(--muted);
  border-left: 0.25em solid var(--line);
}

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(29, 78, 216, 0.18), transparent 28%),
    linear-gradient(180deg, #f8fbff, var(--bg));
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 40px 32px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.auth-desc {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field .input {
  text-align: center;
  font-size: 16px;
}

.auth-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.auth-card .button {
  width: 100%;
}

.auth-card .button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
