/* ==========================================================================
   Tokpoll — 设计系统
   参考苹果官网的克制、留白与质感：中性底色、细腻层级、轻投影、平滑缓动。
   ========================================================================== */

:root {
  /* 颜色 —— 浅色 */
  --bg:            #ffffff;
  --bg-sunken:     #f5f5f7;
  --bg-elevated:   #ffffff;
  --surface-hover: #fafafa;
  --text:          #1d1d1f;
  --text-2:        #6e6e73;
  --text-3:        #86868b;
  --hairline:      rgba(0, 0, 0, .10);
  --hairline-soft: rgba(0, 0, 0, .06);
  --accent:        #0071e3;
  --accent-hover:  #0077ed;
  --accent-soft:   rgba(0, 113, 227, .10);
  --accent-text:   #ffffff;
  --success:       #1d9f52;
  --danger:        #d7263d;
  --track:         rgba(0, 0, 0, .07);

  /* 阴影 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .05);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, .07), 0 12px 32px rgba(0, 0, 0, .07);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .16);

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* 缓动 —— 苹果常用的 ease-in-out 曲线 */
  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);

  --maxw: 760px;
  --nav-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #000000;
    --bg-sunken:     #0a0a0c;
    --bg-elevated:   #1c1c1e;
    --surface-hover: #232325;
    --text:          #f5f5f7;
    --text-2:        #a1a1a6;
    --text-3:        #86868b;
    --hairline:      rgba(255, 255, 255, .14);
    --hairline-soft: rgba(255, 255, 255, .08);
    --accent:        #2997ff;
    --accent-hover:  #47a6ff;
    --accent-soft:   rgba(41, 151, 255, .16);
    --accent-text:   #ffffff;
    --success:       #32d74b;
    --danger:        #ff6961;
    --track:         rgba(255, 255, 255, .12);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, .6);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, .7);
  }
}

/* -------------------------------------------------------------- 基础 */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-sunken);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
               "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

::selection { background: var(--accent-soft); }

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* -------------------------------------------------------------- 导航 */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-soft);
}

.nav__brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}
.nav__brand:hover { text-decoration: none; opacity: .7; }

.nav__links { display: flex; align-items: center; gap: 4px; }

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: var(--text-2);
  padding: 6px 11px;
  border-radius: 980px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav__link:hover { background: var(--hairline-soft); color: var(--text); text-decoration: none; }
.nav__link--active { color: var(--text); background: var(--hairline-soft); }

/* -------------------------------------------------------------- 布局 */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.page { padding-bottom: 120px; }

/* -------------------------------------------------------------- 主题头部 */

.hero {
  text-align: center;
  padding: 44px 0 28px;
}

.hero__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 10px;
}

.hero__title {
  margin: 0 auto;
  max-width: 20em;
  font-size: clamp(23px, 3.6vw, 32px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.018em;
}

.hero__sub {
  margin: 12px auto 0;
  max-width: 32em;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-2);
}

.hero__desc {
  margin: 14px auto 0;
  max-width: 32em;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-3);
}

.hero__meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: 980px;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-soft);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.chip--accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip--warn   { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: transparent; }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------------- 卡片列表 */

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 16px 17px;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform .28s var(--ease-out), box-shadow .28s var(--ease-out),
              border-color .2s var(--ease), background .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card:active { transform: translateY(0) scale(.994); }
.card--voted { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.card--locked { cursor: default; }
.card--locked:hover { transform: none; box-shadow: var(--shadow-1); }
.card--new { animation: cardIn .5s var(--spring) both; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.card__body { flex: 1 1 auto; min-width: 0; }

.card__rank {
  flex: 0 0 auto;
  width: 22px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.card__rank--top { color: var(--accent); }

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 550;
  line-height: 1.5;
  letter-spacing: -.004em;
}

.card__detail {
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.card__foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-3);
}

/* 占比条贴在卡片底边，不会被误看成标题下划线 */
.card__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--hairline-soft);
}
.card__bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  opacity: .3;
  border-radius: 0 2px 2px 0;
  transition: width .6s var(--ease-out), opacity .3s var(--ease);
}
.card--voted .card__bar > i { opacity: 1; }
.card__pct {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.card--voted .card__pct { color: var(--accent); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag[data-color="gray"]   { background: var(--track); color: var(--text-2); }
.tag[data-color="green"]  { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.tag[data-color="orange"] { background: rgba(245, 158, 11, .16); color: #b45309; }
.tag[data-color="purple"] { background: rgba(139, 92, 246, .16); color: #7c3aed; }
.tag[data-color="pink"]   { background: rgba(236, 72, 153, .16); color: #db2777; }
@media (prefers-color-scheme: dark) {
  .tag[data-color="orange"] { color: #fbbf24; }
  .tag[data-color="purple"] { color: #c4b5fd; }
  .tag[data-color="pink"]   { color: #f9a8d4; }
}

.badge-new {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.badge-pin {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 980px; font-size: 11px; font-weight: 600;
  background: var(--track); color: var(--text-2);
}

/* 投票按钮 —— 上箭头 + 票数，投过之后变实心蓝 */
.vote {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 13px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  transition: transform .2s var(--spring), background .25s var(--ease),
              border-color .25s var(--ease), color .25s var(--ease);
}
.vote:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.vote:active:not(:disabled) { transform: scale(.92); }
.vote:disabled { cursor: default; opacity: .5; }
.vote--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  opacity: 1;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 32%, transparent);
}
.vote--on:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}

.vote__mark {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-bottom: -1px;
  opacity: .55;
  transition: transform .25s var(--spring), opacity .2s var(--ease);
}
.vote:hover:not(:disabled) .vote__mark { opacity: 1; transform: translateY(-1.5px); }
.vote--on .vote__mark { opacity: 1; }
.vote__num {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

/* 票数变化时轻轻弹一下 */
@keyframes votePop {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.vote--bump { animation: votePop .46s var(--spring); }

/* 往期结果页用的横条 */
.bar {
  margin-top: 12px;
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  width: 0;
  transition: width .7s var(--ease-out);
}
.bar__fill--muted { background: var(--text-3); }

/* -------------------------------------------------------------- 区块标题 */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.012em;
}
.section-head .muted { font-size: 12.5px; color: var(--text-3); }

/* -------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 980px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s var(--ease), transform .18s var(--spring), opacity .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--hairline);
}
.btn--ghost:hover { background: var(--accent-soft); }

.btn--quiet {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--hairline);
}
.btn--quiet:hover { background: var(--surface-hover); }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: var(--danger); filter: brightness(1.08); }

.btn--sm { height: 32px; padding: 0 14px; font-size: 14px; }
.btn--block { width: 100%; }

/* -------------------------------------------------------------- 提问入口 */

.submit-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--hairline-soft);
}
/* 顶部一层渐隐，让内容滚到底时过渡得自然一些 */
.submit-dock::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 100%;
  height: 28px;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg-sunken) 85%, transparent), transparent);
  pointer-events: none;
}
.submit-dock__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.submit-dock__hint {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--text-3);
  min-width: 0;
}

/* -------------------------------------------------------------- 弹出层 */

.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.sheet-mask.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 61;
  width: min(560px, 100%);
  transform: translate(-50%, 100%);
  background: var(--bg-elevated);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-pop);
  padding: 8px 24px calc(24px + env(safe-area-inset-bottom));
  transition: transform .38s var(--ease-out);
  max-height: 88vh;
  overflow-y: auto;
}
.sheet.is-open { transform: translate(-50%, 0); }

@media (min-width: 600px) {
  .sheet { bottom: 50%; border-radius: var(--r-xl); transform: translate(-50%, calc(50% + 24px)); opacity: 0; }
  .sheet.is-open { transform: translate(-50%, 50%); opacity: 1; }
}

.sheet__grip {
  width: 36px; height: 5px; border-radius: 3px;
  background: var(--track);
  margin: 6px auto 14px;
}
@media (min-width: 600px) { .sheet__grip { display: none; } }

.sheet__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.012em;
}
.sheet__desc { margin: 0 0 18px; font-size: 14px; color: var(--text-2); }

.field { margin-bottom: 16px; }
.field__label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--text-2); margin-bottom: 7px;
}
.input, .textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-sunken);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 16px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
  outline: none;
}
.input:focus, .textarea:focus {
  border-color: var(--accent);
  background: var(--bg);
}
.textarea { resize: vertical; min-height: 78px; line-height: 1.55; }
.counter { font-size: 12px; color: var(--text-3); }
.counter--over { color: var(--danger); }

/* -------------------------------------------------------------- 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 80;
  transform: translate(-50%, 16px);
  max-width: calc(100% - 40px);
  padding: 11px 20px;
  border-radius: 980px;
  background: rgba(28, 28, 30, .94);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease), transform .28s var(--ease-out);
  backdrop-filter: blur(10px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--err { background: rgba(215, 38, 61, .95); }
@media (prefers-color-scheme: dark) {
  .toast { background: rgba(240, 240, 245, .95); color: #1d1d1f; }
  .toast--err { background: rgba(255, 105, 97, .95); color: #1d1d1f; }
}

/* -------------------------------------------------------------- 空态 / 骨架 */

.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty__icon { font-size: 34px; opacity: .5; }
.empty__title { margin: 14px 0 4px; font-size: 17px; color: var(--text-2); font-weight: 500; }
.empty__text { margin: 0; font-size: 14px; }

.skeleton {
  height: 92px;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--bg-elevated) 30%, var(--surface-hover) 50%, var(--bg-elevated) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -40% 0; } }

/* -------------------------------------------------------------- 统计 */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
}
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  padding: 16px 16px 14px;
  text-align: center;
}
.stat__num { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.stat__label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* -------------------------------------------------------------- 往期 */

.archive-card {
  display: block;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  color: var(--text);
  transition: transform .28s var(--ease-out), box-shadow .28s var(--ease-out);
}
.archive-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); text-decoration: none; }
.archive-card__title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; }
.archive-card__sub { font-size: 14px; color: var(--text-2); margin: 0 0 12px; }
.archive-card__meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }

/* -------------------------------------------------------------- 结果排行 */

.result {
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.result:last-child { border-bottom: 0; }
.result__head { display: flex; align-items: baseline; gap: 10px; }
.result__rank { width: 24px; font-size: 13px; font-weight: 600; color: var(--text-3); flex: 0 0 auto; }
.result__title { flex: 1 1 auto; font-size: 16px; font-weight: 500; }
.result__num { font-size: 15px; font-weight: 600; flex: 0 0 auto; }
.result__pct { font-size: 12px; color: var(--text-3); width: 44px; text-align: right; flex: 0 0 auto; }

/* -------------------------------------------------------------- 页脚 */

.foot {
  padding: 40px 0 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
}
.foot__brand {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: .6;
}

/* -------------------------------------------------------------- 移动端 */

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }

  .hero { padding: 30px 0 22px; }
  .hero__eyebrow { font-size: 11.5px; margin-bottom: 8px; }
  .hero__title { font-size: 22px; line-height: 1.35; letter-spacing: -.012em; }
  .hero__sub { font-size: 14.5px; margin-top: 10px; }
  .hero__desc { font-size: 13px; margin-top: 12px; }
  .hero__meta { margin-top: 14px; gap: 6px; }
  .chip { height: 27px; padding: 0 11px; font-size: 12px; }

  .section-head { margin: 24px 0 10px; }
  .section-head h2 { font-size: 17px; }
  .section-head .muted { font-size: 11.5px; }

  .list { gap: 8px; }
  .card { padding: 14px 13px 15px; gap: 11px; border-radius: 15px; }
  .card__rank { display: none; }
  .card__title { font-size: 15.5px; line-height: 1.5; }
  .card__detail { font-size: 13px; }
  .card__foot { margin-top: 8px; }

  .vote { width: 46px; height: 46px; border-radius: 12px; }
  .vote__num { font-size: 16px; }
  .vote__mark { width: 13px; height: 13px; }

  .sheet { padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); }
  .sheet__title { font-size: 19px; }
  .submit-dock__hint { display: none; }
  .submit-dock__inner .btn { width: 100%; }
  .stat__num { font-size: 23px; }
}

/* 窄屏机型（iPhone SE 等）再收一点 */
@media (max-width: 360px) {
  .hero__title { font-size: 20px; }
  .card { padding: 13px 11px 14px; gap: 9px; }
  .card__title { font-size: 15px; }
  .vote { width: 43px; height: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
