:root {
  --primary: #ff6b35;
  --primary-dark: #e85520;
  --primary-soft: #fff0e8;
  --wx-green: #07c160;
  --wx-green-soft: #e9f9f0;
  --bg: #fff8f2;
  --surface: #ffffff;
  --ink: #1f2329;
  --ink-secondary: #646a73;
  --ink-muted: #8f959e;
  --border: #f0e4da;
  --shadow-sm: 0 2px 10px rgba(255, 107, 53, 0.08);
  --shadow-md: 0 8px 24px rgba(31, 35, 41, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  line-height: 1.45;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 14px calc(92px + var(--safe-bottom));
  position: relative;
}

/* 顶部卡片 */
.hero-header {
  background: linear-gradient(135deg, #ff7a45 0%, #ff5722 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(255, 107, 53, 0.25);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(4px);
}

.brand-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  max-width: 150px;
}

.profile-pill:active {
  transform: scale(0.96);
}

.profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.pill-arrow {
  opacity: 0.85;
  font-size: 11px;
}

.room-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.room-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffe082;
}

.room-switch {
  background: rgba(255, 255, 255, 0.24);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.auth-badge {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.16);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 餐次切换 */
.meal-tabs {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--surface);
  padding: 5px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.meal-tab {
  border: none;
  background: transparent;
  padding: 9px 6px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.meal-tab.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.22);
}

/* 实时战况卡片 */
.summary-card {
  margin-top: 12px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 15px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-main {
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.summary-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wx-green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.2);
}

.live-dot.offline {
  background: #ffb300;
  box-shadow: none;
}

.summary-winner {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-muted);
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.mini-btn {
  border: none;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mini-btn:active {
  transform: scale(0.96);
}

.mini-btn-warm {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.mini-btn-wx {
  background: var(--wx-green-soft);
  color: #069c4d;
}

/* 地点筛选栏 */
.location-filter-wrap {
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.location-filter-wrap::-webkit-scrollbar {
  display: none;
}

.location-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 1px;
  width: max-content;
}

.loc-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.loc-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(255, 107, 53, 0.25);
}

.loc-badge {
  font-size: 10px;
  background: rgba(255, 107, 53, 0.14);
  color: var(--primary-dark);
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 700;
}

.loc-chip.active .loc-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

/* 投票列表区 */
.vote-section {
  margin-top: 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.section-tip {
  font-size: 12px;
  color: var(--ink-muted);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease;
}

.option-card:active {
  transform: scale(0.985);
}

.option-card.voted {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.16);
}

.option-progress {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.12), rgba(255, 107, 53, 0.05));
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.option-card.voted .option-progress {
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.19), rgba(255, 107, 53, 0.07));
}

.option-content {
  position: relative;
  z-index: 1;
}

.option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.option-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.option-emoji {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff5ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.option-info {
  min-width: 0;
  flex: 1;
}

.option-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.option-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.option-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #f5f6f8;
  color: var(--ink-secondary);
}

.leader-crown {
  font-size: 13px;
}

.option-note {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.vote-pill {
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 107, 53, 0.35);
  background: #ffffff;
  color: var(--primary-dark);
}

.option-card.voted .vote-pill {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.vote-stats {
  font-size: 11px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.voters-row {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.voter-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--ink-secondary);
}

/* 底部悬浮操作栏 */
.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 10px 14px calc(12px + var(--safe-bottom));
  background: rgba(255, 248, 242, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.25fr 0.95fr 1fr;
  gap: 8px;
  z-index: 20;
}

.bottom-btn {
  border: none;
  border-radius: 14px;
  padding: 11px 10px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.bottom-btn:active {
  transform: scale(0.97);
}

.bottom-btn-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
}

.bottom-btn-primary {
  background: linear-gradient(135deg, #ff7a45 0%, #ff5722 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(255, 107, 53, 0.3);
}

/* 底部弹窗 */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 28, 0.48);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop[hidden] {
  display: none;
}

.sheet-panel {
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(28px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  margin: 0 auto 10px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sheet-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  color: var(--ink-secondary);
  cursor: pointer;
}

.sheet-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.req {
  color: var(--primary);
}

.text-input {
  width: 100%;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  background: #fafafa;
}

.text-input:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.emoji-item {
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: #f8f8f9;
  font-size: 21px;
  cursor: pointer;
}

.emoji-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.tag-picker,
.quick-rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item,
.quick-chip {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: var(--ink-secondary);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.tag-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-secondary);
  margin: 4px 0;
}

.submit-btn {
  margin-top: 6px;
  width: 100%;
  border: none;
  border-radius: 13px;
  padding: 13px;
  background: linear-gradient(135deg, #ff7a45 0%, #ff5722 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-outline {
  background: #fff5ee;
  color: var(--primary-dark);
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.btn-wx {
  background: var(--wx-green);
  color: #ffffff;
}

.btn-danger-outline {
  background: #fff5f5;
  color: #d93025;
  border: 1px solid rgba(217, 48, 37, 0.25);
}

/* 投票结果榜单 */
.result-rank-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 14px;
}

.result-rank-item {
  background: #fffaf6;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 13px;
}

.result-rank-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.result-rank-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.result-rank-loc {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 1px 6px;
  border-radius: 6px;
}

.result-rank-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.result-rank-voters {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.result-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 随机抽取 */
.roller-box {
  margin: 12px 0 18px;
  padding: 24px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff6f0 0%, #fffaf7 100%);
  border: 1px solid var(--border);
  text-align: center;
}

.roller-emoji {
  font-size: 52px;
  line-height: 1.1;
}

.roller-name {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.roller-note {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-muted);
}

.roller-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

/* 历史记录 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

.history-item {
  background: #fffaf6;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-date {
  font-size: 12px;
  color: var(--ink-muted);
}

.history-winner {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 700;
}

.history-votes {
  font-size: 12px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 28px 12px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* 微信分享引导 */
.wx-share-guide {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 80;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.wx-share-guide[hidden] {
  display: none;
}

.wx-guide-arrow {
  font-size: 52px;
  color: #ffffff;
  margin-right: 12px;
  line-height: 1;
}

.wx-guide-card {
  margin-top: 12px;
  width: 100%;
  max-width: 340px;
  background: #ffffff;
  border-radius: 18px;
  padding: 18px;
  color: var(--ink);
  align-self: center;
  text-align: center;
}

.wx-guide-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--wx-green);
}

.wx-guide-card p {
  font-size: 14px;
  color: var(--ink-secondary);
  margin: 10px 0 16px;
}

.wx-guide-btn {
  border: none;
  background: var(--wx-green);
  color: #ffffff;
  padding: 10px 26px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

/* 骨架屏 */
.skeleton-card {
  height: 76px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #f6ece4 25%, #fdf7f2 50%, #f6ece4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translate(-50%, -12px);
  background: rgba(31, 35, 41, 0.9);
  color: #ffffff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 100;
  max-width: 88vw;
  text-align: center;
}

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