:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1d4ed8;
  --danger: #ef4444;
  --radius: 12px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

body.is-result .page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.is-result .card {
  width: 100%;
}

.page {
  padding: clamp(16px, 2.4vw, 32px);
  padding-top: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-top));
  padding-right: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-right));
  padding-bottom: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-bottom));
  padding-left: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-left));
}

.card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card__header {
  padding: clamp(18px, 2.6vw, 26px) clamp(18px, 2.6vw, 26px) clamp(10px, 2vw, 14px);
  border-top: 4px solid var(--primary);
}

.card__title {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.form {
  padding: 0 clamp(18px, 2.6vw, 26px) clamp(18px, 2.6vw, 26px);
}

.field {
  margin-top: clamp(14px, 2vw, 18px);
}

.label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.required {
  margin-left: 6px;
  color: var(--danger);
}

.control {
  width: 100%;
  min-height: 44px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  background: var(--card-bg);
  outline: none;
}

.control:focus {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.control:focus:not(:focus-visible) {
  outline: none;
}

.upload {
  width: 100%;
}

.upload__box {
  position: relative;
  width: 100%;
  height: clamp(160px, 24vw, 210px);
  padding: clamp(16px, 2.4vw, 22px);
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--card-bg);
  overflow: hidden;
}

.upload__box:focus-within {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.upload__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload__placeholder {
  padding: 6px 0;
  color: var(--muted);
  user-select: none;
}

.upload__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 8px;
}

.upload__title {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}

.upload__hint {
  font-size: 13px;
  color: var(--muted);
}

.upload__preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.upload__fileinfo {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  margin-top: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  margin-top: clamp(18px, 2.2vw, 26px);
}

.submitStatus {
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.submitStatus--success {
  color: var(--primary);
}

.submitStatus--error {
  color: var(--danger);
}

.result {
  padding: clamp(18px, 2.6vw, 26px);
  text-align: center;
  min-height: clamp(240px, 30vh, 360px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result__title {
  margin: 14px 0 6px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
}

.result__message {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.submit {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--primary);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.submit:active {
  transform: translateY(1px);
}

@media (hover: hover) {
  .upload__box:hover {
    border-color: var(--primary);
  }

  .submit:hover {
    filter: brightness(0.95);
  }
}

/* 隐藏补贴类型和姓名字段 */
.field:has(#subsidyType),
.field:has(#fullName) {
  display: none;
}