:root {
  color-scheme: dark;
  --wallpaper: linear-gradient(135deg, #0f172a, #1e293b 45%, #082f49);
  --card: rgba(15, 23, 42, 0.58);
  --card-strong: rgba(15, 23, 42, 0.78);
  --border: rgba(255, 255, 255, 0.13);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --danger: #fb7185;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: #020617;
  background-image: radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent 32rem), var(--wallpaper);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.34), rgba(2, 6, 23, 0.78));
  backdrop-filter: blur(1px);
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell,
.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.hero {
  position: relative;
  display: grid;
  place-items: center;
  gap: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 6vw, 64px);
  letter-spacing: -0.06em;
}

.hero .admin-link {
  position: absolute;
  top: 0;
  right: 0;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 10px;
}

.clock {
  display: grid;
  gap: 2px;
  padding-left: 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.44);
  line-height: 1;
}

.clock strong {
  font-size: clamp(18px, 2.6vw, 30px);
  letter-spacing: -0.04em;
}

.clock span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.description {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.admin-link,
button,
.import-json {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.admin-link:hover,
button:hover,
.import-json:hover,
.nav-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.search-card,
.panel,
.group-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.search-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 26px;
}

.engine-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.engine-tabs button {
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
}

.engine-tabs button.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.9), rgba(37, 99, 235, 0.9));
  border-color: transparent;
}

.search-card input,
.panel input,
.panel textarea {
  width: 100%;
  color: var(--text);
  background: rgba(2, 6, 23, 0.46);
  border: 1px solid var(--border);
  border-radius: 18px;
  outline: none;
}

.search-card input {
  height: 58px;
  padding: 0 22px;
  font-size: 18px;
}

.panel input,
.panel textarea {
  padding: 12px 14px;
  margin-top: 8px;
  resize: vertical;
}

select {
  width: 100%;
  color: var(--text);
  background: rgba(2, 6, 23, 0.46);
  border: 1px solid var(--border);
  border-radius: 18px;
  outline: none;
  padding: 12px 14px;
  margin-top: 8px;
}

.groups {
  display: grid;
  gap: 22px;
}

.group {
  display: grid;
  gap: 12px;
}

.group-card {
  padding: 24px;
}

.group-title-row,
.panel-head,
.editor-row,
.actions-panel,
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.group-title-row h2,
.panel h2 {
  margin: 0;
  font-size: 20px;
}

.group-title-row span,
.status,
.card-copy small {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.nav-card {
  display: flex;
  gap: 13px;
  min-height: 76px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.icon-wrap {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.11);
  border-radius: 16px;
}

.icon-wrap img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.nav-card.icon-small {
  align-items: center;
}

.nav-card.icon-rich {
  flex-direction: column;
  align-items: flex-start;
  min-height: 136px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.72));
}

.nav-card.icon-rich .icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 20px;
}

.nav-card.icon-rich .icon-wrap img {
  width: 34px;
  height: 34px;
}

.nav-card.icon-rich .card-copy strong {
  font-size: 18px;
}

.nav-card.icon-rich .card-copy small {
  white-space: normal;
  line-height: 1.45;
}

.card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.card-copy strong,
.card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.admin-body h1 {
  font-size: clamp(32px, 5vw, 52px);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) 1.45fr;
  gap: 20px;
}

.panel {
  padding: 22px;
}

.panel label {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.primary {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border-color: transparent;
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
}

.danger {
  color: #fff;
  background: rgba(251, 113, 133, 0.16);
  border-color: rgba(251, 113, 133, 0.4);
}

.status.error {
  color: var(--danger);
}

.editor-list,
.links-editor {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.editor-card {
  padding: 16px;
  background: rgba(2, 6, 23, 0.36);
  border: 1px solid var(--border);
  border-radius: 22px;
}

.link-editor {
  background: rgba(255, 255, 255, 0.045);
}

.editor-row.compact {
  align-items: end;
}

.editor-row label {
  flex: 1;
}

.file-line input,
.import-json input {
  display: none;
}

@media (max-width: 760px) {
  .hero,
  .admin-header,
  .admin-grid,
  .group-title-row,
  .panel-head,
  .editor-row,
  .actions-panel,
  .auth-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}