* {
  box-sizing: border-box;
}

html {
  background: var(--theme-html-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", sans-serif;
  color: var(--theme-content-text);
  background: var(--theme-body-bg);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: var(--theme-body-before-inset);
  top: var(--theme-body-before-top);
  right: var(--theme-body-before-right);
  bottom: var(--theme-body-before-bottom);
  left: var(--theme-body-before-left);
  width: var(--theme-body-before-width);
  height: var(--theme-body-before-height);
  border-radius: var(--theme-body-before-radius);
  background: var(--theme-body-before-bg);
  filter: var(--theme-body-before-filter);
  opacity: var(--theme-body-before-opacity);
}

body::after {
  inset: var(--theme-body-after-inset);
  top: var(--theme-body-after-top);
  right: var(--theme-body-after-right);
  bottom: var(--theme-body-after-bottom);
  left: var(--theme-body-after-left);
  width: var(--theme-body-after-width);
  height: var(--theme-body-after-height);
  border-radius: var(--theme-body-after-radius);
  background: var(--theme-body-after-bg);
  filter: var(--theme-body-after-filter);
  opacity: var(--theme-body-after-opacity);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 960px);
  margin: 0 auto;
  padding: 48px 0 64px;
}

.hero {
  display: flex;
  justify-content: center;
}

.site-footer {
  margin-top: 22px;
  text-align: center;
  color: var(--theme-footer-text);
  font-size: 0.82rem;
  line-height: 1.7;
}

.site-footer small {
  display: inline-block;
  padding: 0 12px;
}

.panel {
  width: min(100%, 760px);
  border: 1px solid var(--theme-panel-border);
  border-radius: 32px;
  background: var(--theme-panel-surface);
  box-shadow: var(--theme-panel-shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 42px;
  background: var(--theme-card-bg);
  backdrop-filter: var(--theme-card-backdrop);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--theme-card-overlay);
  z-index: 0;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

body.is-locale-menu-open .hero-card > :not(.page-toolbar) {
  pointer-events: none;
}

.page-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
  z-index: 4;
}

.locale-switcher {
  position: relative;
  isolation: isolate;
  z-index: 5;
}

.locale-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--theme-menu-trigger-border);
  border-radius: 999px;
  background: var(--theme-menu-trigger-bg);
  color: var(--theme-content-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--theme-menu-trigger-shadow);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.locale-trigger:hover,
.locale-trigger:focus-visible,
.locale-switcher.is-open .locale-trigger {
  outline: none;
  border-color: var(--theme-focus-border);
  box-shadow: var(--theme-menu-trigger-hover-shadow);
  transform: translateY(-1px);
}

.locale-trigger:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--theme-menu-trigger-border);
  box-shadow: var(--theme-menu-trigger-shadow);
  transform: none;
}

.locale-trigger-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  background-color: var(--theme-accent-deep);
  mask-image: url("/assets/language_icon.svg");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("/assets/language_icon.svg");
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.locale-trigger-value {
  min-width: 0;
  border: 0;
  color: var(--theme-content-text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.locale-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: max-content;
  min-width: 100%;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--theme-menu-border);
  border-radius: 18px;
  background: var(--theme-menu-bg);
  box-shadow: var(--theme-menu-shadow);
  pointer-events: auto;
  z-index: 50;
}

.locale-menu[hidden] {
  display: none;
}

.locale-menu-option {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--theme-content-text);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.locale-menu-option:hover,
.locale-menu-option:focus-visible {
  outline: none;
  background: var(--theme-menu-hover-bg);
  color: var(--theme-accent-deep);
  transform: translateX(1px);
}

.locale-menu-option.is-current {
  background: var(--theme-menu-active-bg);
  color: var(--theme-accent-deep);
}

.brand-row {
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
}

.brand-logo {
  display: block;
  margin-inline: auto;
  width: min(100%, 300px);
  height: auto;
}

.hero-copy {
  text-align: center;
}

h1 {
  margin: 18px 0 14px;
  color: var(--theme-content-text);
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 38rem;
  margin: 0 auto;
  color: var(--theme-content-muted);
  font-size: 1.03rem;
  line-height: 1.85;
}

.hero-form-shell {
  margin-top: 30px;
  padding: 28px;
  border: 1px solid var(--theme-form-shell-border);
  border-radius: 22px;
  background: var(--theme-form-shell-bg);
  color: var(--theme-content-text);
}

.form-title {
  margin: 0 0 10px;
  color: var(--theme-content-text);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.form-subtitle {
  margin: 0 0 24px;
  color: var(--theme-content-muted);
  line-height: 1.75;
}

form {
  display: grid;
  gap: 18px;
}

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

.field-label {
  font-size: 0.95rem;
  font-weight: 700;
}

.hint {
  color: var(--theme-content-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.custom-select {
  position: relative;
}

.custom-select-trigger,
input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--theme-input-border);
  border-radius: 16px;
  background: var(--theme-input-bg);
  color: var(--theme-content-text);
  font: inherit;
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input::placeholder {
  color: var(--theme-input-placeholder);
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 52px;
  text-align: left;
  background: var(--theme-input-strong-bg);
  box-shadow: var(--theme-input-inset-shadow);
  cursor: pointer;
}

.custom-select-value {
  color: var(--theme-content-text);
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible,
input:focus {
  outline: none;
  border-color: var(--theme-focus-border);
  box-shadow:
    0 0 0 5px var(--theme-focus-ring),
    0 12px 24px var(--theme-focus-shadow);
  transform: translateY(-1px);
}

.custom-select-trigger:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--theme-input-border);
  box-shadow: var(--theme-input-inset-shadow);
  transform: none;
}

.custom-select.is-open .select-caret,
.custom-select-trigger:focus-visible .select-caret {
  transform: translateY(-50%) rotate(180deg);
  border-top-color: var(--theme-accent-deep);
}

.select-caret {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--theme-caret-color);
  transform: translateY(-50%);
  pointer-events: none;
  transition: transform 160ms ease, border-top-color 160ms ease;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--theme-menu-border);
  border-radius: 18px;
  background: var(--theme-menu-bg);
  box-shadow: var(--theme-menu-shadow);
  z-index: 10;
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--theme-content-text);
  font: inherit;
  font-size: 0.97rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: none;
  background: var(--theme-menu-hover-bg);
  color: var(--theme-accent-deep);
  transform: translateX(1px);
}

.custom-select-option.is-selected {
  background: var(--theme-menu-active-bg);
  color: var(--theme-accent-deep);
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.primary-action {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: var(--theme-primary-gradient);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--theme-primary-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--theme-primary-shadow-hover);
}

.secondary-note {
  color: var(--theme-content-muted);
  font-size: 0.9rem;
}

.feedback {
  min-height: 3.75rem;
  padding: 14px 16px;
  border: 1px dashed var(--theme-feedback-border);
  border-radius: 18px;
  background: var(--theme-feedback-bg);
  color: var(--theme-feedback-color);
  line-height: 1.65;
}

.feedback.is-active {
  border-style: solid;
  border-color: var(--theme-feedback-success-border);
  color: var(--theme-feedback-success-color);
  background: var(--theme-feedback-success-bg);
}

.footnote {
  margin-top: 18px;
  color: var(--theme-content-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

@media (max-width: 920px) {
  .shell {
    width: min(100% - 24px, 960px);
    padding-top: 28px;
  }

  .hero-card {
    padding: 30px;
  }

  .hero-form-shell {
    margin-top: 24px;
    padding: 24px;
  }
}

@media (max-width: 640px) {
  body::before {
    width: var(--theme-body-before-mobile-width);
    height: var(--theme-body-before-mobile-height);
  }

  body::after {
    width: var(--theme-body-after-mobile-width);
    height: var(--theme-body-after-mobile-height);
  }

  .shell {
    width: min(100% - 18px, 960px);
    padding: 18px 0 32px;
  }

  .panel {
    border-radius: 24px;
  }

  .hero-card {
    padding: 22px;
  }

  .page-toolbar {
    justify-content: center;
    margin-bottom: 18px;
  }

  .locale-trigger {
    width: 100%;
    max-width: 320px;
  }

  .locale-menu {
    left: 0;
    right: 0;
  }

  .brand-row {
    margin-bottom: 22px;
  }

  h1 {
    margin-top: 14px;
    font-size: clamp(2rem, 11vw, 3rem);
    line-height: 1;
  }

  .lead,
  .form-subtitle {
    font-size: 0.98rem;
    line-height: 1.7;
  }

  .hero-form-shell {
    padding: 20px;
  }

  .form-title {
    font-size: 1.45rem;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-action {
    width: 100%;
  }

  .secondary-note {
    text-align: center;
  }

  .select-caret {
    right: 16px;
  }

  .custom-select-menu {
    top: calc(100% + 8px);
    padding: 8px;
  }

  .feedback,
  .footnote {
    font-size: 0.92rem;
  }

  .site-footer {
    margin-top: 18px;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .brand-logo {
    width: min(100%, 240px);
  }

  .hero-card,
  .hero-form-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    width: 100%;
  }

  form {
    gap: 14px;
  }

  .custom-select-trigger,
  input,
  .primary-action,
  .feedback {
    border-radius: 14px;
  }
}
