:root {
  --bg-1: #0f172a;
  --bg-2: #1e293b;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.18);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #2563eb;
  --danger: #f87171;
  --shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  --glass-blur: blur(18px);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: 220ms ease;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text-primary);
}

body {
  position: relative;
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

.background-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 1) 35%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
}

.front-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.banner-section {
  position: relative;
  height: 40vh;
  min-height: 320px;
  overflow: hidden;
}

.banner-image-wrap,
.banner-image,
.banner-overlay {
  position: absolute;
  inset: 0;
}

.banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-overlay {
  background: rgba(0, 0, 0, 0.3);
}

.banner-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 24px;
}

.banner-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.38em;
  color: rgba(226, 232, 240, 0.92);
}

.banner-title {
  margin: 0;
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.banner-subtitle {
  margin: 0;
  font-size: 20px;
  color: #dbe2ea;
}

.admin-entry {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: var(--text-primary);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(12px);
  transition: all var(--transition);
}

.admin-entry:hover {
  background: rgba(15, 23, 42, 0.42);
}

.portal-section {
  position: relative;
  height: 60vh;
  min-height: 440px;
  padding: 32px 40px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-grid {
  width: min(1280px, 100%);
  height: min(100%, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.portal-card,
.option-card,
.sort-item,
.glass-panel,
.editor-block,
.direct-link-card,
.nested-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow);
}

.portal-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.portal-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -50% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22), transparent 72%);
  pointer-events: none;
}

.portal-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: 0 24px 48px rgba(37, 99, 235, 0.28);
}

.portal-card-icon {
  font-size: 34px;
  color: #7dd3fc;
}

.portal-card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.portal-card-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.6);
  padding: 20px;
}

.modal-panel {
  width: min(600px, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.64);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
  padding: 24px;
}

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

.modal-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.modal-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.modal-close,
.modal-back,
.secondary-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-close:hover,
.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.modal-back {
  margin-bottom: 12px;
  border: none;
  background: transparent;
  color: #93c5fd;
  padding: 0;
}

.modal-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 140px;
}

.option-card {
  min-height: 100px;
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.option-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(96, 165, 250, 0.5);
}

.option-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.option-card-description {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.admin-page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(480px, 640px) minmax(560px, 1fr);
  gap: 24px;
  width: 100%;
  height: 100%;
  padding: 24px;
}

.glass-panel {
  border-radius: 20px;
}

.admin-sidebar,
.admin-preview {
  padding: 24px;
  min-height: 0;
}

.admin-sidebar {
  overflow-y: auto;
}

.admin-preview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-sidebar-header,
.admin-preview-header,
.admin-toolbar,
.section-heading,
.sort-item-header,
.nested-header,
.direct-link-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: #7dd3fc;
}

.admin-title,
.admin-preview-header h2,
.section-heading h2 {
  margin: 0;
}

.admin-subtitle,
.section-heading p,
.form-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.admin-preview-link {
  color: #bfdbfe;
  text-decoration: none;
}

.admin-login-card,
.editor-section {
  margin-top: 24px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.44);
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-editor {
  margin-top: 20px;
}

.admin-toolbar {
  margin-bottom: 20px;
}

.primary-btn {
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.9), rgba(37, 99, 235, 0.92));
  color: #fff;
  padding: 12px 18px;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.35);
}

.secondary-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 12px 18px;
}

.form-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-input,
.form-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  padding: 12px 14px;
  outline: none;
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.file-input {
  padding: 10px;
}

.form-message {
  color: #93c5fd;
  font-size: 13px;
}

.form-message.error {
  color: var(--danger);
}

.preview-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: #0f172a;
}

.section-sorter,
.config-tree {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sort-item,
.editor-block,
.direct-link-card,
.nested-card {
  border-radius: 14px;
  padding: 16px;
}

.sort-item {
  cursor: grab;
}

.sort-item.dragging {
  opacity: 0.45;
}

.sort-item-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  color: #bae6fd;
  font-size: 12px;
}

.editor-block,
.nested-card {
  background: rgba(2, 6, 23, 0.26);
}

.nested-list,
.direct-links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.config-grid-2,
.config-grid-3 {
  display: grid;
  gap: 12px;
}

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

.config-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.small-note {
  font-size: 12px;
  color: var(--text-muted);
}

.direct-link-header,
.nested-header,
.sort-item-header {
  margin-bottom: 12px;
}

.direct-link-title,
.nested-title {
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 1400px) {
  .admin-page {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .admin-preview {
    min-height: 720px;
  }
}
