:root {
  color-scheme: dark;
  --ink: #211615;
  --ink-soft: #2a1c1a;
  --panel: #30211e;
  --line: rgba(231, 219, 186, 0.15);
  --line-strong: rgba(231, 219, 186, 0.28);
  --paper: #f1ead8;
  --muted: #aaa99d;
  --gold: #d7b96f;
  --gold-light: #f1d78f;
  --jade: #6fb8a4;
  --danger: #e08b7f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #170e0d;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(28, 15, 13, 0.7), rgba(28, 15, 13, 0.78)),
    url("/assets/guild-fortress.png?v=20260824") center / cover fixed;
  color: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.site-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  min-height: 344px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
  background-image:
    linear-gradient(180deg, rgba(41, 20, 14, 0.08) 0%, rgba(41, 20, 14, 0.04) 34%, rgba(33, 22, 21, 0.86) 100%),
    linear-gradient(90deg, rgba(34, 16, 13, 0.32), rgba(34, 16, 13, 0.02)),
    url("/assets/guild-fortress.png?v=20260824");
  background-size: cover;
  background-position: center 46%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 185, 111, 0.8), transparent);
  z-index: -1;
}

.topbar,
.brand,
.admin-link,
.brand-copy,
.status-pill,
.section-heading,
.section-heading > div,
.input-wrap,
.upload-action,
.image-preview figcaption,
.image-preview figcaption > span,
.form-notice,
.submit-button,
.receipt {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
}

.brand {
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(241, 215, 143, 0.7);
  background: rgba(42, 22, 17, 0.62);
  color: var(--gold-light);
  font-family: "Songti SC", STSong, serif;
  font-size: 20px;
  box-shadow: inset 0 0 0 3px rgba(42, 22, 17, 0.42);
}

.brand-copy {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 14px;
}

.brand-copy small {
  color: rgba(241, 234, 216, 0.62);
  font-size: 8px;
}

.admin-link {
  height: 36px;
  padding: 0 11px;
  gap: 7px;
  border: 1px solid rgba(241, 234, 216, 0.28);
  background: rgba(42, 22, 17, 0.48);
  color: #eee7d6;
  text-decoration: none;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.admin-link svg {
  width: 15px;
}

.hero-copy {
  max-width: 430px;
}

.status-pill {
  width: fit-content;
  margin-bottom: 22px;
  gap: 8px;
  color: #d9e8e1;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 5px rgba(111, 184, 164, 0.13);
}

.hero-kicker,
.dialog-kicker {
  margin: 0 0 7px;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.hero h1 {
  margin: 0;
  font-family: "Songti SC", STSong, serif;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.55);
}

.hero-copy > p:last-child {
  max-width: 390px;
  margin: 11px 0 0;
  color: rgba(241, 234, 216, 0.74);
  font-size: 14px;
  line-height: 1.7;
}

.form-section {
  padding: 28px 20px 34px;
  background:
    linear-gradient(180deg, rgba(215, 185, 111, 0.03), transparent 180px),
    #211615;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.section-heading > div {
  gap: 10px;
}

.section-index {
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Songti SC", STSong, serif;
  font-size: 22px;
}

.required-note {
  color: var(--muted);
  font-size: 11px;
}

.required-note b,
.field > label span {
  color: var(--gold);
}

.field {
  margin-bottom: 22px;
}

.field > label {
  display: block;
  margin-bottom: 9px;
  color: #e9e2d1;
  font-size: 13px;
  font-weight: 600;
}

.input-wrap {
  min-height: 52px;
  padding: 0 15px;
  gap: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
  border-color: rgba(215, 185, 111, 0.7);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 3px rgba(215, 185, 111, 0.08);
}

.input-wrap svg {
  width: 18px;
  flex: 0 0 auto;
  color: var(--gold);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-size: 15px;
}

.input-wrap input::placeholder {
  color: #767b76;
}

.input-wrap input::-webkit-calendar-picker-indicator {
  filter: invert(84%) sepia(16%) saturate(803%) hue-rotate(3deg) brightness(91%);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.upload-drop {
  min-height: 188px;
  padding: 24px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed var(--line-strong);
  background:
    linear-gradient(135deg, rgba(215, 185, 111, 0.035), rgba(111, 184, 164, 0.025)),
    rgba(255, 255, 255, 0.025);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-drop:hover,
.upload-drop.is-dragging {
  border-color: var(--gold);
  background: rgba(215, 185, 111, 0.07);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 185, 111, 0.28);
  background: rgba(215, 185, 111, 0.08);
  color: var(--gold-light);
}

.upload-icon svg {
  width: 22px;
}

.upload-drop strong {
  margin-bottom: 7px;
  color: #ece5d4;
  font-size: 14px;
}

.upload-drop > span:not(.upload-icon):not(.upload-action) {
  color: #888d87;
  font-size: 11px;
  line-height: 1.5;
}

.upload-action {
  height: 34px;
  margin-top: 17px;
  padding: 0 13px;
  gap: 7px;
  border: 1px solid rgba(215, 185, 111, 0.35);
  color: var(--gold-light);
  font-size: 11px;
}

.upload-action svg {
  width: 14px;
}

.image-preview {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0a0d0c;
}

.image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.image-preview figcaption {
  min-height: 52px;
  padding: 8px 10px 8px 13px;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
}

.image-preview figcaption > span {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.image-preview figcaption strong {
  max-width: 260px;
  overflow: hidden;
  color: #ddd6c5;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview figcaption small {
  color: #858b84;
  font-size: 10px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #aeb1aa;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
}

.icon-button svg {
  width: 17px;
}

.field-error {
  min-height: 16px;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 11px;
}

.form-notice {
  margin: 2px 0 22px;
  padding: 13px 14px;
  gap: 12px;
  border-left: 2px solid var(--jade);
  background: rgba(111, 184, 164, 0.07);
}

.form-notice svg {
  width: 19px;
  flex: 0 0 auto;
  color: var(--jade);
}

.form-notice p {
  margin: 0;
  line-height: 1.5;
}

.form-notice strong,
.form-notice span {
  display: block;
}

.form-notice strong {
  color: #cbded7;
  font-size: 11px;
}

.form-notice span {
  color: #87948f;
  font-size: 10px;
}

.submit-button {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  justify-content: center;
  gap: 10px;
  border: 1px solid #ead18c;
  background: linear-gradient(180deg, #e4c77c, #bd9850);
  color: #171912;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(188, 151, 78, 0.18);
  transition: transform 140ms ease, filter 140ms ease;
}

.submit-button:hover {
  filter: brightness(1.05);
}

.submit-button:active {
  transform: translateY(1px);
}

.submit-button:disabled {
  cursor: wait;
  filter: saturate(0.5) brightness(0.75);
}

.submit-button svg {
  width: 18px;
}

.spin {
  animation: spin 900ms linear infinite;
}

footer {
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #190f0f;
  color: #656b66;
  text-align: center;
  font-size: 10px;
}

footer p {
  margin: 0 0 5px;
}

footer a {
  color: #707b75;
}

.success-dialog {
  width: min(calc(100% - 40px), 380px);
  padding: 32px 24px 24px;
  border: 1px solid rgba(215, 185, 111, 0.4);
  border-radius: 0;
  background: #281a18;
  color: var(--paper);
  text-align: center;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

.success-dialog::backdrop {
  background: rgba(5, 8, 7, 0.82);
  backdrop-filter: blur(4px);
}

.success-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(111, 184, 164, 0.55);
  background: rgba(111, 184, 164, 0.1);
  color: #9ad3c3;
}

.success-mark svg {
  width: 26px;
}

.success-dialog h2 {
  margin: 0;
  font-family: "Songti SC", STSong, serif;
  font-size: 26px;
}

.success-dialog > p:not(.dialog-kicker) {
  margin: 8px 0 22px;
  color: #959b94;
  font-size: 13px;
}

.receipt {
  min-height: 52px;
  margin-bottom: 18px;
  padding: 0 15px;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.receipt span {
  color: #8e938e;
  font-size: 11px;
}

.receipt strong {
  color: var(--gold-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

.success-dialog button {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(215, 185, 111, 0.65);
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 11px 15px;
  transform: translate(-50%, 18px);
  background: #e8d8ad;
  color: #1a1e1b;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 700px) {
  body {
    padding: 28px 0;
  }

  .site-shell {
    min-height: calc(100vh - 56px);
    border: 1px solid rgba(241, 234, 216, 0.08);
  }

  .hero {
    min-height: 380px;
    padding-inline: 28px;
  }

  .form-section {
    padding-inline: 28px;
  }
}

@media (max-width: 359px) {
  .brand-copy {
    display: none;
  }

  .hero h1 {
    font-size: 34px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .required-note {
    padding-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
