*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --teal: #116466;
  --teal-deep: #0a3f40;
  --teal-mid: #1a8587;
  --teal-light: #2a9d9f;
  --teal-soft: #e6f4f4;
  --bg-start: #0a3f40;
  --bg-mid: #116466;
  --bg-end: #1f8f91;
  --card-bg: #f7fbfb;
  --accent: #c4782a;
  --accent-soft: #f3e6d4;
  --alert: #c23b3b;
  --text: #143536;
  --muted: #5a7273;
  --border: #d5e4e4;
  --shadow: 0 20px 50px rgba(10, 63, 64, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
  min-height: 100dvh;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg-start) 0%, var(--bg-mid) 42%, var(--bg-end) 78%, #3cb0b2 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(16px, var(--safe-top))
    max(16px, var(--safe-right))
    max(16px, var(--safe-bottom))
    max(16px, var(--safe-left));
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.55);
  padding: 28px 24px 22px;
}

.card-header {
  margin-bottom: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, var(--teal-light) 0%, var(--teal) 100%);
  box-shadow: 0 6px 14px rgba(17, 100, 102, 0.35);
  flex-shrink: 0;
}

.logo-icon svg {
  display: block;
}

.logo-title {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--teal-deep);
  line-height: 1.2;
}

.alert {
  margin-top: 14px;
  color: var(--alert);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.form {
  margin-bottom: 12px;
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.password-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.password-input::placeholder {
  color: #8aa3a4;
}

.password-input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(17, 100, 102, 0.18);
}

.btn-confirm {
  min-height: 48px;
  height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal-mid) 0%, var(--teal) 100%);
  box-shadow: 0 6px 14px rgba(17, 100, 102, 0.35);
  transition: transform 0.15s, filter 0.15s;
  flex-shrink: 0;
  touch-action: manipulation;
}

.btn-confirm:hover {
  filter: brightness(1.06);
}

.btn-confirm:active {
  transform: scale(0.97);
}

.hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--teal-mid);
  line-height: 1.5;
  margin-bottom: 16px;
}

.hint strong {
  color: var(--teal-deep);
}

.hint-icon {
  display: inline-flex;
  color: var(--accent);
  flex-shrink: 0;
}

.hint-icon svg {
  display: block;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--teal-soft);
  border: 1px solid rgba(17, 100, 102, 0.12);
}

.notice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 8px;
}

.notice-list {
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.notice-list li {
  position: relative;
  padding-left: 14px;
}

.notice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal-light);
}

.utils {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.util-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.util-icon {
  display: block;
  color: #6d8586;
}

.util-btn:hover {
  background: var(--teal-soft);
  border-color: #b7d4d4;
  color: var(--teal-deep);
}

.util-btn:hover .util-icon {
  color: var(--teal);
}

.util-btn:active {
  background: var(--teal-soft);
  transform: scale(0.97);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, calc(var(--safe-bottom) + 16px));
  transform: translateX(-50%);
  width: max-content;
  max-width: min(90vw, 360px);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(10, 63, 64, 0.94);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.25s ease;
  pointer-events: none;
}

.toast[hidden] {
  display: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* 手机端 */
@media (max-width: 480px) {
  .page {
    align-items: flex-start;
    padding-top: max(24px, calc(var(--safe-top) + 20px));
    padding-bottom: max(24px, calc(var(--safe-bottom) + 20px));
  }

  .card {
    padding: 22px 16px 18px;
    border-radius: 22px;
  }

  .logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .logo-icon svg {
    width: 22px;
    height: 22px;
  }

  .alert {
    font-size: 13px;
  }

  .input-row {
    flex-wrap: nowrap;
  }

  .btn-confirm {
    padding: 0 16px;
    min-width: 72px;
  }

  .hint,
  .notice-list {
    font-size: 12.5px;
  }

  .utils {
    gap: 6px;
  }

  .util-btn {
    height: 54px;
    font-size: 11px;
    border-radius: 10px;
  }
}

/* 超窄屏：输入与确认改为上下排列 */
@media (max-width: 340px) {
  .input-row {
    flex-direction: column;
  }

  .password-input,
  .btn-confirm {
    width: 100%;
  }

  .utils {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 平板 / 大屏留白更舒适 */
@media (min-width: 768px) {
  .page {
    padding: 40px 24px;
  }

  .card {
    max-width: 440px;
    padding: 32px 28px 24px;
  }
}

/* 触屏设备：弱化 hover，强化 active；背景 fixed 在部分手机上异常 */
@media (hover: none) and (pointer: coarse) {
  body {
    background-attachment: scroll;
  }

  .btn-confirm:hover,
  .util-btn:hover {
    filter: none;
    background: #fff;
    border-color: var(--border);
    color: var(--muted);
  }

  .util-btn:hover .util-icon {
    color: #6d8586;
  }

  .btn-confirm:active {
    filter: brightness(0.96);
  }

  .util-btn:active {
    background: var(--teal-soft);
    border-color: #b7d4d4;
    color: var(--teal-deep);
  }

  .util-btn:active .util-icon {
    color: var(--teal);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
