/* =========================================================
   亚马逊订单退款查询 · 移动端样式
   设计基准：iPhone 375×812 / Android 360×800，最大宽度 480px 居中
   ========================================================= */

:root {
  --c-ink: #0F1111;          /* 正文黑 */
  --c-ink-2: #565959;        /* 次级文字 */
  --c-ink-3: #8B8E8E;        /* 弱化文字 */
  --c-navy: #232F3E;         /* Amazon 深蓝（导航） */
  --c-navy-2: #37475A;
  --c-orange: #FF9900;       /* Amazon 橙（主按钮） */
  --c-orange-dark: #E88A00;
  --c-orange-soft: #FFF4E5;
  --c-link: #007185;         /* Amazon 链接蓝绿 */
  --c-bg: #EAEDED;           /* 页面底灰 */
  --c-surface: #FFFFFF;
  --c-line: #E3E6E6;
  --c-line-2: #D5D9D9;
  --c-success: #067D62;
  --c-success-bg: #E7F4F0;
  --c-danger: #C40000;
  --c-danger-bg: #FFF1F1;
  --c-warn: #B7791F;
  --c-warn-bg: #FFF6E5;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(15, 17, 17, .08);
  --shadow-2: 0 4px 14px rgba(15, 17, 17, .10);
  --shadow-cta: 0 4px 12px rgba(255, 153, 0, .35);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须优先于组件自身的 display（例如 .field__error 的 flex） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--c-bg);
}

body {
  font-family: var(--font);
  color: var(--c-ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------------- 应用外壳 ---------------- */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--c-bg);
  overflow: hidden;
}

/* ---------------- 屏幕切换 ---------------- */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--c-bg);
}

.screen.is-active {
  display: flex;
  animation: screen-in .26s cubic-bezier(.22, .61, .36, 1) both;
}

.screen--center { justify-content: center; }

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

.screen__body {
  flex: 1;
  padding: 16px 16px calc(24px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen__body--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: calc(24px + var(--safe-top));
}

/* ---------------- 头部 Hero ---------------- */
.hero {
  padding: calc(28px + var(--safe-top)) 20px 24px;
  background: linear-gradient(160deg, var(--c-navy) 0%, #1A2433 100%);
  color: #fff;
  border-radius: 0 0 22px 22px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 18px;
}

.brand__text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.8px;
  line-height: 1;
}

.brand__smile {
  width: 62px;
  height: 8px;
  margin-top: 1px;
  border-bottom: 3px solid var(--c-orange);
  border-radius: 0 0 60% 60%;
  position: relative;
}

.brand__smile::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 0 solid transparent;
  border-bottom: 4px solid var(--c-orange);
  transform: rotate(-24deg);
}

.hero__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}

.hero__sub {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #C7CDD4;
}

/* ---------------- 卡片 / 表单 ---------------- */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-1);
}

.form { margin-top: -18px; position: relative; z-index: 2; }

.field { display: block; position: relative; }

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink-2);
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  height: 50px;
  padding: 0 40px 0 14px;
  font-size: 16px; /* ≥16px 防止 iOS 自动放大 */
  font-family: inherit;
  color: var(--c-ink);
  background: #fff;
  border: 1.5px solid var(--c-line-2);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  appearance: none;
}

.field__input::placeholder { color: #A6A9A9; }

.field__input:focus {
  border-color: var(--c-orange);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, .18);
}

.field__input.is-invalid {
  border-color: var(--c-danger);
  background: var(--c-danger-bg);
}

.field__input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(196, 0, 0, .14);
}

.field__suffix {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 40px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--c-ink-3);
  cursor: pointer;
}

.field__hint {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--c-ink-3);
}

.field__error {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--c-danger);
  display: flex;
  gap: 5px;
}

.field__error::before { content: "⚠"; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 48px;              /* 移动端点击热区 */
  padding: 12px 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: transform .1s, background .18s, box-shadow .18s, opacity .18s;
  user-select: none;
}

.btn--block { width: 100%; }

.btn:active { transform: scale(.98); }

.btn--primary {
  margin-top: 18px;
  color: #111;
  background: linear-gradient(180deg, #FFB84D 0%, var(--c-orange) 100%);
  border-color: var(--c-orange-dark);
  box-shadow: var(--shadow-cta);
}

.btn--primary:active { background: var(--c-orange-dark); }

.btn--outline {
  margin-top: 18px;
  color: var(--c-ink);
  background: #fff;
  border-color: var(--c-line-2);
  box-shadow: var(--shadow-1);
}

.btn--ghost {
  margin-top: 22px;
  color: #C7CDD4;
  background: transparent;
  border-color: transparent;
  font-weight: 500;
}

.btn--link {
  margin-top: 4px;
  color: var(--c-link);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  min-height: 40px;
}

.btn[disabled] { opacity: .6; pointer-events: none; }

.btn__label { display: inline-block; }

.secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--c-ink-3);
}

.secure__icon { font-size: 12px; }

/* ---------------- Legal footnote ---------------- */
.legal {
  margin-top: 18px;
  padding: 0 4px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--c-ink-3);
  text-align: center;
}

/* ---------------- 加载（转圈） ---------------- */
.spinner {
  position: relative;
  width: 76px;
  height: 76px;
  margin-bottom: 26px;
}

.spinner__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(35, 47, 62, .10);
  border-top-color: var(--c-orange);
  border-right-color: var(--c-navy);
  animation: spin .9s linear infinite;
}

.spinner__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--c-orange);
  animation: pulse 1.1s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { transform: scale(.7); opacity: .5; }
  50%      { transform: scale(1);  opacity: 1; }
}

.loading__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--c-navy);
}

.loading__stage {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--c-ink-2);
  min-height: 20px;
}

.steps {
  width: 100%;
  max-width: 280px;
  margin-top: 26px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.steps__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--c-ink-3);
  transition: color .2s;
}

.steps__icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--c-line-2);
  position: relative;
  transition: border-color .2s, background .2s;
}

.steps__item.is-active { color: var(--c-navy); font-weight: 600; }
.steps__item.is-active .steps__icon {
  border-color: var(--c-orange);
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}

.steps__item.is-done { color: var(--c-success); }
.steps__item.is-done .steps__icon {
  border-color: var(--c-success);
  background: var(--c-success);
}

.steps__item.is-done .steps__icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: var(--c-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__back {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.topbar__back:active { background: rgba(255, 255, 255, .12); }

.topbar__title {
  flex: 1;
  text-align: center;
  font-size: 16.5px;
  font-weight: 600;
}

.topbar__spacer { width: 40px; flex: 0 0 auto; }

/* ---------------- 结果 ---------------- */
.account-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}

.account-chip__label { font-size: 12.5px; color: var(--c-ink-3); }

.account-chip__value {
  font-size: 14px;
  color: var(--c-ink);
  word-break: break-all;
  text-align: right;
}

.result__summary {
  margin: 0 2px 12px;
  font-size: 13.5px;
  color: var(--c-ink-2);
}

.result__summary b { color: var(--c-danger); }

.orders { display: grid; gap: 14px; }

.order {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: var(--shadow-2);
  animation: screen-in .3s ease both;
}

.order__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--c-line);
}

.order__head-label {
  display: block;
  font-size: 11px;
  color: var(--c-ink-3);
}

.order__head-id {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}

.pill {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.pill--warn { color: var(--c-warn); background: var(--c-warn-bg); }
.pill--ok { color: var(--c-success); background: var(--c-success-bg); }
.pill--bad { color: var(--c-danger); background: var(--c-danger-bg); }

.order__reason {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 12px;
  background: var(--c-orange-soft);
  border-left: 3px solid var(--c-orange);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.6;
  color: #7A4B00;
}

.order__reason-icon { flex: 0 0 auto; }

.order__meta {
  margin-top: 13px;
  display: grid;
  gap: 8px;
}

.order__meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.order__meta-row dt { color: var(--c-ink-3); }
.order__meta-row dd { color: var(--c-ink); font-variant-numeric: tabular-nums; }

.order__note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--c-ink-3);
}

.order__cta { margin-top: 16px; }

.result__tips {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--c-ink-3);
}

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 34px 20px;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  animation: screen-in .3s ease both;
}

.empty__icon { font-size: 42px; line-height: 1; }

.empty__word {
  margin-top: 6px;
  font-size: 38px;
  font-weight: 700;
  color: var(--c-line-2);
  letter-spacing: 1px;
  line-height: 1.15;
}

.empty__title {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink);
}

.empty__desc {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--c-ink-2);
}

/* ---------------- 错误 ---------------- */
.error__icon { font-size: 42px; line-height: 1; }

.error__title {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 700;
  color: var(--c-navy);
}

.error__desc {
  margin-top: 8px;
  max-width: 300px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--c-ink-2);
}

#screen-error .btn { max-width: 300px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  max-width: 84vw;
  padding: 11px 18px;
  background: rgba(15, 17, 17, .88);
  color: #fff;
  font-size: 13.5px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 99;
}

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

/* ---------------- 大屏（平板/桌面预览） ---------------- */
@media (min-width: 481px) {
  body { padding: 0; }
  .app {
    min-height: 100vh;
    box-shadow: 0 0 0 1px rgba(15, 17, 17, .06), 0 12px 40px rgba(15, 17, 17, .12);
  }
}

/* ---------------- 无障碍 / 减少动效 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 2px;
}
