:root {
  color-scheme: dark;
  --ground: #191a17;
  --ink: #f5eddc;
  --muted: #bcb39f;
  --gold: #edc58b;
  --edge: #74604b;
  --gutter: clamp(20px, 5.6vw, 82px);
  --serif: "KaiTi", "STKaiti", "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font: 15px/1.65 var(--sans);
  background: var(--ground);
}

h1, h2, h3, p, form { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { display: block; }

:where(a, button, input, select):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.shell {
  width: min(1120px, calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 1;
  border-bottom: 1px solid rgb(238 204 145 / 17%);
  background: rgb(23 24 22 / 38%);
}

.header-inner, .header-actions, .brand {
  display: flex;
  align-items: center;
}

.header-inner {
  min-height: 75px;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  gap: 12px;
  font: 700 23px/1 var(--serif);
  letter-spacing: .075em;
  white-space: nowrap;
}

.brand-mark { width: 38px; height: 38px; }
.header-actions { gap: 9px; }

.nav-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 14px;
  border: 1px solid rgb(232 198 145 / 28%);
  border-radius: 5px;
  background: rgb(32 32 25 / 49%);
  color: #e9dcc5;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color .18s ease, background .18s ease;
}

.nav-button:hover {
  border-color: rgb(237 197 139 / 72%);
  background: #35312a;
}

.icon-lock {
  position: relative;
  width: 11px;
  height: 9px;
  margin-top: 4px;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: var(--gold);
}

.icon-lock::before {
  position: absolute;
  left: 1px;
  bottom: 7px;
  width: 7px;
  height: 6px;
  border: 1px solid currentColor;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  content: "";
}

.icon-arrow {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 16px;
  height: 1px;
  margin-right: 1px;
  background: currentColor;
}

.icon-arrow::after {
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  content: "";
}

.icon-back { width: 12px; transform: rotate(180deg); }

.portal-home {
  isolation: isolate;
  background: var(--ground);
}

.home-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 660px;
  background:
    linear-gradient(0deg, var(--ground) 0%, rgb(25 26 23 / 65%) 13%, transparent 41%),
    linear-gradient(90deg, rgb(20 21 18 / 78%) 0%, rgb(20 21 18 / 43%) 37%, transparent 69%),
    url("hero.webp") center 51% / cover no-repeat;
}

.home-main { padding-bottom: 65px; }

.hero {
  padding-block: clamp(88px, 10vw, 132px) 104px;
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .29em;
}

.hero-label i, .heading-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: #d8ac70;
  transform: rotate(45deg);
  box-shadow: 0 0 14px rgb(234 171 93 / 30%);
}

.hero h1 {
  width: max-content;
  max-width: 100%;
  margin: 22px 0 18px -3px;
  color: #ffebc7;
  font: 700 clamp(64px, 8vw, 115px)/1.06 var(--serif);
  letter-spacing: .065em;
  text-shadow: 0 4px 24px rgb(16 15 14 / 52%);
}

.hero p {
  color: #e4d5bd;
  font-size: clamp(15px, 1.5vw, 18px);
  letter-spacing: .15em;
  text-shadow: 0 1px 12px #201b16;
}

.hero-ornament {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}

.hero-ornament::before, .hero-ornament::after {
  height: 1px;
  background: #b68a54;
  content: "";
}

.hero-ornament::before { width: 42px; }
.hero-ornament::after { width: 78px; background: linear-gradient(90deg, #b68a54, transparent); }
.hero-ornament i { width: 5px; height: 5px; transform: rotate(45deg); border: 1px solid #e6bd84; }

.section-heading {
  display: flex;
  align-items: center;
  gap: 23px;
  margin-bottom: 18px;
}

.section-heading h2 {
  white-space: nowrap;
  font: 700 27px/1.2 var(--serif);
  letter-spacing: .12em;
}

.section-rule {
  position: relative;
  flex: 1;
  height: 1px;
  margin-left: 3px;
  background: linear-gradient(90deg, #806644, rgb(128 102 68 / 10%));
}

.section-rule::before {
  position: absolute;
  top: -2px;
  left: -3px;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: #b9925e;
  content: "";
}

.entry-grid, .editor-grid {
  display: grid;
  gap: 18px;
}

.editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.entry-grid { grid-template-columns: repeat(var(--entry-columns, 2), minmax(0, 1fr)); }
.columns-1 { --entry-columns: 1; }
.columns-3 { --entry-columns: 3; }
.columns-4 { --entry-columns: 4; }
.columns-5 { --entry-columns: 5; }
.columns-6 { --entry-columns: 6; }

.entries-empty {
  padding: 19px 22px;
  border: 1px solid #64543e;
  border-radius: 7px;
  background: #24251f;
  color: var(--muted);
}

.editor-main .entries-empty { margin-top: 24px; }

.theme-xuanxiao {
  --entry-color: #e7bc7e;
  --entry-tint: #51402d;
  --entry-fill: #30281f;
  --entry-border: #74583a;
}

.theme-guofu {
  --entry-color: #c1d5b6;
  --entry-tint: #3b4c3e;
  --entry-fill: #242f27;
  --entry-border: #516650;
}

.entry-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 134px;
  padding: 23px 25px;
  column-gap: 18px;
  overflow: hidden;
  border: 1px solid var(--entry-border);
  border-radius: 7px;
  background: radial-gradient(ellipse at 10% 0%, var(--entry-tint), transparent 74%),
    linear-gradient(115deg, var(--entry-fill), #252621 88%);
  box-shadow: 0 14px 35px rgb(11 11 10 / 32%), inset 0 1px 0 rgb(255 237 207 / 8%);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.entry-card.enabled:hover, .entry-card.enabled:focus-visible {
  border-color: var(--entry-color);
  box-shadow: 0 16px 35px rgb(11 11 10 / 44%), inset 0 1px 0 rgb(255 237 207 / 12%);
  transform: translateY(-3px);
}

.entry-emblem {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--entry-border);
  background: rgb(15 16 14 / 33%);
  box-shadow: inset 0 0 0 3px rgb(255 247 217 / 3%);
}

.entry-emblem img { width: 35px; height: 35px; }
.entry-copy { min-width: 0; }

.entry-copy h3, .editor-card h2 {
  overflow-wrap: anywhere;
  font: 700 clamp(23px, 2.2vw, 30px)/1.15 var(--serif);
  letter-spacing: .07em;
}

.entry-copy p, .editor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: #c1b6a3;
  font-size: 12px;
  letter-spacing: .075em;
}

.status-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.enabled .entry-copy p, .editor-status.configured { color: var(--entry-color); }
.enabled .status-dot, .configured .status-dot { background: currentColor; }

.entry-arrow {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  border: 1px solid rgb(233 217 179 / 16%);
  border-radius: 50%;
  color: var(--entry-color);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.pending .entry-arrow { color: #b1a591; }
.enabled:is(:hover, :focus-visible) .entry-arrow {
  border-color: var(--entry-color);
  background: var(--entry-color);
  color: #211c15;
}

.end-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin: 59px auto 0;
  color: #8a6e4d;
}

.end-mark::before, .end-mark::after {
  width: min(22%, 132px);
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
  content: "";
}

.end-mark::after { transform: scaleX(-1); }
.end-mark i { width: 6px; height: 6px; border: 1px solid currentColor; transform: rotate(45deg); }

.portal-admin {
  background:
    radial-gradient(ellipse at 81% 8%, rgb(104 69 37 / 22%), transparent 42%),
    var(--ground);
}

.login-main {
  display: grid;
  min-height: calc(100vh - 76px);
  align-items: center;
  padding-block: 72px;
}

.login-card {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  width: min(100%, 850px);
  margin: auto;
  overflow: hidden;
  border: 1px solid #64543e;
  border-radius: 10px;
  background: #25231d;
  box-shadow: 0 30px 90px rgb(10 10 9 / 47%);
}

.login-art {
  position: relative;
  min-height: 392px;
  background:
    linear-gradient(0deg, rgb(29 22 17 / 59%), transparent 65%),
    url("hero.webp") 79% 51% / auto 122% no-repeat;
}

.login-art span {
  position: absolute;
  inset: 13px;
  border: 1px solid rgb(250 209 149 / 45%);
  border-radius: 3px;
}

.login-content { padding: clamp(29px, 5vw, 65px); }

.admin-heading { display: flex; align-items: center; gap: 18px; }
.admin-heading h1 { font: 700 clamp(35px, 4.5vw, 49px)/1.1 var(--serif); letter-spacing: .09em; }
.login-content .admin-heading h1 { font-size: clamp(34px, 4vw, 42px); }

.login-form { display: grid; gap: 17px; margin-top: 27px; }

.login-form label, .editor-fields label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #e6dcc9;
  font-size: 13px;
  font-weight: 600;
}

input:not([type="hidden"]), select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #74634b;
  border-radius: 5px;
  background: #191a17;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
}

input::placeholder { color: #a19682; }
input:not([type="hidden"]):focus, select:focus { border-color: var(--gold); }

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  min-height: 46px;
  min-width: 136px;
  padding: 10px 16px;
  border: 1px solid #edcc99;
  border-radius: 5px;
  background: linear-gradient(180deg, #f0c891, #d8a86b);
  color: #251c12;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  transition: filter .18s ease;
}

.primary-button:hover { filter: brightness(1.085); }
.login-form .primary-button { margin-top: 6px; }
.editor-main { max-width: 1040px; padding-block: 80px 60px; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.editor-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.editor-tools .nav-button { min-height: 46px; }
.add-entry-button { flex: 0 0 auto; gap: 9px; }
.add-entry-button span { font-size: 20px; font-weight: 400; line-height: 1; }
.settings-main { max-width: 600px; }
.settings-form, .new-entry-form { margin-top: 28px; }
.editor-intro, .error-main > p { margin-top: 13px; color: var(--muted); }
.editor-grid { margin-top: 32px; }

.editor-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--entry-border);
  border-radius: 7px;
  background: #24251f;
}

.editor-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 21px;
  border-bottom: 1px solid var(--entry-border);
  background: linear-gradient(120deg, var(--entry-tint), var(--entry-fill));
}

.editor-card-header .entry-emblem { flex: 0 0 auto; width: 46px; height: 46px; }
.editor-card-header .entry-emblem img { width: 28px; height: 28px; }
.editor-card-heading { min-width: 0; }
.editor-card h2 { font-size: 23px; }

.delete-entry-link {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  margin-inline-start: auto;
  border-color: #995f51;
  color: #f6b4a3;
}

.delete-entry-link:hover { border-color: #e6a08d; background: #482a24; }
.delete-entry-address { margin-top: 5px; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }

.danger-button {
  border-color: #df8b76;
  background: #9d4435;
  color: #fff1e9;
}

.delete-entry-form .editor-actions { flex-wrap: nowrap; }
.delete-entry-form .editor-actions .primary-button { width: auto; }
.delete-entry-form .editor-actions .nav-button { min-height: 46px; }
.editor-status { margin-top: 5px; }
.editor-fields { display: grid; gap: 17px; padding: 21px; }
.password-field { display: grid; gap: 7px; }
.editor-fields small { color: var(--muted); font-size: 12px; font-weight: 400; }

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
}

.editor-actions p { color: var(--muted); font-size: 13px; }

.notice {
  margin-top: 19px;
  padding: 10px 13px;
  border: 1px solid #88654c;
  border-radius: 5px;
  background: #392b21;
  color: #ffd5ad;
  font-size: 14px;
}

.notice-success { border-color: #607955; background: #2b3829; color: #d3e8c5; }
.error-main { padding-block: 80px; }

@media (min-width: 761px) {
  .compact-grid .entry-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "emblem arrow" "copy copy";
    gap: 12px;
    align-content: start;
    padding: 16px;
  }
  .compact-grid .entry-emblem { grid-area: emblem; width: 42px; height: 42px; }
  .compact-grid .entry-emblem img { width: 30px; height: 30px; }
  .compact-grid .entry-copy { grid-area: copy; }
  .compact-grid .entry-copy h3 { font-size: clamp(21px, 2vw, 27px); }
  .compact-grid .entry-arrow { grid-area: arrow; width: 32px; height: 32px; }
}

@media (max-width: 1050px) {
  .entry-grid:where(.columns-5, .columns-6) { --entry-columns: 4; }
}

@media (max-width: 760px) {
  .header-inner { min-height: 66px; }
  .home-art {
    height: 605px;
    background-position: center, center, 62% 45%;
  }
  .hero { padding-block: 98px 78px; }
  .hero h1 { font-size: clamp(54px, 12.4vw, 91px); }
  .entry-grid, .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .entry-card { min-height: 111px; }
  .end-mark { margin-top: 45px; }
  .home-main { padding-bottom: 43px; }
  .login-main { min-height: calc(100vh - 67px); padding-block: 45px; }
  .login-card { grid-template-columns: 34% minmax(0, 1fr); }
  .editor-main { padding-block: 51px 44px; }
  .editor-grid { gap: 15px; margin-top: 24px; }
}

@media (max-width: 510px) {
  .header-inner { gap: 8px; }
  .brand { gap: 8px; font-size: 20px; }
  .brand-mark { width: 32px; height: 32px; }
  .header-actions { gap: 6px; }
  .nav-button { gap: 6px; padding-inline: 9px; font-size: 12px; }
  .home-art {
    height: 562px;
    background-image:
      linear-gradient(0deg, var(--ground), transparent 56%),
      linear-gradient(90deg, rgb(21 22 19 / 76%), rgb(21 22 19 / 21%)),
      url("hero.webp");
    background-position: center, center, 64% 39%;
  }
  .hero { padding-block: 81px 67px; }
  .hero h1 { margin-top: 16px; margin-bottom: 15px; }
  .hero-ornament { margin-top: 24px; }
  .section-heading { gap: 16px; margin-bottom: 14px; }
  .section-heading h2 { font-size: 24px; }
  .entry-grid { gap: 12px; }
  .entry-card { column-gap: 13px; min-height: 98px; padding: 15px; }
  .entry-emblem { width: 48px; height: 48px; }
  .entry-emblem img { width: 30px; height: 30px; }
  .entry-arrow { width: 36px; height: 36px; }
  .entry-copy p { margin-top: 5px; }
  .login-card { grid-template-columns: 100%; }
  .login-art { min-height: 121px; background-size: cover; background-position: 73% 43%; }
  .login-art span { inset: 8px; }
  .editor-top { align-items: flex-start; flex-direction: column; gap: 17px; }
  .editor-tools { justify-content: flex-start; }
  .editor-actions { flex-wrap: wrap; }
  .editor-actions .primary-button { width: 100%; }
}

@media (max-width: 375px) {
  .editor-page .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
