/* ============================================================
   心有灵犀 · 网页版
   风格：紫粉渐变 / 玻璃拟态 / 休闲游戏
   ============================================================ */

:root {
  --bg:        #16102b;
  --bg-2:      #1e1642;
  --card:      rgba(45, 34, 82, 0.62);
  --card-bd:   rgba(255, 255, 255, 0.12);

  --purple:    #8b5cf6;
  --purple-lt: #a78bfa;
  --pink:      #ec4899;
  --pink-lt:   #f472b6;
  --cyan:      #22d3ee;
  --green:     #10b981;
  --amber:     #fbbf24;
  --red:       #ef4444;

  /* 马卡龙点缀色（来自参考图）*/
  --candy-pink:  #f898d0;
  --candy-green: #98d8a0;
  --candy-orange:#f8c060;
  --candy-blue:  #a8d8f0;
  --candy-purple:#c8b8f0;

  --text:      #f5f3ff;
  --text-2:    #c4b5fd;
  --text-3:    #8b7fb8;

  --r:   18px;
  --r-s: 12px;

  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

/* 背景光斑 */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
.b1 {
  width: 70vw; height: 70vw;
  top: -25vw; left: -20vw;
  background: radial-gradient(circle, rgba(139,92,246,.55), transparent 70%);
}
.b2 {
  width: 65vw; height: 65vw;
  bottom: -20vw; right: -18vw;
  background: radial-gradient(circle, rgba(236,72,153,.42), transparent 70%);
}

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 16px clamp(16px, 4vw, 28px);
  max-width: 640px; margin: 0 auto;
}

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

.brand-ic {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--purple), var(--pink));
  border-radius: 12px;
  box-shadow: 0 8px 22px -8px rgba(139,92,246,.8);
}
.brand-ic svg { width: 22px; height: 22px; }

.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt strong { font-size: 18px; font-weight: 900; letter-spacing: .04em; }
.brand-txt small { font-size: 11px; color: var(--text-3); }

.room-badge {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 100px;
  background: rgba(139,92,246,.2);
  border: 1px solid rgba(167,139,250,.35);
}
.room-badge[hidden] { display: none; }
.rb-label { font-size: 11px; color: var(--text-3); }
.rb-num {
  font-size: 15px; font-weight: 700;
  letter-spacing: .1em;
  color: var(--purple-lt);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   主容器
   ============================================================ */
.app {
  position: relative; z-index: 10;
  width: min(560px, 100% - 32px);
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }

/* ============================================================
   首页
   ============================================================ */
.hero { text-align: center; padding: 10px 0 6px; }
.hero h1 {
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1.25;
  background: linear-gradient(120deg, #fff, var(--purple-lt) 50%, var(--pink-lt));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}
.hero h1 span { -webkit-text-fill-color: var(--pink-lt); }
.hero p { font-size: 14px; color: var(--text-2); }

/* 卡片 */
.card {
  padding: 20px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--card-bd);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px -24px rgba(0,0,0,.8);
}

.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700;
  color: var(--text-2);
  letter-spacing: .06em;
  margin-bottom: 14px;
}
.card-title svg { width: 16px; height: 16px; color: var(--amber); }

/* 表单 */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 7px;
  letter-spacing: .04em;
}
.field-label em { font-style: normal; opacity: .7; font-size: 11.5px; }

input, textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: rgba(0,0,0,.3);
  border: 1.5px solid rgba(255,255,255,.13);
  border-radius: var(--r-s);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none;
}
textarea { resize: vertical; line-height: 1.7; font-size: 15px; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
input:focus, textarea:focus {
  border-color: var(--purple);
  background: rgba(0,0,0,.45);
  box-shadow: 0 0 0 3px rgba(139,92,246,.2);
}
input:disabled { opacity: .5; }

/* Tab */
.tab-row {
  display: flex; gap: 6px;
  padding: 4px;
  background: rgba(0,0,0,.28);
  border-radius: 100px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  padding: 10px;
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 100px;
  cursor: pointer;
  transition: all .24s;
}
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 6px 18px -8px rgba(139,92,246,.9);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 分段选择 */
.seg-row { display: flex; gap: 8px; }
.seg {
  flex: 1;
  padding: 11px 8px;
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  color: var(--text-3);
  background: rgba(0,0,0,.26);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
}
.seg.active {
  color: #fff;
  border-color: var(--purple);
  background: rgba(139,92,246,.28);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 15px 22px;
  font-family: var(--font);
  font-size: 16px; font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  border: 0;
  border-radius: var(--r-s);
  cursor: pointer;
  transition: transform .18s, box-shadow .22s, filter .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 10px 28px -10px rgba(139,92,246,.85);
}
.btn-success {
  background: linear-gradient(135deg, var(--green), #059669);
  box-shadow: 0 10px 28px -10px rgba(16,185,129,.8);
}
.btn-danger {
  background: rgba(239,68,68,.18);
  border: 1.5px solid rgba(239,68,68,.45);
  color: #fca5a5;
  box-shadow: none;
}
.btn-ghost {
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.16);
  box-shadow: none;
}
.btn-sm { width: auto; padding: 14px 26px; font-size: 15px; }
.btn-block { width: 100%; margin-top: 4px; }

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

/* 提示 */
.hint {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.65;
}
.hint svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--cyan); }

/* 规则 */
.rules {
  padding: 20px;
  border-radius: var(--r);
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.07);
}
.rules h3 {
  font-size: 14px; font-weight: 700;
  color: var(--text-2);
  margin-bottom: 12px;
  letter-spacing: .06em;
}
.rules ol { padding-left: 20px; }
.rules li {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.95;
}
.rules li b { color: var(--pink-lt); }

/* ============================================================
   游戏页
   ============================================================ */
.room-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.room-label { font-size: 11.5px; color: var(--text-3); letter-spacing: .08em; }
.room-value {
  font-size: 26px; font-weight: 900;
  letter-spacing: .16em;
  color: var(--purple-lt);
  font-variant-numeric: tabular-nums;
}

.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 17px;
  font-family: var(--font);
  font-size: 13.5px; font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: 0;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(139,92,246,.85);
  transition: transform .18s;
  white-space: nowrap;
}
.share-btn svg { width: 15px; height: 15px; }
.share-btn:active { transform: scale(.96); }

.player-row { margin-bottom: 14px; }
.player-label {
  display: block;
  font-size: 11.5px; color: var(--text-3);
  letter-spacing: .08em;
  margin-bottom: 9px;
}
.player-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px;
  font-size: 13px;
  color: var(--text);
  background: rgba(139,92,246,.2);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 100px;
}
.chip.me {
  background: linear-gradient(135deg, rgba(139,92,246,.5), rgba(236,72,153,.4));
  border-color: var(--pink-lt);
  font-weight: 600;
}
.chip .crown { font-size: 11px; }

.room-meta {
  display: flex; gap: 20px;
  font-size: 13px;
  color: var(--text-3);
}
.room-meta b { color: var(--text-2); font-weight: 600; }

/* 倒计时 */
.countdown {
  padding: 22px;
  border-radius: var(--r);
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.cd-waiting { font-size: 15px; color: var(--text-3); }
.cd-waiting[hidden] { display: none; }
.cd-running[hidden] { display: none; }

.cd-ring {
  position: relative;
  width: 150px; height: 150px;
  margin: 0 auto 12px;
}
.cd-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.cd-bg {
  fill: none;
  stroke: rgba(255,255,255,.1);
  stroke-width: 8;
}
.cd-fg {
  fill: none;
  stroke: url(#none);
  stroke: var(--pink);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .9s linear, stroke .3s;
}
.cd-num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1;
}
.cd-num b {
  font-size: 46px; font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cd-num span { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.cd-hint { font-size: 13px; color: var(--text-2); }

/* 提交 */
.submit-row { display: flex; gap: 10px; }
.submit-row input { flex: 1; }
.submit-tip {
  margin-top: 12px;
  padding: 11px 15px;
  font-size: 13.5px;
  border-radius: 10px;
  background: rgba(16,185,129,.16);
  border: 1px solid rgba(16,185,129,.36);
  color: #6ee7b7;
  text-align: center;
}
.submit-tip[hidden] { display: none; }
.submit-tip.warn {
  background: rgba(251,191,36,.14);
  border-color: rgba(251,191,36,.36);
  color: #fcd34d;
}

/* 上一轮 / 揭晓 */
.last-words, .reveal-list {
  display: flex; flex-direction: column; gap: 8px;
}
.word-line {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  font-size: 14.5px;
  border-radius: 10px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.07);
}
.word-line .w-name { color: var(--text-3); font-size: 13px; flex: none; }
.word-line .w-word { color: var(--text); font-weight: 600; }
.word-line.same {
  background: rgba(16,185,129,.16);
  border-color: rgba(16,185,129,.4);
}
.word-line.same .w-word { color: #6ee7b7; }

.empty-tip {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* 揭晓卡 */
.reveal-card {
  border-color: rgba(236,72,153,.4);
  background: linear-gradient(150deg, rgba(139,92,246,.22), rgba(236,72,153,.16));
}
.reveal-verdict {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .06em;
  margin-bottom: 16px;
  line-height: 1.4;
}
.reveal-verdict.win { color: #6ee7b7; }
.reveal-verdict.lose { color: #fcd34d; }
.reveal-verdict small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
  margin-top: 6px;
  letter-spacing: .02em;
}

/* 排行榜 */
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0,0,0,.26);
  border: 1px solid rgba(255,255,255,.07);
  transition: all .3s;
}
.score-item.top {
  background: linear-gradient(135deg, rgba(251,191,36,.2), rgba(236,72,153,.14));
  border-color: rgba(251,191,36,.42);
}
.score-rank {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  color: var(--text-3);
  background: rgba(255,255,255,.08);
  border-radius: 8px;
}
.score-item.top .score-rank {
  color: #1a1033;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}
.score-name { flex: 1; font-size: 14.5px; }
.score-val {
  font-size: 17px; font-weight: 900;
  color: var(--pink-lt);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  z-index: 999;
  max-width: calc(100vw - 48px);
  padding: 13px 24px;
  font-size: 14.5px;
  text-align: center;
  color: #fff;
  background: rgba(45, 34, 82, 0.96);
  border: 1px solid rgba(167,139,250,.4);
  border-radius: 100px;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px -16px rgba(0,0,0,.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s, transform .28s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(239,68,68,.55); }
.toast.ok { border-color: rgba(16,185,129,.55); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 400px) {
  .app { width: calc(100% - 24px); }
  .card { padding: 17px; }
  .cd-ring { width: 130px; height: 130px; }
  .cd-num b { font-size: 40px; }
  .room-value { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   可爱装饰层（星星 + 爱心飘浮）
   ============================================================ */
.deco-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* 星星 */
.deco-star {
  position: absolute;
  color: #fff;
  font-size: 14px;
  opacity: 0.55;
  animation: twinkle 3.2s ease-in-out infinite;
}
.s1 { top: 8%;  left: 12%;  font-size: 11px; animation-delay: 0s; }
.s2 { top: 18%; right: 14%; font-size: 15px; animation-delay: .6s; }
.s3 { top: 42%; left: 7%;   font-size: 10px; animation-delay: 1.2s; }
.s4 { top: 62%; right: 9%;  font-size: 13px; animation-delay: 1.8s; }
.s5 { top: 76%; left: 16%;  font-size: 11px; animation-delay: 2.4s; }
.s6 { top: 88%; right: 20%; font-size: 14px; animation-delay: 3.0s; }

@keyframes twinkle {
  0%, 100% { opacity: .22; transform: scale(.85); }
  50%      { opacity: .75; transform: scale(1.15); }
}

/* 爱心 */
.deco-heart {
  position: absolute;
  width: 22px; height: 22px;
  fill: #f898d0;
  opacity: .5;
  animation: floatUp 7s ease-in-out infinite;
}
.h1 { top: 26%; left: 18%; width: 18px; animation-delay: 0s; opacity: .45; }
.h2 { top: 55%; right: 16%; width: 26px; animation-delay: 2.2s; opacity: .38; }
.h3 { top: 82%; left: 22%; width: 16px; animation-delay: 4.1s; opacity: .5; }

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(-8deg); opacity: .25; }
  50%  { transform: translateY(-18px) rotate(8deg); opacity: .6; }
  100% { transform: translateY(0) rotate(-8deg); opacity: .25; }
}

/* 确保内容在主层之上 */
.topbar, .app { position: relative; z-index: 10; }

/* ============================================================
   可爱元素优化
   ============================================================ */

/* 玩家彩色头像 */

.chip-avatar {
  width: 24px; height: 24px;
  flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #1a1033;
  border-radius: 50%;
  box-shadow: 0 2px 6px -2px rgba(0,0,0,.5);
}
.chip.me .chip-avatar {
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 2px 6px -2px rgba(0,0,0,.5);
}

/* 主按钮加可爱描边光晕 */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(100deg, transparent 40%, rgba(255,255,255,.28) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: btnShine 3.5s ease-in-out infinite;
}
@keyframes btnShine {
  0%, 100% { transform: translateX(-100%); }
  50%      { transform: translateX(100%); }
}

/* 卡片圆角更大、更柔和 */
.card {
  border-radius: 22px;
}

/* 房间号加可爱高亮 */
.room-value {
  position: relative;
  display: inline-block;
}
.room-value::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 6px;
  background: linear-gradient(90deg, var(--candy-pink), var(--candy-orange));
  border-radius: 3px;
  opacity: .55;
}

/* 倒计时数字加渐变 */
.cd-num b {
  background: linear-gradient(135deg, #fff, var(--candy-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 排行榜第一名加皇冠光效 */
.score-item.top {
  position: relative;
}
.score-item.top::after {
  content: "👑";
  position: absolute;
  right: 14px; top: -10px;
  font-size: 18px;
  filter: drop-shadow(0 2px 6px rgba(251,191,36,.8));
}
.score-item.top .score-val { margin-right: 26px; }

/* 输入框聚焦时加粉边 */
input:focus, textarea:focus {
  border-color: var(--candy-pink);
  box-shadow: 0 0 0 3px rgba(248,152,208,.22);
}

/* 分段按钮选中用马卡龙色 */
.seg.active {
  border-color: var(--candy-orange);
  background: rgba(248,192,96,.24);
  color: #fff;
}

/* Toast 加可爱描边 */
.toast {
  border-radius: 100px;
  border-width: 2px;
}
.toast.ok { border-color: var(--candy-green); }
.toast.err { border-color: #f87171; }

