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

.hidden { display: none !important; }

:root {
  --bg0: #131c42;
  --bg1: #0a0f2a;
  --bg2: #070b1e;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: #070b1e;
  color: #eaf2ff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(4, 6, 18, 0.55) 100%);
  z-index: 2;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 20;
}

/* ---------- top bar ---------- */
#topArea {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}

#topArea.hidden { display: none; }

#topBar {
  pointer-events: auto;
  width: 100%;
  max-width: 980px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#playerBox {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(16, 22, 54, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

#playerBox b {
  font-size: 15px;
  font-weight: 800;
  color: #ffe9a8;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-av {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, #2a3a6e, #151f44);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bcd2ff;
  font-weight: 700;
  font-size: 13px;
}

.player-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: linear-gradient(180deg, #55b8ff 0%, #7b5cff 55%, #c64bff 100%);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(60, 30, 120, 0.9), 0 5px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.mini-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 4px 0 rgba(60, 30, 120, 0.9), 0 0 14px rgba(90, 160, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mini-btn:active { transform: translateY(1px); }

.net-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}

.net-badge.on { color: #8dffc2; border-color: rgba(90, 255, 170, 0.5); background: rgba(40, 160, 90, 0.22); }
.net-badge.off { color: #8fa2c8; border-color: rgba(150, 170, 210, 0.35); background: rgba(40, 50, 90, 0.3); }

#hudWrap {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 20px;
  background: rgba(16, 22, 54, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", "Segoe Print", "Microsoft YaHei", cursive;
  min-width: 0;
}

#hud .panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 3px 9px;
}

#hud .p-label {
  font-family: "Comic Sans MS", "Chalkboard SE", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 900;
  color: #ffe9a8;
  -webkit-text-stroke: 1px #5a2f9e;
  text-shadow: 0 2px 0 rgba(40, 16, 90, 0.9);
  transform: rotate(-2deg);
}

#hud .p-label.c-lvl { color: #ffd6e2; transform: rotate(-2deg); }
#hud .p-label.c-score { color: #ffe08a; transform: rotate(1.5deg); }
#hud .p-label.c-target { color: #aef0ff; transform: rotate(-1deg); }
#hud .p-label.c-moves { color: #e6c8ff; transform: rotate(2deg); }
#hud .p-label.c-time { color: #aef7c0; transform: rotate(-1.5deg); }
#hud .p-label.c-player { color: #b6ffd9; transform: rotate(-1deg); letter-spacing: 1px; }

#hud b {
  font-size: 24px;
  font-weight: 900;
  display: inline-block;
  min-width: 48px;
  padding: 4px 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7e0 0%, #ffd94d 45%, #ffb400 100%);
  color: #7a3b00;
  -webkit-text-stroke: 1px #ffecb0;
  text-shadow: 0 1px 0 #ffefc0, 0 2px 0 rgba(140, 80, 0, 0.45);
  box-shadow: 0 3px 0 #b85f00, 0 5px 10px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.65);
  transform: rotate(-1deg);
}

/* score progress bar lives below the header, same width as the header */
#progressWrap {
  width: 100%;
  height: 11px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(16, 22, 54, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

#progressWrap #targetBar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ac8fa, #af52de);
  box-shadow: 0 0 10px rgba(90, 200, 250, 0.6);
  transition: width 0.35s ease;
}

#topBtns {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: linear-gradient(180deg, #55b8ff 0%, #7b5cff 55%, #c64bff 100%);
  color: #fff;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 0 rgba(60, 30, 120, 0.9), 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, filter 0.15s ease;
}

.top-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.12);
  box-shadow: 0 6px 0 rgba(60, 30, 120, 0.9), 0 10px 24px rgba(90, 160, 255, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.top-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(60, 30, 120, 0.9), 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

/* reset button keeps the red "danger" cartoon look, brightens on hover */
.top-btn.reset {
  background: linear-gradient(180deg, #ffc1c1 0%, #ff6b6b 45%, #e63946 100%);
  box-shadow: 0 4px 0 rgba(150, 20, 30, 0.95), 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

.top-btn.reset:hover {
  background: linear-gradient(180deg, #ffd9d9 0%, #ff5a5a 40%, #c8102e 100%);
  border-color: #ffe0e0;
  filter: brightness(1.1);
  box-shadow: 0 6px 0 rgba(150, 20, 30, 0.95), 0 0 22px rgba(255, 60, 60, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

/* ---------- level progress strip (below the top bar) ---------- */
#levelStrip {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
  padding: 4px 8px;
  border-radius: 18px;
  background: rgba(16, 22, 54, 0.45);
  border: 1px solid rgba(140, 190, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: calc(100vw - 16px);
}

#levelStrip.hidden { display: none; }
#levelStrip::-webkit-scrollbar { display: none; }

#levelTracks {
  display: flex;
  align-items: center;
  width: max-content;
}

.level-dash {
  color: rgba(170, 200, 255, 0.55);
  font-size: 13px;
  margin: 0 2px;
  font-weight: 800;
  user-select: none;
}

.level-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(140, 190, 255, 0.35);
  background: linear-gradient(180deg, #2a3a6e, #151f44);
  color: #bcd2ff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.level-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 220, 150, 0.7);
}

.level-btn.on {
  border-color: #ffe08a;
  background: linear-gradient(180deg, #fff7e0 0%, #ffd94d 45%, #ffb400 100%);
  color: #7a3b00;
  box-shadow: 0 0 14px rgba(255, 200, 90, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ---------- skill bar ---------- */
#skills {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  z-index: 5;
  padding: 10px 14px;
  border-radius: 22px;
  background: rgba(16, 22, 54, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
}

#skills.hidden { display: none; }

/* skill buttons match the colorful top-bar buttons (same size & style).
   Each skill gets its own feature color via --sk-bg (set per-button below) */
.skill-btn {
  position: relative;
  flex: 0 1 auto;
  width: 44px;
  height: 44px;
  font-size: 17px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 15px;
  background: var(--sk-bg, linear-gradient(180deg, #55b8ff 0%, #7b5cff 55%, #c64bff 100%));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 0 rgba(60, 30, 120, 0.9), 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, filter 0.15s ease;
}

/* 炸弹/爆炸：火焰橙 */
#skill-bomb { --sk-bg: linear-gradient(180deg, #ffb13c 0%, #ff7a1f 45%, #ff4d1f 100%); }
/* 锤子/钢铁：冷灰蓝 */
#skill-hammer { --sk-bg: linear-gradient(180deg, #cdd9ea 0%, #8fa3bd 45%, #51627c 100%); }
/* 直线/能量：青色光束 */
#skill-line { --sk-bg: linear-gradient(180deg, #54e6ff 0%, #1fb6ee 45%, #0088d6 100%); }
/* 染色/颜料：紫罗兰 */
#skill-dye { --sk-bg: linear-gradient(180deg, #e69bff 0%, #b34dff 45%, #7a16c9 100%); }
/* 彩虹：多色渐变 */
#skill-rainbow { --sk-bg: linear-gradient(135deg, #ff5b6a 0%, #ff9d3c 20%, #ffe45c 40%, #3ddc7a 60%, #38a9ff 80%, #b06bff 100%); }
/* 洗牌/刷新：翠绿 */
#skill-shuffle { --sk-bg: linear-gradient(180deg, #52e8a8 0%, #22b87c 45%, #0a8f56 100%); }
/* 双倍/得分：鎏金 */
#skill-double { --sk-bg: linear-gradient(180deg, #ffd166 0%, #f7a400 45%, #d97f00 100%); }
/* 加步/生命：玫红 */
#skill-moves { --sk-bg: linear-gradient(180deg, #ff95ae 0%, #ff4d7d 45%, #d91d57 100%); }

.skill-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.12);
  box-shadow: 0 6px 0 rgba(60, 30, 120, 0.9), 0 10px 24px rgba(90, 160, 255, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.skill-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(60, 30, 120, 0.9), 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.skill-btn.active {
  border-color: #ffe08a;
  background: linear-gradient(180deg, #4a3a8e, #2a1f5a);
  box-shadow: 0 0 22px rgba(255, 200, 90, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: skillPulse 0.9s ease-in-out infinite;
}

@keyframes skillPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.skill-btn.used {
  opacity: 0.35;
  cursor: default;
  filter: grayscale(0.8);
  transform: none !important;
}

.skill-btn.cooldown {
  opacity: 0.65;
  cursor: default;
  filter: grayscale(0.4);
  transform: none !important;
  border-color: rgba(140, 190, 255, 0.45);
  background: linear-gradient(180deg, #1c2a52, #0f1736);
}

.skill-cd {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  color: #dff0ff;
  background: rgba(18, 26, 58, 0.95);
  border: 1px solid rgba(140, 190, 255, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  display: none;
}

.skill-cnt {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, #ff7eb3, #ff4d6d);
  box-shadow: 0 2px 6px rgba(255, 77, 109, 0.5);
}

/* ---------- overlays ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: rgba(8, 12, 34, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: center;
  overflow-y: auto;
  padding: 24px 16px;
}

.screen.hidden { display: none; }

#screen-start {
  background: radial-gradient(ellipse at center, var(--bg0) 0%, var(--bg1) 72%, var(--bg2) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding-top: 92px;
}

.title h1 {
  font-size: 54px;
  letter-spacing: 8px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 10%, #7fd8ff 50%, #c48bff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(127, 216, 255, 0.35);
}

.title h2 {
  font-size: 42px;
  letter-spacing: 6px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff, #7fd8ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  margin-top: 6px;
  font-size: 14px;
  letter-spacing: 8px;
  color: #8fa6cc;
}

.tip {
  font-size: 15px;
  line-height: 2;
  color: #c3d3ef;
}

.btn-primary {
  margin-top: 10px;
  padding: 14px 54px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, #29a8ff, #7b5cff 60%, #c64bff);
  box-shadow: 0 0 28px rgba(90, 160, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 40px rgba(110, 170, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

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

/* ---------- player login (top-center of the start screen) ---------- */
.login-box {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 14px 7px;
  border-radius: 16px;
  background: rgba(16, 22, 54, 0.72);
  border: 1px solid rgba(140, 190, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.login-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-label {
  font-size: 13px;
  color: #ffe9a8;
  font-weight: 800;
  letter-spacing: 2px;
  white-space: nowrap;
}

.login-hint {
  font-size: 11px;
  color: rgba(170, 195, 240, 0.75);
  letter-spacing: 1px;
  min-height: 14px;
  line-height: 1.3;
}

.login-hint.err {
  color: #ff9d9d;
  font-weight: 700;
}

/* ---------- login pickers (玩家头像 / 装饰元素) ---------- */
.login-pickers {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 30px;
}

.picker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.picker-label {
  font-size: 11px;
  color: rgba(234, 246, 255, 0.8);
  letter-spacing: 2px;
  white-space: nowrap;
}

/* ---------- login avatar picker ---------- */
.avatar-picker {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(180deg, #2a3a6e, #151f44);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 圆内图片自身裁圆，允许关闭按钮跨在圆边缘上 */
  overflow: visible;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.avatar-picker:hover {
  transform: translateY(-2px);
  border-color: #ffe08a;
  box-shadow: 0 0 18px rgba(255, 200, 90, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.avatar-picker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.avatar-picker .ap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bcd2ff;
}

.avatar-picker .ap-icon svg { width: 34px; height: 34px; }

/* 右上角关闭按钮：跨在圆形图像右上角边缘上（按钮圆心对准圆周，半在圆内半在圆外） */
.avatar-picker .ap-close {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: radial-gradient(circle at 32% 30%, #ff7d7d, #e32222 60%, #b30f0f);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 1;
  z-index: 3;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.avatar-picker .ap-close:hover { transform: scale(1.15); filter: brightness(1.12); }
.avatar-picker .ap-close:active { transform: scale(0.95); }
.avatar-picker .ap-close svg { display: block; }
@media (max-width: 600px) {
  .avatar-picker .ap-close { width: 16px; height: 16px; top: -1px; right: -1px; }
}

#playerNameInput {
  width: 170px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(140, 190, 255, 0.4);
  background: rgba(10, 15, 40, 0.85);
  color: #fff;
  font-size: 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  text-align: center;
}

#playerNameInput:focus {
  border-color: #ffe08a;
  box-shadow: 0 0 10px rgba(255, 200, 90, 0.4);
}

.btn-confirm {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #29a8ff, #7b5cff);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(90, 160, 255, 0.6);
}

/* ---------- player log ---------- */
.player-log {
  width: min(460px, 92vw);
  background: rgba(16, 22, 54, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.25);
  border-radius: 18px;
  padding: 10px 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: left;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.log-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffe9a8;
}

.log-sort {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.log-sort-btn {
  padding: 5px 16px;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(255, 255, 255, 0.07);
  color: #bcd2ff;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.log-sort-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
}

.log-sort-btn.on {
  color: #7a3b00;
  font-weight: 800;
  background: linear-gradient(180deg, #fff7e0 0%, #ffd94d 45%, #ffb400 100%);
  border-color: #ffd94d;
  box-shadow: 0 2px 0 #b85f00, 0 0 12px rgba(255, 200, 90, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.log-sync {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.log-sync-btn {
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  color: #dff0ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.log-sync-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- manual sync modal ---------- */
.sync-note {
  width: min(430px, 92vw);
  font-size: 13px;
  line-height: 1.8;
  color: #ffd7a1;
  background: rgba(255, 200, 90, 0.08);
  border: 1px solid rgba(255, 200, 90, 0.3);
  border-radius: 12px;
  padding: 8px 12px;
}

.sync-section {
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.sync-label {
  font-size: 13px;
  color: #ffe9a8;
  font-weight: 700;
  letter-spacing: 1px;
}

.sync-area {
  width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(8, 12, 34, 0.85);
  color: #eaf2ff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.sync-area:focus {
  border-color: #ffe08a;
  box-shadow: 0 0 10px rgba(255, 200, 90, 0.35);
}

.sync-area::placeholder {
  color: rgba(170, 195, 240, 0.55);
}

.sync-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.sync-row .btn-primary,
.sync-row .btn-plain {
  margin: 0;
}

#btn-sync-share { display: none; }

.sync-result {
  min-height: 20px;
  font-size: 13px;
  color: #5dff9d;
  font-weight: 700;
}

.sync-result.err {
  color: #ff9d9d;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 40vh;
  overflow-y: auto;
}

.log-overlay-list {
  width: min(460px, 92vw);
  max-height: 52vh;
}

.log-tip {
  font-size: 11px;
  color: rgba(170, 195, 240, 0.7);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.log-row .av {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bcd2ff;
  font-size: 11px;
  font-weight: 800;
}

.log-row .av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.log-row.cur {
  background: rgba(255, 217, 77, 0.14);
  border: 1px solid rgba(255, 217, 77, 0.5);
}

.log-row .ln {
  flex: 1 1 auto;
  font-weight: 800;
  color: #dff0ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-row .ll { flex: 0 0 auto; color: #ffd94d; font-weight: 700; }
.log-row .ls { flex: 0 0 auto; color: #aef0ff; }
.log-row .lt { flex: 0 0 auto; color: rgba(170, 195, 240, 0.6); font-size: 11px; }

.log-row .live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5dff9d;
  box-shadow: 0 0 6px rgba(93, 255, 157, 0.9);
  margin-left: 5px;
  vertical-align: 1px;
}

.log-empty {
  text-align: center;
  color: rgba(170, 195, 240, 0.6);
  padding: 10px;
  font-size: 13px;
}

.log-btns {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: min(440px, 90vw);
}

/* save changes & close log: same size, side by side */
.log-btns .btn-primary,
.log-btns .btn-plain {
  flex: 1 1 0;
  margin: 0;
  padding: 13px 10px;
  font-size: 16px;
  letter-spacing: 4px;
  text-align: center;
  white-space: nowrap;
}

.log-btns .btn-primary { border: 2px solid rgba(255, 255, 255, 0.45); }
.log-btns .btn-plain { border: 2px solid rgba(140, 190, 255, 0.4); background: linear-gradient(180deg, #3a4a7e, #232f5c); }

.btn-plain {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #eaf2ff;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-plain:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- confirm modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-box {
  width: min(340px, 90vw);
  padding: 22px 20px;
  border-radius: 18px;
  background: rgba(20, 28, 64, 0.97);
  border: 1px solid rgba(140, 190, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.modal-box p {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.modal-btns {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-danger {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff6b6b, #d62828);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 60, 60, 0.4);
  transition: transform 0.15s ease;
}

.btn-danger:hover { transform: translateY(-1px); }

/* ---------- footer (lives at the bottom of the start page) ---------- */
#footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(170, 195, 240, 0.5);
  pointer-events: none;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* ---------- floating score text ---------- */
#floatLayer {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 12px rgba(90, 200, 250, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6);
  animation: floatUp 1.1s ease-out forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  30%  { transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(0.9); }
}

/* ---------- combo toast ---------- */
#comboToast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffd94d;
  text-shadow: 0 0 24px rgba(255, 190, 60, 0.9), 0 3px 10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
}

#comboToast.show {
  animation: comboPop 1.15s ease-out forwards;
}

#comboToast.msg {
  font-size: 14px;
  letter-spacing: 1px;
  max-width: 86vw;
}

@keyframes comboPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(2deg); }
  40%  { transform: translate(-50%, -52%) scale(1) rotate(0deg); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1.1); }
}

/* ---------- stars ---------- */
#stars {
  font-size: 44px;
  letter-spacing: 12px;
  line-height: 1;
}

#stars .star {
  color: rgba(255, 255, 255, 0.18);
  text-shadow: none;
}

#stars .star.on {
  color: #ffd94d;
  text-shadow: 0 0 20px rgba(255, 190, 60, 0.9), 0 2px 6px rgba(0, 0, 0, 0.5);
  animation: starPop 0.5s ease-out both;
}

#stars .star.on:nth-child(2) { animation-delay: 0.15s; }
#stars .star.on:nth-child(3) { animation-delay: 0.3s; }

@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.35) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  #topArea { top: 8px; padding: 0 8px; }
  #topBar { flex-wrap: wrap; row-gap: 6px; }
  #playerBox { order: 1; flex: 1 1 auto; }
  #topBtns { order: 2; flex: 0 0 auto; }
  #hudWrap { order: 3; flex: 1 1 100%; margin: 0 auto; }
  #hud { gap: 7px; padding: 7px 9px; border-radius: 16px; }
  #hud .panel { min-width: 46px; padding: 2px 5px; }
  #hud .p-label { font-size: 10px; letter-spacing: 1px; }
  #hud b { font-size: 17px; min-width: 32px; padding: 3px 8px; box-shadow: 0 2px 0 #b85f00, 0 4px 8px rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.65); }
  #progressWrap { height: 10px; }
  #playerBox { padding: 6px 10px; }
  #playerBox b { font-size: 13px; max-width: 90px; }
  .player-av { width: 26px; height: 26px; border-width: 1.5px; }
  #topBtns { gap: 6px; }
  .top-btn { width: 36px; height: 36px; border-radius: 12px; font-size: 15px; }
  .top-btn svg { width: 16px; height: 16px; }
  .mini-btn { width: 28px; height: 28px; }
  .net-badge { font-size: 10px; padding: 2px 6px; }
  #skills {
    left: 8px;
    right: 8px;
    bottom: 20px;
    width: auto;
    max-width: none;
    transform: none;
    gap: 3px;
    padding: 8px 6px;
    border-radius: 18px;
  }
  .skill-btn { flex: 1 1 0; width: auto; min-width: 0; height: 42px; border-radius: 12px; padding: 0; }
  .skill-btn .ic svg { width: 18px; height: 18px; }
  .skill-cnt { min-width: 15px; height: 15px; line-height: 15px; font-size: 10px; top: -6px; right: -6px; }
  .skill-cd { min-width: 18px; height: 16px; line-height: 16px; font-size: 10px; }
  .level-btn { width: 27px; height: 27px; font-size: 12px; border-width: 1.5px; }
  .level-dash { font-size: 11px; margin: 0 1px; }
  #stars { font-size: 34px; letter-spacing: 8px; }
  #comboToast { font-size: 28px; top: 16%; }
  #comboToast.msg { font-size: 13px; }
  #screen-clear .title h2 { font-size: 34px; letter-spacing: 2px; -webkit-text-stroke: 2px #7a3b00; }
  .tip { font-size: 13px; line-height: 1.9; }
  .btn-primary { padding: 12px 40px; font-size: 17px; letter-spacing: 4px; }
  .screen { gap: 16px; padding: 18px 12px; }
  .title h1 { font-size: 38px; letter-spacing: 5px; }
  .title h2 { font-size: 30px; }
  .login-box { top: 8px; padding: 7px 10px 5px; gap: 4px; }
  .avatar-picker { width: 64px; height: 64px; border-width: 2px; }
  .avatar-picker .ap-icon svg { width: 26px; height: 26px; }
  #playerNameInput { width: 118px; height: 30px; font-size: 13px; }
  .login-hint { font-size: 10px; }
  .btn-confirm { height: 30px; padding: 0 10px; font-size: 12px; }
  .log-row { font-size: 12px; padding: 6px 8px; gap: 6px; }
  .log-row .av { width: 18px; height: 18px; font-size: 10px; }
  .chat-badge { min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; }
  .log-btns { width: min(360px, 90vw); gap: 8px; }
  .log-btns .btn-primary,
  .log-btns .btn-plain { padding: 11px 8px; font-size: 14px; letter-spacing: 2px; }
  .share-card canvas { width: min(240px, 70vw); }
  .share-card .share-card-img { width: min(240px, 70vw); }
  .btn-plat { min-width: 86px; height: 40px; font-size: 14px; }
  .share-sub .btn-plain { min-width: 104px; height: 36px; font-size: 13px; }
  #screen-start { padding-top: 78px; }
}

@media (max-width: 380px) {
  #hud { gap: 4px; padding: 6px 6px; }
  #hud .panel { min-width: 38px; padding: 1px 3px; }
  #hud b { font-size: 15px; min-width: 28px; padding: 3px 6px; }
  #hud .p-label { font-size: 9px; }
  .title h1 { font-size: 32px; }
  #playerBox b { max-width: 70px; }
  #playerNameInput { width: 100px; }
}

@media (max-height: 620px) {
  .screen { gap: 12px; }
  .title h1 { font-size: 34px; letter-spacing: 5px; }
  .title h2 { font-size: 26px; }
  .subtitle { margin-top: 2px; font-size: 12px; letter-spacing: 6px; }
  .tip { font-size: 12px; line-height: 1.7; }
  .btn-primary { margin-top: 4px; padding: 10px 36px; font-size: 16px; }
  .log-list { max-height: 30vh; }
  #screen-start { padding-top: 84px; }
}

/* ---------- start button gate: must log in first ---------- */
.btn-primary:disabled,
.btn-primary:disabled:hover {
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 0 14px rgba(90, 160, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ---------- SVG icons inside buttons ---------- */
.ic { display: inline-flex; align-items: center; justify-content: center; }
.skill-btn .ic svg { width: 20px; height: 20px; }
.mini-btn .ic svg { width: 16px; height: 16px; }
.top-btn svg { width: 20px; height: 20px; }
.ic-inline { display: inline-block; vertical-align: -0.18em; }
.ic-inline svg { width: 1em; height: 1em; }

/* ---------- player log: search / rename / delete ---------- */
.log-search { margin-bottom: 8px; }
.log-search input,
.log-edit input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(8, 12, 34, 0.85);
  color: #eaf2ff;
  font-size: 13px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.log-search input:focus { border-color: #ffe08a; box-shadow: 0 0 10px rgba(255, 200, 90, 0.35); }
.log-search input::placeholder { color: rgba(170, 195, 240, 0.55); }
.log-edit { margin-bottom: 8px; }
.log-edit input { border-color: rgba(255, 217, 77, 0.5); color: #ffe9a8; }
.log-row .la { flex: 0 0 auto; display: flex; gap: 4px; }
.row-act {
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #bcd2ff;
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.row-act:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.16); }
.row-act.danger { border-color: rgba(255, 120, 120, 0.4); color: #ffb3b3; }
.row-act.danger:hover { background: rgba(255, 80, 80, 0.16); }
.log-row .crown { display: inline-flex; margin-left: 4px; vertical-align: -2px; color: #ffd94d; }
.log-row .crown svg { width: 13px; height: 13px; }

/* ---------- chat room ---------- */
.chat-box {
  width: min(440px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(16, 22, 54, 0.85);
  border: 1px solid rgba(140, 190, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.chat-messages {
  height: 42vh;
  min-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px;
  scrollbar-width: thin;
  scrollbar-color: #4a5a8c transparent;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3d4c7d, #2a3560);
  border-radius: 999px;
  border: 1px solid rgba(120, 150, 220, 0.35);
}
.chat-messages::-webkit-scrollbar-thumb:hover { background: #5568a3; }

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 82%;
}

.chat-msg.own {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(170, 195, 240, 0.65);
  letter-spacing: 0.5px;
  user-select: text;
  -webkit-user-select: text;
  max-width: 100%;
}

.chat-ava {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bcd2ff;
  font-size: 10px;
  font-weight: 800;
}

.chat-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-name {
  font-weight: 700;
  color: #dff0ff;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-time {
  color: rgba(170, 195, 240, 0.55);
  white-space: nowrap;
}

.chat-acts {
  display: flex;
  gap: 2px;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.chat-msg:hover .chat-acts,
.chat-msg .chat-acts:focus-within { opacity: 1; }

.chat-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #aac3f0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.chat-act:hover { background: rgba(255, 255, 255, 0.14); color: #fff; transform: translateY(-1px); }
.chat-act.del:hover { background: rgba(255, 80, 80, 0.2); color: #ffb3b3; }
.chat-act svg { width: 13px; height: 13px; }

.chat-text {
  font-size: 14px;
  line-height: 1.5;
  padding: 7px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(140, 190, 255, 0.25);
  color: #eaf2ff;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.chat-msg.own .chat-text {
  background: linear-gradient(180deg, #fff7e0 0%, #ffd94d 45%, #ffb400 100%);
  border-color: rgba(255, 217, 77, 0.6);
  color: #7a3b00;
  font-weight: 700;
}

.chat-sys {
  align-self: center;
  font-size: 11px;
  color: rgba(170, 195, 240, 0.55);
  padding: 2px 0;
}

.chat-input-area {
  position: relative;
}

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(320px, 82vw);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(14, 20, 50, 0.97);
  border: 1px solid rgba(140, 190, 255, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.emoji-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  padding: 3px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}

.emoji-btn:hover { background: rgba(255, 255, 255, 0.14); transform: scale(1.15); }

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input-row .top-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 15px;
}

.chat-input-row .top-btn svg { width: 18px; height: 18px; }

.chat-input-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: rgba(8, 12, 34, 0.85);
  color: #eaf2ff;
  font-size: 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.chat-input-row input:focus { border-color: #ffe08a; box-shadow: 0 0 10px rgba(255, 200, 90, 0.35); }
.chat-input-row input::placeholder { color: rgba(170, 195, 240, 0.55); }
.chat-input-row .btn-confirm { flex: 0 0 auto; height: 36px; padding: 0 18px; }

/* ---------- share card overlay ---------- */
.share-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.share-card {
  border-radius: 24px;
  overflow: hidden;
  background: #141d4a;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(140, 190, 255, 0.25);
}

.share-card canvas {
  display: block;
  width: min(300px, 78vw);
  height: auto;
}

/* 分享弹层里用 <img> 展示卡片：手机上长按即可“保存图片 / 分享图片” */
.share-card .share-canvas { display: none; }
.share-card .share-card-img { display: block; width: min(300px, 78vw); height: auto; }

.share-card-tip {
  margin: -4px 0 0;
  font-size: 12px;
  color: rgba(234, 246, 255, 0.55);
  text-align: center;
}

.share-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.share-plats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.btn-plat {
  min-width: 96px;
  height: 44px;
  padding: 0 8px;
  border-radius: 14px;
  border: 1px solid rgba(140, 190, 255, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  color: #eaf6ff;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-plat:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.btn-plat:active { transform: scale(0.96); }

.share-sub .btn-plain {
  height: 38px;
  min-width: 120px;
  margin-top: 0;
  padding: 0 16px;
  font-size: 14px;
  letter-spacing: 2px;
  border: 2px solid rgba(140, 190, 255, 0.4);
  background: linear-gradient(180deg, #3a4a7e, #232f5c);
}

/* ---------- share QR modal (微信/朋友圈) ---------- */
.share-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(480px, 92vw);
  padding: 20px 18px 16px;
  border-radius: 20px;
  background: rgba(20, 28, 64, 0.97);
  border: 1px solid rgba(140, 190, 255, 0.3);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
}

.share-qr-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.share-qr-card {
  width: min(150px, 34vw);
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(140, 190, 255, 0.3);
  background: #fff;
}

.share-qr-code {
  width: min(190px, 40vw);
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(140, 190, 255, 0.3);
  background: #fff;
}

.share-qr-fail {
  max-width: 240px;
  font-size: 13px;
  line-height: 1.6;
  color: #ffd28a;
}

.share-qr-hint {
  font-size: 12px;
  color: rgba(234, 246, 255, 0.6);
}

.share-qr-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-qr-btns .btn-plain {
  height: 36px;
  min-width: 108px;
  margin-top: 0;
  padding: 0 14px;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ---------- unread chat badge (red dot on the chat button) ---------- */
.chat-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, #ff5a5a 0%, #e01e2a 100%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 10px rgba(255, 60, 60, 0.6);
  pointer-events: none;
  z-index: 2;
}

.chat-badge.hidden { display: none; }

/* ---------- cartoon level-complete title ---------- */
#screen-clear .title h2 {
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", "Segoe Print", "Microsoft YaHei", cursive;
  font-size: 48px;
  letter-spacing: 4px;
  color: #ffe94d;
  background: none;
  background-clip: initial;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: #ffe94d;
  -webkit-text-stroke: 2.5px #7a3b00;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #b85f00, 0 8px 16px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 210, 80, 0.75);
  transform: rotate(-2deg);
  animation: clearBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes clearBounce {
  0% { transform: rotate(-6deg) scale(0.4); opacity: 0; }
  55% { transform: rotate(2deg) scale(1.12); opacity: 1; }
  75% { transform: rotate(-2deg) scale(0.97); }
  100% { transform: rotate(-2deg) scale(1); }
}
