@font-face {
  font-family: "Huyet Nguyet Serif";
  src: url("assets/NotoSerifDisplay-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #100405;
  --panel: #160808;
  --panel-strong: #0b0304;
  --blood: #7e1418;
  --blood-bright: #c42a2f;
  --gold: #c6923a;
  --gold-light: #f0d58e;
  --gold-dark: #6f451b;
  --text: #f4e8cf;
  --muted: #b9aa95;
  --danger: #f27474;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: "Huyet Nguyet Serif", Georgia, serif;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  overflow: hidden;
  background: #080303;
}

.hero__background {
  position: absolute;
  z-index: -3;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.045);
  animation: hero-pan 26s ease-in-out infinite alternate;
}

.hero__shade {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: none;
  animation: scene-breathe 9s ease-in-out infinite alternate;
}

.mist-layer {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mist-layer i {
  position: absolute;
  left: -18%;
  bottom: -7vh;
  width: 138%;
  height: 27vh;
  background: linear-gradient(90deg, transparent 0%, rgba(89, 16, 19, 0.14) 15%, rgba(24, 7, 8, 0.5) 34%, rgba(116, 22, 25, 0.16) 58%, rgba(17, 5, 6, 0.46) 79%, transparent 100%);
  filter: blur(22px);
  opacity: 0.72;
  animation: mist-drift 18s ease-in-out infinite alternate;
}

.mist-layer i:nth-child(2) {
  bottom: 10vh;
  height: 18vh;
  opacity: 0.38;
  transform: scaleX(-1);
  animation-duration: 24s;
  animation-delay: -8s;
}

.mist-layer i:nth-child(3) {
  bottom: 30vh;
  height: 10vh;
  opacity: 0.2;
  filter: blur(30px);
  animation-duration: 29s;
  animation-delay: -15s;
}

.petal-layer {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petal-layer i {
  --petal-size: 11px;
  --petal-drift: 90px;
  --petal-turn: 620deg;
  position: absolute;
  top: -10vh;
  left: 10%;
  width: var(--petal-size);
  height: calc(var(--petal-size) + 5px);
  border-radius: 80% 8% 72% 18%;
  background: linear-gradient(145deg, #e0454c 0%, #9c171c 48%, #3f070a 100%);
  box-shadow: 0 0 5px rgba(196, 42, 47, 0.28);
  opacity: 0;
  transform-origin: 70% 30%;
  animation: petal-fall 12s linear infinite;
}

.petal-layer i:nth-child(1)  { left: 5%;  --petal-size: 8px;  --petal-drift: 130px; animation-delay: -2s;  animation-duration: 13s; }
.petal-layer i:nth-child(2)  { left: 12%; --petal-size: 13px; --petal-drift: -80px; animation-delay: -9s;  animation-duration: 15s; }
.petal-layer i:nth-child(3)  { left: 20%; --petal-size: 9px;  --petal-drift: 65px;  animation-delay: -5s;  animation-duration: 11s; }
.petal-layer i:nth-child(4)  { left: 28%; --petal-size: 15px; --petal-drift: -120px; animation-delay: -12s; animation-duration: 17s; }
.petal-layer i:nth-child(5)  { left: 36%; --petal-size: 7px;  --petal-drift: 100px; animation-delay: -7s;  animation-duration: 12s; }
.petal-layer i:nth-child(6)  { left: 44%; --petal-size: 12px; --petal-drift: -60px; animation-delay: -3s;  animation-duration: 14s; }
.petal-layer i:nth-child(7)  { left: 51%; --petal-size: 9px;  --petal-drift: 145px; animation-delay: -11s; animation-duration: 16s; }
.petal-layer i:nth-child(8)  { left: 58%; --petal-size: 14px; --petal-drift: -95px; animation-delay: -6s;  animation-duration: 13s; }
.petal-layer i:nth-child(9)  { left: 64%; --petal-size: 8px;  --petal-drift: 75px;  animation-delay: -14s; animation-duration: 18s; }
.petal-layer i:nth-child(10) { left: 70%; --petal-size: 11px; --petal-drift: -125px; animation-delay: -4s; animation-duration: 15s; }
.petal-layer i:nth-child(11) { left: 76%; --petal-size: 16px; --petal-drift: 85px;  animation-delay: -10s; animation-duration: 17s; }
.petal-layer i:nth-child(12) { left: 82%; --petal-size: 9px;  --petal-drift: -70px; animation-delay: -1s; animation-duration: 12s; }
.petal-layer i:nth-child(13) { left: 88%; --petal-size: 12px; --petal-drift: 115px; animation-delay: -8s; animation-duration: 14s; }
.petal-layer i:nth-child(14) { left: 94%; --petal-size: 7px;  --petal-drift: -135px; animation-delay: -13s; animation-duration: 16s; }
.petal-layer i:nth-child(15) { left: 24%; --petal-size: 6px;  --petal-drift: 160px; animation-delay: -16s; animation-duration: 19s; }
.petal-layer i:nth-child(16) { left: 47%; --petal-size: 10px; --petal-drift: -150px; animation-delay: -15s; animation-duration: 18s; }
.petal-layer i:nth-child(17) { left: 68%; --petal-size: 6px;  --petal-drift: 125px; animation-delay: -17s; animation-duration: 20s; }
.petal-layer i:nth-child(18) { left: 91%; --petal-size: 10px; --petal-drift: -105px; animation-delay: -18s; animation-duration: 19s; }

@keyframes petal-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -10vh, 0) rotate(0deg) rotateX(0deg);
  }
  8% { opacity: 0.82; }
  46% { transform: translate3d(calc(0px - var(--petal-drift)), 48vh, 0) rotate(280deg) rotateX(150deg); }
  78% { opacity: 0.72; }
  100% {
    opacity: 0;
    transform: translate3d(var(--petal-drift), 112vh, 0) rotate(var(--petal-turn)) rotateX(330deg);
  }
}

.site-header {
  position: absolute;
  top: clamp(24px, 4vw, 54px);
  left: clamp(24px, 5vw, 88px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(244, 232, 207, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.site-header__mark {
  width: 28px;
  height: 1px;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(198, 146, 58, 0.55);
  animation: mark-pulse 3.8s ease-in-out infinite;
}

.hero__content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min(52vw, 790px);
  min-height: 100svh;
  padding: 88px clamp(34px, 5vw, 88px) 82px;
}

.hero__content::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 8%;
  right: 4%;
  top: 23%;
  height: 58%;
  border-top: 1px solid rgba(198, 146, 58, 0.14);
  border-bottom: 1px solid rgba(126, 20, 24, 0.2);
  background: linear-gradient(90deg, transparent, rgba(54, 7, 9, 0.22) 32%, rgba(54, 7, 9, 0.1) 72%, transparent);
  pointer-events: none;
}

.hero__logo {
  display: block;
  width: min(100%, 570px);
  max-height: 60svh;
  object-fit: contain;
  filter:
    drop-shadow(0 22px 40px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 18px rgba(126, 20, 24, 0.42))
    drop-shadow(0 0 5px rgba(240, 213, 142, 0.2));
  animation: logo-float 6s ease-in-out infinite;
}

.hero__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(100%, 550px);
  margin-top: clamp(15px, 2.2vh, 30px);
  padding-top: 18px;
  border-top: 1px solid rgba(198, 146, 58, 0.38);
}

.action-button,
.submit-button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 13px 22px;
  border: 1px solid #9d6c29;
  border-radius: 3px;
  color: var(--gold-light);
  background: linear-gradient(180deg, rgba(48, 10, 11, 0.98), rgba(18, 5, 6, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(240, 213, 142, 0.16),
    inset 0 -12px 24px rgba(0, 0, 0, 0.2),
    0 14px 34px rgba(0, 0, 0, 0.42);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.action-button::before,
.submit-button::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(240, 213, 142, 0.24);
  border-radius: 1px;
  pointer-events: none;
}

.action-button::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -55%;
  bottom: -55%;
  left: -42%;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255, 239, 190, 0.3), transparent);
  transform: skewX(-18deg);
  animation: button-sheen 6.5s ease-in-out infinite;
  pointer-events: none;
}

.action-button:nth-child(2)::after { animation-delay: -3.25s; }
.action-button > span { position: relative; z-index: 1; }

.action-button--primary {
  border-color: #d19a3a;
  color: #fff0bd;
  background: linear-gradient(180deg, #9f2025, #671015);
  box-shadow:
    inset 0 0 0 1px rgba(255, 231, 170, 0.2),
    inset 0 -14px 26px rgba(58, 4, 7, 0.28),
    0 14px 36px rgba(80, 5, 8, 0.42);
}

.action-button__icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-right: 1px solid rgba(240, 213, 142, 0.26);
  color: #f5d77f;
}

.action-button__icon svg {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button:hover,
.action-button:focus-visible,
.submit-button:hover,
.submit-button:focus-visible {
  outline: none;
  border-color: var(--gold-light);
  color: #fff8df;
  background: linear-gradient(180deg, #b52a30, #771419);
  box-shadow: inset 0 0 0 1px rgba(255, 239, 190, 0.22), 0 16px 38px rgba(85, 7, 10, 0.5);
  transform: translateY(-2px);
}

.action-button:active,
.submit-button:active {
  transform: translateY(0);
}

@keyframes hero-pan {
  from { transform: scale(1.045) translate3d(-0.4%, -0.2%, 0); }
  to { transform: scale(1.085) translate3d(0.8%, 0.35%, 0); }
}

@keyframes scene-breathe {
  from { background-color: rgba(0, 0, 0, 0.1); }
  to { background-color: rgba(42, 4, 6, 0.18); }
}

@keyframes mist-drift {
  from { translate: -4% 0; scale: 1 0.92; }
  to { translate: 5% -2vh; scale: 1.05 1.08; }
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes mark-pulse {
  0%, 100% { opacity: 0.6; box-shadow: 0 0 8px rgba(198, 146, 58, 0.35); }
  50% { opacity: 1; box-shadow: 0 0 16px rgba(240, 213, 142, 0.72); }
}

@keyframes button-sheen {
  0%, 62% { left: -42%; opacity: 0; }
  68% { opacity: 1; }
  84%, 100% { left: 122%; opacity: 0; }
}

.hero__footer {
  position: absolute;
  left: clamp(24px, 5vw, 88px);
  bottom: clamp(22px, 3.5vw, 48px);
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(34vw, 360px);
  opacity: 0.58;
}

.hero__footer span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--gold-dark);
}

.hero__footer i {
  display: block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.register-dialog {
  width: min(calc(100% - 32px), 510px);
  max-height: calc(100svh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
}

.register-dialog::backdrop {
  background: rgba(4, 1, 2, 0.82);
  backdrop-filter: blur(5px);
}

.register-dialog[open] {
  animation: dialog-in 180ms ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.register-form {
  display: grid;
  gap: 18px;
  padding: clamp(24px, 6vw, 42px);
  background-image: linear-gradient(rgba(126, 20, 24, 0.08), transparent 34%);
}

.register-form__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 4px;
}

.register-form__heading p {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.register-form__heading h2 {
  margin: 0;
  color: var(--gold-light);
  font-size: clamp(26px, 6vw, 34px);
  line-height: 1.15;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(198, 146, 58, 0.35);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  outline: none;
  border-color: var(--gold);
  color: var(--gold-light);
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: #d7c6a8;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #4d3230;
  border-radius: 3px;
  outline: none;
  color: var(--text);
  background: var(--panel-strong);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input::placeholder {
  color: #756760;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 146, 58, 0.11);
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field__error {
  min-height: 16px;
  color: var(--danger);
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.form-message {
  min-height: 21px;
  margin: -4px 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.form-message[data-state="success"] {
  color: #a9d99b;
}

.form-message[data-state="error"] {
  color: var(--danger);
}

.submit-button {
  width: 100%;
  border-color: #b87f2f;
  background: #681216;
}

.submit-button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  max-width: min(90vw, 440px);
  padding: 12px 18px;
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  color: var(--text);
  background: rgba(16, 4, 5, 0.96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  font-family: Arial, sans-serif;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.register-page {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  overflow-x: hidden;
  background: #080303;
}

.register-page__background,
.register-page__shade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.register-page__background {
  z-index: -3;
  object-fit: cover;
  object-position: center;
}

.register-page__shade {
  z-index: -2;
  background: rgba(5, 1, 2, 0.58);
}

.register-page__content {
  display: grid;
  align-content: center;
  justify-items: start;
  width: min(100%, 1320px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 68px clamp(24px, 6vw, 88px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 16px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.back-link::before {
  content: "‹";
  margin-right: 9px;
  color: var(--gold);
  font-size: 24px;
  line-height: 1;
}

.back-link:hover,
.back-link:focus-visible {
  outline: none;
  color: #fff8df;
}

.register-shell {
  width: min(100%, 520px);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  background: rgba(22, 8, 8, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.register-shell__logo {
  display: block;
  width: 180px;
  max-height: 145px;
  margin: 18px auto -18px;
  object-fit: contain;
}

.register-form--page {
  background-image: none;
}

.register-form__heading h1 {
  margin: 0;
  color: var(--gold-light);
  font-size: clamp(26px, 6vw, 34px);
  line-height: 1.15;
}

@media (max-width: 900px) {
  .hero__background {
    object-position: 68% center;
  }

  .hero__shade {
    background: rgba(0, 0, 0, 0.34);
  }

  .hero__content {
    width: min(76vw, 700px);
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: 760px;
  }

  .hero__background {
    object-position: 72% center;
  }

  .hero__shade {
    background: rgba(0, 0, 0, 0.48);
  }

  .site-header {
    top: 22px;
    left: 22px;
  }

  .hero__content {
    justify-content: flex-end;
    width: 100%;
    min-height: 100svh;
    padding: 110px 22px 100px;
  }

  .hero__content::before { left: 0; right: 0; top: 30%; height: 54%; }

  .hero__logo {
    width: min(100%, 440px);
    max-height: 52svh;
  }

  .hero__actions {
    grid-template-columns: 1fr;
    width: min(100%, 390px);
  }

  .action-button {
    min-height: 52px;
  }

  .hero__footer {
    left: 22px;
    bottom: 28px;
    width: calc(100% - 44px);
  }

  .petal-layer i:nth-child(n + 13) { display: none; }

  .register-page__background {
    object-position: 70% center;
  }

  .register-page__content {
    align-content: start;
    padding: 28px 16px 40px;
  }

  .register-shell__logo {
    width: 150px;
    margin-bottom: -20px;
  }

  .register-form--page {
    padding: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .petal-layer, .mist-layer { display: none; }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
