:root {
  --bg: #f4f6fc;
  --card: #ffffff;
  --text: #202943;
  --muted: #68748e;
  --primary: #4467f2;
  --primary-dark: #2f4fce;
  --jump-a: #7344e8;
  --jump-b: #9364ee;
  --line: #e7ebf5;
  --ok-text: #1c6b45;
  --ok-bg: #e6f6ee;
  --err-text: #a52231;
  --err-bg: #fdecee;
  --warn-bg: #fff5e6;
  --radius: 18px;
  --gap: 14px;
  --pad: 18px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151d;
    --card: #1b1f2a;
    --text: #e8ecf7;
    --muted: #98a3ba;
    --line: #2a3040;
    --ok-bg: #14301f;
    --err-bg: #331318;
    --warn-bg: #33260f;
  }
}

* { box-sizing: border-box }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 96px;
}

/* 顶栏 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--bg) 70%, transparent);
}

.brand { display: flex; align-items: center; gap: 10px }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--primary), var(--jump-a));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2 }
.brand-text strong { font-size: 17px }
.brand-text small { color: var(--muted); font-size: 12px }

.header-link {
  font-size: 13px; color: var(--text); text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 999px;
}

/* 标题区 */
.intro { padding: 10px 2px 16px }
.intro h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.3 }
.intro p { margin: 0; color: var(--muted) }
.status-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 12px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}

/* 卡片 */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: var(--gap);
}
.panel h2, .panel h3 { margin: 0 0 4px; font-size: 16px }
.panel .sub { margin: 0 0 12px; color: var(--muted); font-size: 12px }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px }

/* 公告与规则 */
.notice {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: var(--gap); font-size: 13px;
  display: flex; gap: 8px; cursor: pointer;
}
.notice b { color: var(--primary); flex: none }
.notice.collapsed span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden
}
details.rules { margin-bottom: var(--gap); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px }
details.rules summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none }
details.rules summary::-webkit-details-marker { display: none }
details.rules summary::after { content: "展开"; float: right; color: var(--primary); font-size: 12px }
details.rules[open] summary::after { content: "收起" }
details.rules p { margin: 10px 0 0; font-size: 12px; color: var(--muted) }

/* 表单 */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px }
input[type=text], input[type=number], textarea, select {
  width: 100%; font-size: 16px; font-family: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 12px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px
}

/* 输入框内嵌图标：截图识别入口 */
.input-row { position: relative; margin-bottom: 12px }
.input-row input[type=text] { margin-bottom: 0; padding-right: 54px }
.input-icon {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; min-height: 42px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--primary); border-radius: 10px;
}
.input-icon:hover { background: rgba(83, 45, 183, .08) }
.input-icon svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round
}
.input-icon.busy svg { animation: icon-pulse 1s ease-in-out infinite }
@keyframes icon-pulse { 50% { opacity: .3 } }

button {
  display: block; width: 100%; min-height: 44px;
  font: inherit; font-size: 15px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer;
  padding: 12px 16px; margin: 0;
}
button + button { margin-top: 10px }
button[disabled] { opacity: .55; cursor: not-allowed }
.primary { background: var(--primary); color: #fff }
.primary:hover { background: var(--primary-dark) }
.jump { background: linear-gradient(135deg, var(--jump-a), var(--jump-b)); color: #fff }
.secondary { background: transparent; color: var(--primary); border: 1px solid var(--primary) }
.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--line); font-weight: 500; font-size: 14px }
.inline {
  width: auto; min-height: 44px; padding: 10px 14px; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* 反馈 */
.feedback { margin-top: 12px; font-size: 13px; border-radius: 12px; padding: 10px 12px }
.feedback.ok { color: var(--ok-text); background: var(--ok-bg) }
.feedback.err { color: var(--err-text); background: var(--err-bg) }
.feedback[hidden] { display: none }

/* 列表 */
.entry {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.entry:first-of-type { border-top: none }
.masked { font-size: 15px; letter-spacing: 1px; font-variant-numeric: tabular-nums }
.small { font-size: 12px; color: var(--muted) }
.tag { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px }
.entry button {
  width: auto; min-height: 44px; padding: 10px 14px; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* 码展示：允许长按选择 */
.code-box {
  font-size: 26px; font-weight: 700; letter-spacing: 2px; text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 14px;
  padding: 16px 12px; margin: 14px 0;
  -webkit-user-select: text; user-select: text;
}
.center { text-align: center }
.record { padding: 14px 0; border-top: 1px solid var(--line) }
.record:first-of-type { border-top: none; padding-top: 0 }
.record strong { font-variant-numeric: tabular-nums; letter-spacing: 1px }
.record button { margin-top: 10px }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; margin: 0 auto; max-width: 480px;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 12px; padding: 6px 0; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tab.active { color: var(--primary); font-weight: 600 }
.tab-icon { display: block; font-size: 17px; line-height: 1.2 }

.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0 }
.footer-note a { color: var(--primary); text-decoration: none }

/* 弹层 */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center }
.sheet[hidden] { display: none }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(18, 22, 34, .45) }
.sheet-panel {
  position: relative; width: 100%; max-width: 480px;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
}
.sheet-title { margin: 0 0 8px; font-size: 18px }
.sheet-body p { margin: 0 0 12px; color: var(--muted); font-size: 13px }

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(32, 41, 67, .92); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; z-index: 30; max-width: 86vw;
}
.toast[hidden] { display: none }

.choice { display: flex; gap: 8px; margin-bottom: var(--gap) }
.choice button { background: var(--card); color: var(--muted); border: 1px solid var(--line); font-weight: 500; font-size: 14px }
.choice button.active { color: var(--primary); border-color: var(--primary); background: rgba(68, 103, 242, .08) }

.activity-card { display: flex; gap: 12px; align-items: center; margin: 14px 0 }
.activity-card .icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--jump-a), var(--primary));
}
.activity-card h2 { margin: 0 0 2px; font-size: 16px }
.activity-card p { margin: 0; font-size: 12px; color: var(--muted) }

/* 首屏操作区：提交与领取并排，说明置于操作之后。 */
.activity-intro { position: relative; padding: 10px 76px 18px 2px }
.activity-intro .status-tag { position: absolute; right: 0; top: 10px; margin: 0 }
.action-panel { border-color: rgba(68, 103, 242, .22); box-shadow: 0 8px 24px rgba(32, 41, 67, .04) }
.action-heading { margin-bottom: 14px }
.action-heading h3 { margin: 0 }
.action-heading .tag { white-space: nowrap }
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.action-buttons button { min-width: 0; padding: 12px 8px; margin: 0 }
.action-hint { margin: 10px 0 0; line-height: 1.6 }
.choice button + button { margin-top: 0 }
.toast { width: max-content; text-align: center; border-radius: 14px; pointer-events: none }
@media (max-width: 360px) {
  .shell { padding-left: 12px; padding-right: 12px }
  .action-panel { padding: 14px }
  .activity-intro h1 { font-size: 22px }
}
@media (prefers-reduced-motion: reduce) {
  .input-icon.busy svg { animation: none }
}
