:root {
  --phone-width: 430px;
  --bg-height-ratio: 2.221053;
  --scene-bg-height: min(calc(100vw * var(--bg-height-ratio)), calc(var(--phone-width) * var(--bg-height-ratio)));
  --text: #14323c;
  --muted: #5f7a7f;
  --line: rgba(21, 72, 79, 0.18);
  --white: #ffffff;
  --danger: #c83f3f;
  --success: #17765f;
  --accent: #ef6b45;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  color: var(--text);
  background: #d8f1ef;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: linear-gradient(90deg, #bfe7e2 0, #f5fbf9 50%, #bfe7e2 100%);
}

.scene {
  position: relative;
  width: min(100vw, var(--phone-width));
  min-height: max(100vh, var(--scene-bg-height));
  overflow: hidden;
  background-color: #aee9e8;
  background-image:
    url("/assets/images/bg.jpg"),
    linear-gradient(180deg, #c8f1ec 0%, #e9f7f2 45%, #b6f0ec 72%, #14d5d6 100%);
  background-repeat: no-repeat, no-repeat;
  background-size: 100% auto, 100% 100%;
  background-position: top center, top center;
  box-shadow: 0 0 36px rgba(0, 56, 65, 0.18);
}

.language-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  min-width: 54px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #15525a;
  font-size: 13px;
  font-weight: 700;
  line-height: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(22, 104, 118, 0.14);
  backdrop-filter: blur(8px);
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.language-toggle:hover {
  color: #0b3d45;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(22, 104, 118, 0.18);
}

.hidden-admin-trigger {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 7;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  opacity: 0;
  background: transparent;
}

.brand-safe-area {
	height: clamp(360px, 70vh, 680px);
}

.scene.is-registering .brand-safe-area {
  height: clamp(230px, 40vh, 350px);
}

.scene.is-success .brand-safe-area,
.scene.is-login .brand-safe-area,
.scene.is-status .brand-safe-area,
.scene.is-reupload .brand-safe-area {
	height: clamp(230px, 40vh, 350px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.register-surface {
  position: relative;
  width: calc(100% - 42px);
  margin: 0 auto 28px;
  padding: 22px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 36px rgba(20, 86, 85, 0.2);
}

.step-title {
  margin-bottom: 8px;
  color: #17434a;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.field {
  position: relative;
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin: 0 0 6px 8px;
  color: #214e54;
  font-size: 13px;
  line-height: 18px;
}

.field input,
.field select {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 16px;
  background-color: transparent;
  background-image: url("/assets/images/input_bg.png");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.field input::placeholder {
  color: #8aa0a4;
}

.field .scan-input-wrap {
  position: relative;
  display: block;
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: normal;
}

.scan-input-wrap input {
  padding-right: 62px;
}

.scan-barcode-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(29, 103, 113, 0.18);
  border-radius: 50%;
  color: #1c5960;
  background: rgba(255, 255, 255, 0.76);
  transform: translateY(-50%);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.scan-barcode-btn:hover {
  border-color: rgba(29, 103, 113, 0.34);
  color: #174c53;
  background: rgba(255, 255, 255, 0.95);
}

.scan-barcode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.scan-barcode-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 9999s ease-out;
}

.field select {
  appearance: none;
  padding-right: 42px;
}

.select-field select:invalid {
  color: #8aa0a4;
  font-weight: 400;
}

.select-field::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 20px;
  width: 0;
  height: 0;
  pointer-events: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(28, 89, 96, 0.82);
}

.ticket-field select {
  color: #e4007f;
  font-weight: 700;
}

.ticket-field select:invalid {
  color: #8aa0a4;
  font-weight: 400;
}

.image-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(292px, 78%);
  min-height: 58px;
  margin: 18px auto 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  background:
    radial-gradient(circle at 24% 82%, rgba(3, 184, 219, 0.82) 0%, rgba(3, 184, 219, 0.82) 16%, transparent 34%),
    linear-gradient(180deg, #c8f8ff 0%, #79dcec 28%, #2ac6df 62%, #b6edf0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 22px rgba(24, 135, 164, 0.26);
  text-shadow: 0 1px 4px rgba(22, 116, 139, 0.5);
  transition: opacity 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.image-submit:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.2);
}

.image-submit span {
  display: block;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.image-submit:not(:disabled):hover {
  filter: brightness(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 14px 24px rgba(24, 135, 164, 0.3);
}

.link-action {
  border: 0;
  color: #1c5960;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  background: transparent;
  transition: color 160ms ease, opacity 160ms ease;
}

.link-action:hover {
  color: #ef6b45;
}

.link-action:disabled,
.pill-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.pill-action {
  width: min(248px, 76%);
  min-height: 50px;
  display: block;
  margin: 18px auto 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, #80ddec 0%, #1cc2de 48%, #20b2ca 100%);
  box-shadow: 0 12px 24px rgba(31, 154, 177, 0.26);
  transition: filter 160ms ease, opacity 160ms ease;
}

.pill-action:hover {
  filter: brightness(1.03);
}

.login-submit {
  margin-top: 22px;
}

.form-back-link {
  display: block;
  margin: 14px auto 0;
}

.register-status-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 30px;
  margin: 0 0 14px auto;
  padding: 0 12px;
  border-radius: 999px;
  color: #1c5960;
  font-size: 12px;
  line-height: 30px;
  white-space: nowrap;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(28, 89, 96, 0.12);
}

.photo-field {
  margin-top: 14px;
}

.photo-trigger {
  width: 100%;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed rgba(22, 93, 88, 0.42);
  border-radius: 8px;
  color: #1c5960;
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.photo-trigger:hover {
  border-color: rgba(239, 107, 69, 0.72);
  background: #fff;
}

.photo-trigger svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  line-height: 1.2;
}

.photo-title {
  font-size: 16px;
  font-weight: 700;
}

.photo-hint {
  max-width: 100%;
  color: #5f7a7f;
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
  text-align: center;
}

.file-input {
  display: none;
}

.photo-preview {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.photo-preview img {
  width: 74px;
  height: 104px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.photo-preview button,
.solid-button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(180deg, #f08a52 0, #e45f3f 100%);
  transition: filter 160ms ease;
}

.photo-preview button:hover,
.solid-button:hover {
  filter: brightness(1.03);
}

.reupload-surface {
  padding-bottom: 24px;
}

.reupload-or {
  position: relative;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.reupload-or::before,
.reupload-or::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--line);
}

.reupload-or::before {
  left: 8px;
}

.reupload-or::after {
  right: 8px;
}

.reupload-search-btn {
  margin-top: 4px;
}

.reupload-clear-btn {
  width: min(248px, 76%);
  min-height: 42px;
  display: block;
  margin: 10px auto 0;
  border: 1px solid rgba(28, 89, 96, 0.2);
  border-radius: 999px;
  color: #1c5960;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.reupload-clear-btn:hover {
  border-color: rgba(28, 89, 96, 0.34);
  color: #174c53;
  background: rgba(255, 255, 255, 0.9);
}

.reupload-result {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.reupload-result dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.reupload-result dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(18, 112, 105, 0.08);
}

.reupload-result dt,
.reupload-result dd {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
}

.reupload-result dt {
  color: var(--muted);
}

.reupload-result dd {
  max-width: 66%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.reupload-photo-field {
  margin-top: 16px;
}

.reupload-submit {
  margin-top: 18px;
}

.success-panel {
  width: calc(100% - 42px);
  margin: 0 auto 36px;
  padding: 26px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  box-shadow: 0 16px 36px rgba(20, 86, 85, 0.18);
}

.scene.is-success .success-panel {
  min-height: clamp(360px, 46vh, 460px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.success-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
}

.success-mark svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.success-panel p {
  min-height: 22px;
  margin: 0 0 16px;
  color: var(--muted);
}

.success-panel dl {
  margin: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.success-panel dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(18, 112, 105, 0.08);
}

.success-panel dt,
.success-panel dd {
  margin: 0;
  font-size: 14px;
}

.success-panel dd {
  max-width: 66%;
  overflow-wrap: anywhere;
  color: #14323c;
  font-weight: 700;
}

.panel-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.panel-actions .pill-action {
  margin-top: 0;
}

.status-panel {
  background: rgba(255, 255, 255, 0.97);
  text-align: center;
}

.status-panel dl div {
  background: #eaf6f4;
}

.status-emblem {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #fff;
  background: #1d8a75;
}

.status-emblem svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-panel.is-approved .status-emblem {
  background: var(--success);
}

.status-panel.is-pending .status-emblem,
.status-panel.is-unreviewed .status-emblem {
  background: #1c91a7;
}

.status-panel.is-rejected .status-emblem {
  background: var(--danger);
}

.status-panel.is-rejected #statusValue {
  color: var(--danger);
}

.status-panel.is-approved #statusValue {
  color: var(--success);
}

.status-panel.is-pending #statusValue,
.status-panel.is-unreviewed #statusValue {
  color: #116a80;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  background: rgba(12, 35, 39, 0.56);
}

.crop-sheet {
  width: min(100vw, var(--phone-width));
  padding: 14px 18px 22px;
  border-radius: 8px 8px 0 0;
  background: #f9fffd;
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.22);
}

.crop-header {
  height: 40px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  margin-bottom: 10px;
  color: #173e45;
  font-weight: 700;
  text-align: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #173e45;
  background: rgba(20, 70, 78, 0.08);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#cropCanvas {
  display: block;
  width: min(72vw, 238px);
  aspect-ratio: 331 / 473;
  margin: 0 auto 16px;
  border-radius: 6px;
  background: #d7e6e6;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(18, 74, 78, 0.22), 0 14px 32px rgba(12, 60, 64, 0.2);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 35, 39, 0.42);
}

.auth-sheet {
  width: min(100%, 300px);
  overflow: hidden;
  border-radius: 8px;
  background: rgba(250, 255, 253, 0.98);
  text-align: center;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.24);
}

.auth-sheet h2 {
  margin: 0;
  padding: 18px 18px 10px;
  color: #173e45;
  font-size: 17px;
  line-height: 24px;
}

.auth-sheet input {
  width: calc(100% - 36px);
  height: 42px;
  margin: 0 18px 16px;
  padding: 0 12px;
  border: 1px solid rgba(21, 72, 79, 0.18);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: #fff;
  text-align: center;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.auth-actions button {
  height: 46px;
  border: 0;
  color: #1c5960;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.78);
}

.auth-actions button + button {
  border-left: 1px solid var(--line);
  color: #e45f3f;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 59;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(12, 35, 39, 0.62);
}

.scanner-sheet {
  width: min(100%, 420px);
  max-height: min(720px, calc(100dvh - 36px));
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(247, 255, 253, 0.98);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.24);
}

.scanner-header {
  min-height: 38px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  color: #173e45;
  font-size: 17px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
}

.scanner-spacer {
  display: block;
}

.scanner-view {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #0f2f35;
  aspect-ratio: 3 / 4;
}

.scanner-view video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  inset: 16%;
  border: 2px solid rgba(238, 255, 251, 0.96);
  border-radius: 8px;
  box-shadow:
    0 0 0 999px rgba(4, 23, 26, 0.26),
    0 0 22px rgba(63, 216, 220, 0.38);
}

.scanner-canvas {
  display: none;
}

.scanner-status {
  margin: 0;
  min-height: 20px;
  color: #214e54;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

.scanner-cancel-btn {
  width: min(248px, 76%);
  min-height: 42px;
  display: block;
  justify-self: center;
  border: 1px solid rgba(28, 89, 96, 0.2);
  border-radius: 999px;
  color: #1c5960;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.76);
}

.crop-controls {
  display: grid;
  gap: 14px;
}

.crop-controls label {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.crop-controls input[type="range"] {
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 60;
  width: min(calc(100vw - 40px), 360px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 50, 57, 0.92);
  text-align: center;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.toast.is-error {
  background: rgba(178, 55, 55, 0.94);
}

.toast.is-success {
  background: rgba(23, 118, 95, 0.94);
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: #fff;
  background: rgba(11, 43, 48, 0.58);
}

.loader {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 820ms linear infinite;
}

.is-hidden {
  display: none !important;
}

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

@media (max-width: 360px) {
  .register-surface,
  .success-panel {
    width: calc(100% - 28px);
    padding-inline: 14px;
  }

  .brand-safe-area {
    height: clamp(320px, 66vh, 600px);
  }

  .language-toggle {
    top: 10px;
    right: 10px;
    min-width: 50px;
    height: 30px;
    padding-inline: 10px;
    font-size: 12px;
    line-height: 28px;
  }

  .register-status-link {
    padding: 0 10px;
    font-size: 11px;
  }

}
