/* ============ 家务大作战 v1 · 样式 ============ */
:root {
  --bg: #FBF6F0;
  --card: #FFFFFF;
  --ink: #221E1A;
  --ink-2: #8C8377;
  --ink-3: #B4ACA2;
  --line: #F0E7DD;
  --primary: #FF6B4A;
  --primary-dark: #E85A3B;
  --primary-soft: #FFEDE7;
  --mint: #2E9E7B;
  --mint-soft: #E6F5EF;
  --p1: #FF6B4A;
  --p1-soft: #FFEDE7;
  --p2: #2E9E7B;
  --p2-soft: #E6F5EF;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(80, 55, 35, .05), 0 12px 30px -18px rgba(80, 55, 35, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input { font-family: inherit; }
h1, h2, h3, p { margin: 0; }

#app { max-width: 520px; margin: 0 auto; }

.screen { display: none; min-height: 100vh; padding: 0 20px; }
.screen.is-active { display: block; animation: fadeUp .28s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 首页 ---------------- */
#screen-home { display: none; }
#screen-home.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px 40px;
}
.home-wrap { width: 100%; max-width: 360px; text-align: center; }

.logo-mark {
  width: 68px; height: 68px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: var(--primary-soft);
  border-radius: 22px;
}

.home-head h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.6px;
}

.home-sub {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

.home-form { margin-top: 34px; text-align: left; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin: 0 0 8px 4px;
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .2px;
}
.field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 74, .1);
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: #F2EAE1;
  border-radius: 15px;
}
.seg-item {
  flex: 1;
  height: 44px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 11px;
  transition: all .18s;
}
.seg-item.is-on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(90, 60, 40, .1);
}

.btn {
  height: 54px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 15px;
  transition: transform .12s, opacity .18s, background .18s;
}
.btn:active { transform: scale(.975); }
.btn-lg { width: 100%; }
.btn-full { width: 100%; }
.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 20px -10px rgba(255, 107, 74, .9);
}
.btn-primary:active { background: var(--primary-dark); }
.btn-primary[disabled] { opacity: .5; }
.btn-ghost {
  color: var(--ink-2);
  background: #F4EDE5;
}

.home-tip {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.6;
}
.version {
  margin-top: 26px;
  font-size: 11px;
  color: #CFC6BA;
  letter-spacing: 1px;
}

/* ---------------- 房间 ---------------- */
#screen-room { padding-top: max(16px, env(safe-area-inset-top)); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 16px;
}

.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 12px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.room-chip b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.room-chip em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
}
.chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background .2s;
}
.chip-dot.on { background: var(--mint); box-shadow: 0 0 0 3px rgba(46, 158, 123, .14); }
.chip-dot.off { background: #E0A33E; }

.icon-btn {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 999px;
  background: #F3ECE4;
}

.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.player {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  transition: border-color .2s;
}
.player.me { border-color: rgba(255, 107, 74, .28); }
.player.is-empty { background: #F7F1EA; box-shadow: none; border-style: dashed; border-color: #E7DCD0; }

.player-top { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border-radius: 12px;
  background: var(--p1-soft);
}
.player[data-slot="1"] .avatar { background: var(--p2-soft); }
.player.is-empty .avatar { background: #EFE6DB; }

.p-name {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-status { font-size: 11px; color: var(--ink-3); }
.p-status.online { color: var(--mint); }

.p-stats {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.p-stats b { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.p-stats i { font-style: normal; }

.player.is-empty .p-name { color: var(--ink-2); }
.player.is-empty .p-stats { display: none; }

/* ---------------- 任务面板 ---------------- */
.board {
  margin-bottom: 14px;
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 10px;
}
.board-head h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .3px;
}
.board-head .count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.link-btn { font-size: 12.5px; color: var(--ink-3); }

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

.task {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeUp .25s ease both;
}
.t-row { display: flex; align-items: center; gap: 12px; }
.t-foot { display: flex; gap: 8px; justify-content: flex-end; }
.task.is-done { background: #FCFAF7; box-shadow: none; }
.task.is-done .t-title { color: var(--ink-3); text-decoration: line-through; }

.thumb {
  flex: 0 0 auto;
  width: 54px; height: 54px;
  border-radius: 13px;
  background: #F5EEE6 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.t-body { flex: 1; min-width: 0; }
.t-title {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}
.t-place { color: var(--ink-2); }
.t-rotate { color: #B07A2A; }
.t-meta .who { display: inline-flex; align-items: center; gap: 4px; }
.t-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--p1); }
.t-meta .dot[data-slot="1"] { background: var(--p2); }

.pill {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 11px;
  background: #F5EEE6;
  color: var(--ink-2);
  white-space: nowrap;
  transition: transform .12s, background .16s;
}
.pill:active { transform: scale(.94); }
.pill-rps { background: var(--primary-soft); color: var(--primary-dark); }
.pill-dice { background: #FDF2DE; color: #A9741A; }
.pill-done { background: var(--mint-soft); color: var(--mint); }
.pill-more { width: 34px; padding: 0; font-size: 15px; color: var(--ink-3); }

.empty {
  padding: 34px 20px 38px;
  text-align: center;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-emoji { font-size: 30px; opacity: .85; }
.empty p { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.empty span { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }

.bottom-space { height: 110px; }

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 54px;
  padding: 0 24px;
  font-size: 15.5px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 10px 26px -10px rgba(255, 107, 74, .85);
  transition: transform .14s;
  z-index: 30;
}
.fab:active { transform: translateX(-50%) scale(.96); }
.fab span { font-size: 19px; font-weight: 400; margin-top: -2px; }

.input-row { display: flex; gap: 8px; margin-bottom: 18px; }
.input-row input {
  flex: 1;
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input-row input::placeholder { color: var(--ink-3); }
.input-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 74, .1);
}
.mic-btn {
  flex: 0 0 54px;
  height: 54px;
  font-size: 19px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  transition: background .16s, border-color .16s, transform .12s;
}
.mic-btn:active { transform: scale(.94); }
.mic-btn.listening {
  background: var(--primary-soft);
  border-color: var(--primary);
  animation: pulse 1s ease infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }

.mini-label { margin: 0 0 8px 2px; font-size: 12.5px; color: var(--ink-3); }
.mini-label span { color: #C9C0B4; font-size: 11.5px; }

.place-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.place-chip {
  height: 34px;
  padding: 0 13px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  transition: color .16s, background .16s, border-color .16s;
}
.place-chip.is-on {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: rgba(255, 107, 74, .38);
  font-weight: 600;
}

.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.tpl-item {
  height: 40px;
  padding: 0 4px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #F5EEE6;
  border-radius: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform .12s, background .16s;
}
.tpl-item:active { transform: scale(.94); background: var(--primary-soft); }

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 0;
  font-size: 12px;
  color: var(--ink-3);
}
.group-head i { font-style: normal; font-size: 11px; }

.pill-veto { background: #F3EEFB; color: #6E4AC7; }

.player.has-veto .player-top { padding-right: 40px; }
.veto-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: #6E4AC7;
  background: #F3EEFB;
  border-radius: 999px;
}

/* ---------------- 弹层 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal.is-open { display: flex; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(34, 26, 20, .38);
  backdrop-filter: blur(2px);
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  animation: slideUp .26s cubic-bezier(.22, .9, .3, 1) both;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.sheet-bar {
  width: 38px; height: 4px;
  margin: 0 auto 16px;
  background: #E4D9CC;
  border-radius: 99px;
}
.sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.sheet-sub { margin-top: 4px; font-size: 13px; color: var(--ink-3); margin-bottom: 16px; }

.photo-picker {
  position: relative;
  display: block;
  width: 100%;
  height: 148px;
  margin-bottom: 16px;
  overflow: hidden;
  background: #fff;
  border: 1.5px dashed #E3D7C9;
  border-radius: var(--radius);
  cursor: pointer;
}
.photo-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.photo-empty .camera { font-size: 26px; }
.photo-empty b { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.photo-empty i {
  font-style: normal;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.photo-picker img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-clear {
  position: absolute;
  right: 10px; bottom: 10px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  color: #fff;
  background: rgba(34, 26, 20, .6);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 20px;
}
.quick-tags button {
  height: 32px;
  padding: 0 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #F4ECE3;
  border-radius: 999px;
}
.quick-tags button:active { background: var(--primary-soft); color: var(--primary-dark); }

.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }

.sheet-menu { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.menu-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.menu-items button {
  height: 52px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  background: #fff;
  border-radius: 14px;
}
.menu-items button.danger { color: #D9534F; }

/* ---------------- 对战 ---------------- */
.sheet-battle { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.battle-kicker {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 2px;
}
.battle-task {
  margin: 6px 0 4px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.4px;
}

.duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 22px 0 6px;
}
.duel-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.duel-hand {
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  transition: background .2s;
}
.duel-hand.picked { background: #F3EBE2; }
.duel-hand.empty { color: #D9CFC3; font-size: 30px; background: #F7F1EA; box-shadow: none; }
.duel-hand.rolling { animation: shake .45s ease infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(4deg) scale(1.04); }
}
.duel-hand.pop { animation: pop .4s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes pop {
  0% { transform: scale(.4); opacity: .2; }
  100% { transform: scale(1); opacity: 1; }
}
.duel-name { font-size: 12.5px; color: var(--ink-2); font-weight: 500; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-name.win { color: var(--primary-dark); font-weight: 700; }
.vs {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 1px;
  padding-bottom: 22px;
}

.battle-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0 12px;
}
.rps-btn {
  flex: 1;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  transition: transform .12s, border-color .16s, background .16s;
}
.rps-btn span { font-size: 30px; line-height: 1; }
.rps-btn i { font-style: normal; font-size: 12px; color: var(--ink-2); }
.rps-btn:active { transform: scale(.95); }
.rps-btn[disabled] { opacity: .45; }
.rps-btn.is-mine { border-color: var(--primary); background: var(--primary-soft); opacity: 1; }

.dice-btn {
  flex: 1;
  height: 64px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 16px;
  box-shadow: 0 8px 20px -10px rgba(255, 107, 74, .9);
}
.dice-btn[disabled] { opacity: .45; box-shadow: none; }

.battle-hint {
  height: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.battle-result {
  margin-top: 8px;
  padding: 14px;
  text-align: center;
  border-radius: 16px;
  background: #fff;
  animation: fadeUp .3s ease both;
}
.battle-result b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.battle-result span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.battle-result.is-tie { background: #FDF6E9; }
.battle-result.is-win { background: var(--primary-soft); }
.battle-result.is-win b { color: var(--primary-dark); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  top: 28px;
  transform: translate(-50%, -14px);
  max-width: 82vw;
  padding: 11px 20px;
  font-size: 13.5px;
  color: #fff;
  background: rgba(34, 26, 20, .9);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  .sheet { border-radius: 26px; margin-bottom: 16px; max-height: 86vh; }
  .modal { align-items: center; }
}

/* ---------------- v3 · 云同步 / 安装提示 ---------------- */
.cloud-row { margin-top: 16px; text-align: center; }

.cloud-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.cloud-chip:active { transform: scale(.97); }

.install-btn {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 14px;
}

.install-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #FFF4E0;
  border-radius: 14px;
}
.install-tip b { display: block; font-size: 13.5px; }
.install-tip span { display: block; margin-top: 2px; font-size: 11.5px; color: #9A7B45; line-height: 1.5; }
.install-tip button {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  color: #8A6A32;
  background: #FFE8C2;
  border-radius: 999px;
}

.steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }

.step-link {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
  text-decoration: none;
  text-align: left;
  background: #F7F1EA;
  border-radius: 11px;
}

.sheet-note {
  min-height: 18px;
  margin: 10px 2px 4px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--primary-dark);
}

/* ---------------- v3 · 改名字 / 换头像 ---------------- */
.player.me { cursor: pointer; }
.p-edit {
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .2px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.avatar-chip {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #F7F1EA;
  border-radius: 12px;
  border: 1.5px solid transparent;
  transition: transform .12s, background .16s, border-color .16s;
}
.avatar-chip:active { transform: scale(.92); }
.avatar-chip.is-on {
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* ================= v3.1 · 玻璃质感 ================= */
:root {
  --glass: rgba(255, 255, 255, .56);
  --glass-soft: rgba(255, 255, 255, .34);
  --glass-line: rgba(255, 255, 255, .78);
  --glass-shadow: 0 14px 34px -24px rgba(90, 60, 40, .55);
  --blur: blur(20px) saturate(165%);
}

/* ---------- 底色：两团慢慢飘的光 ---------- */
html { background: #FBF6F0; }
body { background: transparent; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(42% 32% at 8% 2%, rgba(255, 122, 84, .22), transparent 72%),
    radial-gradient(38% 30% at 96% 10%, rgba(255, 190, 110, .20), transparent 74%),
    radial-gradient(46% 36% at 84% 98%, rgba(46, 158, 123, .16), transparent 72%),
    radial-gradient(52% 40% at 2% 92%, rgba(255, 122, 84, .13), transparent 74%),
    #FBF6F0;
}

body::after {
  content: '';
  position: fixed;
  inset: -30%;
  z-index: -1;
  background:
    radial-gradient(closest-side, rgba(255, 140, 105, .26), transparent 70%) 22% 26% / 44% 44% no-repeat,
    radial-gradient(closest-side, rgba(110, 185, 165, .22), transparent 70%) 80% 70% / 40% 40% no-repeat;
  filter: blur(26px);
  animation: aurora 28s ease-in-out infinite alternate;
  will-change: transform;
  pointer-events: none;
}
@keyframes aurora {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.07); }
}

/* ---------- 玻璃卡片 ---------- */
.player,
.task,
.empty,
.room-chip,
.cloud-chip,
.field input,
.avatar-chip,
.photo-picker,
.duel-hand,
.place-chip {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.player.is-empty {
  background: var(--glass-soft);
  border: 1.5px dashed rgba(255, 255, 255, .95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.player.me {
  border-color: rgba(255, 107, 74, .38);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .9),
              0 0 0 3px rgba(255, 107, 74, .08);
}
.player .avatar {
  background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(255, 226, 214, .9));
  box-shadow: inset 0 1px 0 #fff, 0 6px 14px -10px rgba(200, 110, 80, .8);
}
.player[data-slot="1"] .avatar {
  background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(214, 240, 231, .95));
}

.task.is-done { background: rgba(255, 255, 255, .38); }
.task.is-done .thumb { opacity: .7; }

.thumb {
  background-color: rgba(255, 255, 255, .6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.empty { background: rgba(255, 255, 255, .48); }

/* ---------- 顶栏 / 分段 / 输入 ---------- */
.room-chip { box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .9); }
.icon-btn { background: rgba(255, 255, 255, .55); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }

.seg {
  background: rgba(255, 255, 255, .34);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, .7);
}
.seg-item.is-on {
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 4px 12px -8px rgba(90, 60, 40, .6), inset 0 1px 0 #fff;
}

.field input { background: rgba(255, 255, 255, .62); }
.field input:focus { background: rgba(255, 255, 255, .9); }

/* ---------- 按钮 ---------- */
.pill {
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}
.pill-rps { background: rgba(255, 107, 74, .14); border-color: rgba(255, 255, 255, .75); }
.pill-dice { background: rgba(253, 226, 176, .5); border-color: rgba(255, 255, 255, .75); }
.pill-done { background: rgba(46, 158, 123, .14); border-color: rgba(255, 255, 255, .75); }
.pill-veto { background: rgba(90, 120, 220, .12); color: #4356A8; }

.btn-ghost {
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(255, 255, 255, .75);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.btn-primary {
  background: linear-gradient(180deg, #FF7E5E, #FF5F3C);
  box-shadow: 0 12px 26px -12px rgba(255, 107, 74, .95), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.fab {
  background: linear-gradient(180deg, #FF7E5E, #FF5A37);
  box-shadow: 0 14px 30px -12px rgba(255, 107, 74, .9), inset 0 1px 0 rgba(255, 255, 255, .4),
              0 0 0 1px rgba(255, 255, 255, .35) inset;
}

/* ---------- 弹层：磨砂 ---------- */
.modal-mask {
  background: rgba(46, 32, 24, .3);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
}
.sheet {
  background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 249, 244, .93));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 -24px 60px -34px rgba(80, 50, 30, .55);
}
.sheet-bar { background: rgba(180, 172, 162, .45); }

.menu-items button {
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .8);
}

.tpl-item {
  background: rgba(255, 255, 255, .45);
  border: 1px solid rgba(255, 255, 255, .7);
}
.tpl-item:active { background: rgba(255, 107, 74, .18); }

.place-chip { background: rgba(255, 255, 255, .5); }
.place-chip.is-on {
  background: rgba(255, 107, 74, .16);
  border-color: rgba(255, 107, 74, .45);
}
.avatar-chip { background: rgba(255, 255, 255, .48); }
.avatar-chip.is-on {
  background: rgba(255, 107, 74, .16);
  border-color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 3px rgba(255, 107, 74, .1);
}

.install-tip { background: rgba(255, 244, 224, .72); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid rgba(255, 255, 255, .8); }
.install-btn { background: rgba(255, 107, 74, .14); border: 1px solid rgba(255, 255, 255, .8); }
.step-link { background: rgba(255, 255, 255, .55); border: 1px solid rgba(255, 255, 255, .8); }

/* ---------- 对战 ---------- */
.duel-hand {
  background: rgba(255, 255, 255, .6);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .95);
}
.duel-hand.picked { background: rgba(255, 255, 255, .85); }
.duel-hand.empty { background: rgba(255, 255, 255, .3); box-shadow: none; }
.battle-result.is-tie { background: rgba(255, 244, 220, .75); }
.battle-result.is-win { background: rgba(255, 107, 74, .13); }
.btn-ghost.btn-full { margin-top: 8px; }

/* ---------- 首页 ---------- */
.logo-mark {
  background: linear-gradient(160deg, #FFE6DD, #FFF4EE);
  box-shadow: inset 0 1px 0 #fff, 0 14px 30px -18px rgba(255, 107, 74, .95);
}

.toast {
  background: rgba(32, 24, 18, .78);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, .6);
}

/* ---------- 不支持毛玻璃时 ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .player, .task, .empty, .room-chip, .cloud-chip, .field input,
  .avatar-chip, .photo-picker, .duel-hand, .place-chip,
  .sheet, .pill, .btn-ghost, .tpl-item, .menu-items button { background: rgba(255, 255, 255, .94); }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
}

/* ================= v3.2 · 夜间模式 ================= */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12100F;
  --card: #1E1917;
  --ink: #F5EEE7;
  --ink-2: #A79C91;
  --ink-3: #7A7066;
  --line: #2C2421;
  --primary: #FF7857;
  --primary-dark: #FF8F72;
  --primary-soft: rgba(255, 120, 87, .16);
  --mint: #4ECBA0;
  --mint-soft: rgba(78, 203, 160, .14);
  --glass: rgba(46, 38, 34, .62);
  --glass-soft: rgba(255, 255, 255, .045);
  --glass-line: rgba(255, 255, 255, .10);
  --glass-shadow: 0 16px 36px -26px rgba(0, 0, 0, .95);
}

html[data-theme="dark"] { background: #12100F; }

html[data-theme="dark"] body::before {
  background:
    radial-gradient(42% 32% at 8% 2%, rgba(255, 110, 70, .20), transparent 72%),
    radial-gradient(38% 30% at 96% 10%, rgba(255, 176, 96, .10), transparent 74%),
    radial-gradient(46% 36% at 84% 98%, rgba(46, 158, 123, .14), transparent 72%),
    radial-gradient(52% 40% at 2% 92%, rgba(255, 110, 70, .10), transparent 74%),
    #12100F;
}
html[data-theme="dark"] body::after { opacity: .5; }

/* 卡片里的浅色部分 */
html[data-theme="dark"] .player .avatar,
html[data-theme="dark"] .player[data-slot="1"] .avatar {
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
html[data-theme="dark"] .player.is-empty { border-color: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .player.me {
  border-color: rgba(255, 120, 87, .5);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 3px rgba(255, 120, 87, .1);
}
html[data-theme="dark"] .thumb {
  background-color: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
html[data-theme="dark"] .task.is-done { background: rgba(255, 255, 255, .035); }
html[data-theme="dark"] .empty { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .empty-emoji { opacity: .6; }

/* 控件 */
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .theme-btn {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .12);
}
html[data-theme="dark"] .seg {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .09);
}
html[data-theme="dark"] .seg-item.is-on {
  background: rgba(255, 255, 255, .14);
  color: var(--ink);
  box-shadow: 0 4px 12px -8px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .12);
}
html[data-theme="dark"] .field input {
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
}
html[data-theme="dark"] .field input::placeholder { color: var(--ink-3); }
html[data-theme="dark"] .field input:focus { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .pill {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .1);
  box-shadow: none;
}
html[data-theme="dark"] .pill-rps { background: rgba(255, 120, 87, .18); color: #FFB29C; }
html[data-theme="dark"] .pill-dice { background: rgba(255, 190, 110, .16); color: #F2C07A; }
html[data-theme="dark"] .pill-done { background: rgba(78, 203, 160, .16); color: #7EDCB8; }
html[data-theme="dark"] .pill-veto { background: rgba(120, 145, 240, .16); color: #A9B8FF; }
html[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .1);
  color: var(--ink-2);
}
html[data-theme="dark"] .tpl-item,
html[data-theme="dark"] .place-chip,
html[data-theme="dark"] .avatar-chip { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .place-chip.is-on,
html[data-theme="dark"] .avatar-chip.is-on {
  background: rgba(255, 120, 87, .2);
  border-color: rgba(255, 120, 87, .55);
}
html[data-theme="dark"] .photo-picker { border-color: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .photo-clear { background: rgba(30, 25, 23, .8); color: var(--ink); }

/* 弹层 */
html[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, .5); }
html[data-theme="dark"] .sheet {
  background: linear-gradient(180deg, rgba(34, 28, 25, .95), rgba(24, 20, 18, .96));
  border-top-color: rgba(255, 255, 255, .1);
  box-shadow: 0 -24px 60px -34px rgba(0, 0, 0, .9);
}
html[data-theme="dark"] .sheet-bar { background: rgba(255, 255, 255, .18); }
html[data-theme="dark"] .menu-items button { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .install-tip {
  background: rgba(255, 226, 170, .1);
  border-color: rgba(255, 255, 255, .1);
  color: #E8C88F;
}
html[data-theme="dark"] .install-tip span,
html[data-theme="dark"] .install-tip b { color: #E8C88F; }
html[data-theme="dark"] .install-btn { background: rgba(255, 120, 87, .18); color: #FFB29C; }
html[data-theme="dark"] .step-link { background: rgba(255, 255, 255, .07); }
html[data-theme="dark"] .cloud-chip { color: var(--ink-2); }

/* 对战 */
html[data-theme="dark"] .duel-hand { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .duel-hand.picked { background: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .duel-hand.empty { background: rgba(255, 255, 255, .03); color: rgba(255, 255, 255, .25); }
html[data-theme="dark"] .battle-result.is-win { background: rgba(255, 120, 87, .16); }
html[data-theme="dark"] .battle-result.is-tie { background: rgba(255, 226, 170, .12); }

html[data-theme="dark"] .toast { background: rgba(245, 238, 231, .92); color: #17130F; }
html[data-theme="dark"] .logo-mark {
  background: linear-gradient(160deg, rgba(255, 120, 87, .28), rgba(255, 120, 87, .12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 14px 30px -18px rgba(255, 120, 87, .8);
}

/* 开关按钮 */
.screen { position: relative; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 999px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition: transform .14s;
  z-index: 5;
}
.theme-btn:active { transform: scale(.92); }
.theme-btn-sm {
  position: static;
  width: 36px; height: 36px;
  font-size: 15px;
}

/* 夜间：免死金牌小徽章别发白 */
html[data-theme="dark"] .veto-badge {
  color: #C2B2FF;
  background: rgba(140, 120, 235, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
