/* 序列号查询页 — Apple 官网级极简认证风格 */

:root {
  --lookup-bg: #0b0b0f;
  --lookup-title: #f5f5f7;
  --lookup-subtitle: #cfcfcf;
  --lookup-text: #f5f5f7;
  --lookup-muted: rgba(245, 245, 247, 0.52);
  --lookup-muted-soft: rgba(245, 245, 247, 0.38);
  --lookup-border: rgba(255, 255, 255, 0.08);
  --lookup-glass: rgba(255, 255, 255, 0.04);
  --lookup-card: rgba(22, 22, 26, 0.72);
  --lookup-card-inner: rgba(255, 255, 255, 0.03);
  --lookup-primary: #0071e3;
  --lookup-primary-hover: #0077ed;
  --lookup-primary-active: #006edb;
  --lookup-focus-ring: rgba(0, 113, 227, 0.28);
  --lookup-shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 32px rgba(0, 0, 0, 0.32);
  --lookup-shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.18);
  --lookup-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --lookup-ease-slow: cubic-bezier(0.16, 1, 0.3, 1);
}

.lookup-page {
  margin: 0;
  min-height: 100vh;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "SF Pro Display",
    "Segoe UI",
    "PingFang SC",
    "Helvetica Neue",
    sans-serif;
  background: var(--lookup-bg);
  color: var(--lookup-text);
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.lookup-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.lookup-wrap > .verify-card {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* —— 语言栏 + 返回 —— */
.lookup-lang-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
  opacity: 0;
  animation: lookupFadeUp 1.2s var(--lookup-ease-slow) 0.05s forwards;
}

.lookup-lang-toolbar-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.lookup-lang-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lookup-lang-toolbar-row .lookup-lang-dropdown {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.lookup-lang-toolbar-row .lookup-lang-trigger,
.lookup-back-btn {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  font-size: clamp(11px, 3.4vw, 15px);
  line-height: 1.2;
}

.lookup-lang-toolbar-row .lookup-lang-trigger {
  padding: 0 12px;
}

.lookup-back-btn {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 76px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--lookup-border);
  border-radius: 10px;
  background: var(--lookup-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--lookup-text);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition:
    border-color 0.2s var(--lookup-ease),
    box-shadow 0.2s var(--lookup-ease),
    background-color 0.2s var(--lookup-ease);
  -webkit-tap-highlight-color: transparent;
}

.lookup-back-btn:hover {
  border-color: rgba(0, 113, 227, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.lookup-back-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.lookup-back-btn:focus-visible {
  outline: none;
  border-color: rgba(0, 113, 227, 0.4);
  box-shadow: 0 0 0 3px var(--lookup-focus-ring);
}

@keyframes lookupBackArrowNudge {
  0%,
  58%,
  100% {
    transform: translateX(0);
    opacity: 0.55;
  }
  62% {
    transform: translateX(-3px);
    opacity: 0.85;
  }
  66% {
    transform: translateX(-7px);
    opacity: 1;
  }
  70% {
    transform: translateX(-3px);
    opacity: 0.85;
  }
  74% {
    transform: translateX(0);
    opacity: 0.55;
  }
}

@keyframes lookupBackArrowNudgeRtl {
  0%,
  58%,
  100% {
    transform: scaleX(-1) translateX(0);
    opacity: 0.55;
  }
  62% {
    transform: scaleX(-1) translateX(3px);
    opacity: 0.85;
  }
  66% {
    transform: scaleX(-1) translateX(7px);
    opacity: 1;
  }
  70% {
    transform: scaleX(-1) translateX(3px);
    opacity: 0.85;
  }
  74% {
    transform: scaleX(-1) translateX(0);
    opacity: 0.55;
  }
}

.lookup-back-btn__icon {
  flex-shrink: 0;
  display: block;
  width: 16px;
  height: 16px;
  margin-inline-start: auto;
  color: var(--lookup-muted);
  pointer-events: none;
  animation: lookupBackArrowNudge 2.4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
  animation-delay: 0.6s;
}

.lookup-back-btn:hover .lookup-back-btn__icon {
  animation-play-state: paused;
}

.lookup-back-btn__text {
  flex-shrink: 0;
  pointer-events: none;
}

[dir="rtl"] .lookup-back-btn {
  flex-direction: row;
  padding: 0 12px 0 8px;
}

[dir="rtl"] .lookup-back-btn__icon {
  margin-inline-start: auto;
  animation-name: lookupBackArrowNudgeRtl;
}

.lookup-lang-toolbar label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--lookup-muted-soft);
  margin-bottom: 8px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lookup-lang-dropdown {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.lookup-lang-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--lookup-border);
  font-weight: 500;
  background: var(--lookup-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--lookup-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-text-size-adjust: 100%;
  cursor: pointer;
  box-shadow: none;
  transition:
    border-color 0.2s var(--lookup-ease),
    box-shadow 0.2s var(--lookup-ease),
    background-color 0.2s var(--lookup-ease);
  -webkit-tap-highlight-color: transparent;
}

.lookup-lang-trigger:focus-visible {
  outline: none;
  border-color: rgba(0, 113, 227, 0.4);
  box-shadow: 0 0 0 3px var(--lookup-focus-ring);
}

.lookup-lang-dropdown.is-open .lookup-lang-trigger,
.lookup-lang-trigger:hover {
  border-color: rgba(0, 113, 227, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.lookup-lang-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  pointer-events: none;
}

.lookup-lang-trigger-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--lookup-muted);
  pointer-events: none;
  animation: lookupLangChevronNudge 2.4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
  animation-delay: 0.9s;
}

.lookup-lang-trigger:hover .lookup-lang-trigger-icon {
  animation-play-state: paused;
}

.lookup-lang-dropdown.is-open .lookup-lang-trigger-icon {
  animation: none;
  transform: rotate(180deg);
  opacity: 1;
}

@keyframes lookupLangChevronNudge {
  0%,
  58%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  62% {
    transform: translateY(3px);
    opacity: 0.85;
  }
  66% {
    transform: translateY(7px);
    opacity: 1;
  }
  70% {
    transform: translateY(3px);
    opacity: 0.85;
  }
  74% {
    transform: translateY(0);
    opacity: 0.55;
  }
}

.lookup-lang-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3100;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.28s var(--lookup-ease);
}

.lookup-lang-overlay.show {
  display: flex;
  opacity: 1;
}

.lookup-lang-modal-panel {
  width: 100%;
  max-width: 420px;
  max-height: min(calc(100dvh - 48px), calc(100svh - 48px), 560px);
  border-radius: 16px;
  border: 1px solid var(--lookup-border);
  background: var(--lookup-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.lookup-lang-list {
  display: flex;
  flex-direction: column;
  padding: 6px;
  overflow-y: auto;
  max-height: min(calc(100dvh - 60px), calc(100svh - 60px), 548px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lookup-lang-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body.lookup-lang-open {
  overflow: hidden;
}

.lookup-lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--lookup-title);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: pointer;
  transition:
    background-color 0.15s var(--lookup-ease),
    color 0.15s var(--lookup-ease);
  -webkit-tap-highlight-color: transparent;
}

.lookup-lang-option-radio {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(136, 136, 136, 0.85);
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
}

.lookup-lang-option-radio::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lookup-primary);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s var(--lookup-ease);
}

.lookup-lang-option.is-selected .lookup-lang-option-radio {
  border-color: var(--lookup-primary);
}

.lookup-lang-option.is-selected .lookup-lang-option-radio::after {
  transform: translate(-50%, -50%) scale(1);
}

.lookup-lang-option-label {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-align: left;
}

.lookup-lang-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--lookup-title);
}

.lookup-lang-option.is-selected {
  background: rgba(0, 113, 227, 0.16);
  color: var(--lookup-title);
}

.lookup-lang-trigger:disabled {
  opacity: 0.65;
  cursor: wait;
}

.lookup-lang-hint {
  font-size: 12px;
  color: var(--lookup-muted-soft);
  margin: 6px 0 0;
}

.lookup-lang-loading {
  font-size: 12px;
  color: var(--lookup-primary);
  margin-top: 6px;
  display: none;
}

.lookup-lang-loading.show {
  display: block;
}

.lookup-lang-current {
  display: none;
}

/* —— 品牌标题区 —— */
.lookup-brand-hero {
  position: relative;
  margin: 10px 0 24px;
  text-align: center;
  overflow: visible;
}

.lookup-brand-glass {
  position: relative;
  padding: 36px 20px 32px;
  border-radius: 18px;
  background: var(--lookup-glass);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border: 1px solid var(--lookup-border);
  box-shadow: var(--lookup-shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lookup-brand-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.lookup-brand-kicker,
.lookup-brand-title {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-size: clamp(18px, 5.2vw, 26px);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.25;
  text-transform: uppercase;
  text-align: center;
  color: var(--lookup-title);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.lookup-brand-kicker {
  margin-bottom: 10px;
  opacity: 0;
  animation: lookupBrandLineIn 1.4s var(--lookup-ease-slow) 0.15s forwards;
}

.lookup-brand-title {
  margin-bottom: 12px;
  opacity: 0;
  animation: lookupBrandLineIn 1.5s var(--lookup-ease-slow) 0.28s forwards;
}

.lookup-brand-subtitle {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-align: center;
  color: var(--lookup-subtitle);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  opacity: 0;
  animation: lookupBrandLineIn 1.6s var(--lookup-ease-slow) 0.42s forwards;
}

.lookup-brand-domain {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 14px 0 0;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
  white-space: normal;
  overflow: visible;
  opacity: 0;
  animation: lookupBrandLineIn 1.7s var(--lookup-ease-slow) 0.52s forwards;
}

/* 中日韩等：取消大写/过大字距，避免译文视觉大小不一致 */
html:lang(zh) .lookup-brand-kicker,
html:lang(zh) .lookup-brand-title,
html:lang(zh) .lookup-brand-subtitle,
html:lang(zh) .verify-card__title,
html:lang(ja) .lookup-brand-kicker,
html:lang(ja) .lookup-brand-title,
html:lang(ja) .lookup-brand-subtitle,
html:lang(ja) .verify-card__title,
html:lang(ko) .lookup-brand-kicker,
html:lang(ko) .lookup-brand-title,
html:lang(ko) .lookup-brand-subtitle,
html:lang(ko) .verify-card__title {
  letter-spacing: 0;
  text-transform: none;
  word-break: normal;
  hyphens: manual;
}

@keyframes lookupBrandLineIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lookupFadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— 验证卡片 —— */
.verify-card {
  background: var(--lookup-card);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border-radius: 18px;
  padding: 28px 20px 26px;
  border: 1px solid var(--lookup-border);
  box-shadow: var(--lookup-shadow-card);
  text-align: center;
  overflow: visible;
  opacity: 0;
  animation: lookupFadeUp 1.4s var(--lookup-ease-slow) 0.55s forwards;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.verify-card__title {
  display: inline-block;
  max-width: 100%;
  margin: 0 auto 6px;
  padding: 4px 10px 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
  text-align: center;
  color: var(--lookup-title);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.verify-card__hint {
  text-align: center;
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--lookup-muted);
  letter-spacing: -0.01em;
}

.serial-search-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  width: 100%;
}

.serial-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.serial-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(0, 113, 227, 0.55);
  background: var(--lookup-card-inner);
  box-shadow: 0 0 0 3px var(--lookup-focus-ring);
  transition:
    border-color 0.2s var(--lookup-ease),
    box-shadow 0.2s var(--lookup-ease),
    background-color 0.2s var(--lookup-ease);
}

.serial-input-wrap:focus-within {
  border-color: rgba(0, 113, 227, 0.75);
  background: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 0 0 3px rgba(0, 113, 227, 0.38),
    0 0 16px rgba(0, 113, 227, 0.18);
}

.serial-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 14px 10px 14px 14px;
  border: none;
  border-radius: 12px 0 0 12px;
  background: transparent;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--lookup-text);
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serial-input:focus {
  outline: none;
}

.serial-input::placeholder {
  color: rgba(245, 245, 247, 0.36);
  letter-spacing: 0;
  font-size: clamp(11px, 3vw, 14px);
  line-height: 1.25;
  opacity: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-scan {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--lookup-border);
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: var(--lookup-primary);
  cursor: pointer;
  transition: background-color 0.2s var(--lookup-ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-scan:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-scan:active {
  background: rgba(255, 255, 255, 0.1);
}

.btn-scan:focus-visible {
  outline: 2px solid var(--lookup-primary);
  outline-offset: -2px;
}

.btn-scan svg {
  width: 22px;
  height: 22px;
  display: block;
}

.btn-serial {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: var(--lookup-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--lookup-shadow-btn);
  transition: background-color 0.2s var(--lookup-ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-serial:hover {
  background: var(--lookup-primary-hover);
}

.btn-serial:active {
  background: var(--lookup-primary-active);
}

.btn-serial:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-serial:focus-visible {
  outline: 2px solid var(--lookup-primary);
  outline-offset: 2px;
}

[dir="rtl"] .lookup-lang-toolbar-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .serial-input {
  border-radius: 0 12px 12px 0;
  padding: 14px 14px 14px 10px;
}

[dir="rtl"] .btn-scan {
  border-left: none;
  border-right: 1px solid var(--lookup-border);
  border-radius: 12px 0 0 12px;
}

@media (min-width: 520px) {
  .lookup-brand-glass {
    padding: 42px 28px 36px;
  }

  .lookup-brand-kicker,
  .lookup-brand-title {
    font-size: 26px;
    letter-spacing: 0.05em;
  }

  .lookup-brand-kicker {
    margin-bottom: 12px;
  }

  .lookup-brand-title {
    margin-bottom: 14px;
  }

  .lookup-brand-subtitle {
    font-size: 13px;
    max-width: 100%;
  }

  .lookup-brand-domain {
    font-size: 11px;
    margin-top: 16px;
    letter-spacing: 0.12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lookup-lang-toolbar,
  .lookup-brand-kicker,
  .lookup-brand-title,
  .lookup-brand-subtitle,
  .lookup-brand-domain,
  .verify-card {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .serial-input-wrap,
  .btn-serial,
  .btn-scan,
  .lookup-lang-trigger,
  .lookup-back-btn,
  .lookup-back-btn__icon,
  .lookup-lang-overlay,
  .lookup-lang-modal-panel {
    transition: none;
  }

  .lookup-back-btn__icon,
  .lookup-lang-trigger-icon {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .lookup-lang-dropdown.is-open .lookup-lang-trigger-icon {
    transform: rotate(180deg);
  }
}

/* 布局锁定 LTR：切换阿拉伯语/希伯来语时不翻转工具栏、返回键、输入框结构 */
html,
body.lookup-page {
  direction: ltr;
}

.lookup-lang-toolbar-row,
.lookup-lang-toolbar {
  flex-direction: row !important;
}

.lookup-back-btn {
  flex-direction: row !important;
}

.lookup-back-btn__icon {
  margin-inline-start: 0 !important;
  transform: none !important;
  animation-name: lookupBackArrowNudge !important;
}

html:lang(ar) .serial-input,
html:lang(he) .serial-input,
html:lang(fa) .serial-input,
html:lang(ur) .serial-input {
  direction: rtl;
  text-align: right;
}
