/* ========== 赛博网吧 · 吸烟区 ==========
   深夜网吧的物质世界：烟熏墙、钨丝灯、价目表、旧海报、纸面 UI
   调色：烟熏黑 / 钨丝黄 / 可乐红 / 雪碧绿 / 旧纸黄
*/
:root {
  --smoke-black: #17110c;
  --wall: #2b211a;
  --wall-deep: #231a13;
  --floor: #362d25;
  --paper: #efe3c8;
  --paper-bright: #f7efdc;
  --paper-dim: #cbb994;
  --tungsten: #ffb454;
  --cola: #e0503c;
  --mint: #79b791;
  --tube: #ff5a4e;
  --crt: #8fae7a;
  --line: #17110c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--paper);
  background: var(--smoke-black);
}

.hand { font-family: "Kaiti SC", "STKaiti", "KaiTi", serif; }

.room {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 10px 10px 8px;
  gap: 8px;
}

/* ★ 关键：烟雾画布只是覆盖层，不参与排版 */
#smokeCanvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.neon-sign {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 2px 6px;
}
.neon-main {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 10px;
  color: var(--tube);
  text-shadow: 0 0 4px rgba(255, 90, 78, 0.95), 0 0 18px rgba(255, 90, 78, 0.5);
}
.neon-main i { font-style: normal; }
.neon-main i.buzz { animation: tube-buzz 6s infinite; }
@keyframes tube-buzz {
  0%, 86%, 100% { opacity: 1; }
  87% { opacity: 0.25; }
  88% { opacity: 1; }
  92% { opacity: 0.5; }
  93% { opacity: 1; }
}
.neon-sub {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 12px;
  color: var(--paper-dim);
  background: var(--paper);
  color: var(--line);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 7px;
  transform: rotate(-1.5deg);
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.5);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pill {
  font-size: 12px;
  color: var(--paper-dim);
  background: var(--wall-deep);
  border: 1px solid rgba(0, 0, 0, 0.65);
  border-radius: 3px;
  padding: 3px 9px;
  white-space: nowrap;
}
.icon-btn {
  font-size: 14px;
  background: var(--wall-deep);
  color: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.65);
  border-radius: 3px;
  width: 30px;
  height: 28px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--wall); }

/* ---------- 场景 ---------- */
.scene {
  position: relative;
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--smoke-black);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 4px),
    linear-gradient(var(--wall) 0%, var(--wall-deep) 72%, var(--floor) 72%);
}
/* 墙裙线 */
.scene::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 72%;
  height: 6px;
  background: #141009;
  border-top: 1px solid rgba(255, 180, 84, 0.12);
  z-index: 0;
}
/* 地砖缝 */
.scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    repeating-linear-gradient(90deg, transparent 0 64px, rgba(0, 0, 0, 0.28) 64px 66px),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(0, 0, 0, 0.28) 30px 32px);
  pointer-events: none;
  z-index: 0;
}

.back-wall { position: absolute; inset: 0 0 22% 0; z-index: 1; }

/* 雨窗 */
.rain-window {
  position: absolute;
  left: 4%;
  top: 6%;
  width: clamp(110px, 16%, 180px);
  height: clamp(100px, 56%, 215px);
}
.window-frame {
  position: absolute;
  inset: 0;
  background: linear-gradient(#101720, #0c1118);
  border: 6px solid #4a3a2c;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), inset 0 0 22px rgba(0, 0, 0, 0.7);
}
.window-word {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: clamp(14px, 1.9vw, 22px);
  letter-spacing: 6px;
  color: rgba(239, 227, 200, 0.6);
  writing-mode: vertical-rl;
  z-index: 1;
}
.cross {
  position: absolute;
  width: 74%;
  height: 4px;
  background: var(--cola);
  transform: rotate(-5deg);
  box-shadow: 0 0 8px rgba(224, 80, 60, 0.8);
}
.hand-note {
  position: absolute;
  right: -10px;
  bottom: 10px;
  z-index: 2;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 11px;
  color: var(--line);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 0 5px;
  transform: rotate(3deg);
}
.rain {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    93deg,
    transparent 0 9px,
    rgba(150, 180, 205, 0.14) 9px 10px,
    transparent 10px 22px
  );
  background-size: 200% 100%;
  animation: rainfall 0.8s linear infinite;
}
@keyframes rainfall {
  from { background-position: 0 0; }
  to { background-position: -44px 0; }
}
.windowsill {
  position: absolute;
  bottom: -12px;
  left: -12px;
  width: calc(100% + 24px);
  height: 12px;
  background: #3d2f22;
  border: 2px solid var(--smoke-black);
}

/* 价目表（手写黑板） */
.menu-board {
  position: absolute;
  left: 26%;
  top: 5%;
  width: clamp(150px, 19%, 220px);
  background: #15100b;
  border: 5px solid #4a3a2c;
  border-radius: 3px;
  padding: 8px 12px 10px;
  transform: rotate(-0.8deg);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4);
}
.menu-title {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  text-align: center;
  font-size: 15px;
  letter-spacing: 8px;
  color: var(--tungsten);
  border-bottom: 1px dashed rgba(239, 227, 200, 0.35);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.menu-line {
  display: flex;
  align-items: baseline;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 12px;
  color: var(--paper-dim);
  margin: 3px 0;
}
.menu-line i {
  flex: 1;
  border-bottom: 1px dotted rgba(239, 227, 200, 0.3);
  margin: 0 6px;
}
.menu-line b { color: var(--paper); font-weight: 400; }
.menu-line.free b { color: var(--mint); }

/* 海报 */
.poster {
  position: absolute;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--line);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 10px;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.45);
}
.poster-a { right: 24%; top: 8%; transform: rotate(1.6deg); }
.poster-b { right: 6%; top: 42%; transform: rotate(-2.2deg); font-size: 11px; }

/* 货架 */
.shelf {
  position: absolute;
  right: 4%;
  top: 5%;
  width: clamp(120px, 17%, 190px);
  background: linear-gradient(#4a3a2c, #33271c);
  border: 3px solid var(--smoke-black);
  padding: 10px 8px 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shelf-top {
  position: absolute;
  top: -6px;
  left: -6px;
  width: calc(100% + 12px);
  height: 8px;
  background: #5d4a37;
  border: 2px solid var(--smoke-black);
}
.shelf-item {
  font-size: clamp(14px, 1.7vw, 20px);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  padding: 3px 6px;
}
.shelf-item.sign {
  font-size: clamp(10px, 1.1vw, 12px);
  color: var(--mint);
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
}

/* 电脑区 */
.pc-strip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  display: flex;
  gap: clamp(10px, 1.6vw, 18px);
  z-index: 1;
}
.pc {
  background: #14100d;
  border: 3px solid #060403;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 5px 9px 9px;
  font-size: 10px;
  text-align: center;
  min-width: 64px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
}
.pc-num {
  color: var(--paper-dim);
  font-family: Consolas, "Courier New", monospace;
}
.pc-screen {
  display: block;
  font-size: 11px;
  color: var(--crt);
  font-family: Consolas, "Courier New", monospace;
  text-shadow: 0 0 6px rgba(143, 174, 122, 0.7);
}

/* 老板位 */
.boss-zone {
  position: absolute;
  right: 5%;
  bottom: 0;
  text-align: center;
  z-index: 1;
}
.boss {
  font-size: clamp(22px, 3vw, 36px);
  background: #241b15;
  border: 2px solid var(--smoke-black);
  border-radius: 8px;
  padding: 4px 10px;
  animation: idle-bob 4.2s ease-in-out infinite;
}
.boss-bubble {
  display: block;
  font-size: 10px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--paper-dim);
  margin-top: 2px;
}
.boss-sign {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--tungsten);
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
}

/* ---------- 地板与人物 ---------- */
.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  z-index: 2;
}
.players {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(10px, 2.2vw, 28px);
  width: 100%;
  padding: 0 10px;
  min-height: 128px;
}

.player {
  position: relative;
  width: clamp(82px, 11.5vw, 130px);
  text-align: center;
  animation: idle-bob 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.7s);
}
@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.avatar-blob {
  position: relative;
  font-size: clamp(28px, 3.8vw, 44px);
  width: 1.45em;
  height: 1.45em;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  transform: rotate(calc(var(--i) * 2deg - 2deg));
}
.player.me .avatar-blob { outline: 3px solid var(--tungsten); outline-offset: 1px; }

.player-name {
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--line);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  padding: 0 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pack-badge img { width: 15px; height: 15px; object-fit: contain; vertical-align: -3px; border-radius: 2px; margin-right: 2px; }
.pack-badge {
  font-size: 11px;
  color: var(--paper-dim);
  margin-top: 2px;
  text-shadow: 0 1px 2px #000;
}

/* 香烟本体 */
.cig-holder {
  position: absolute;
  bottom: 36%;
  left: 50%;
  transform: translateX(-50%) rotate(-27deg);
  transform-origin: 60% 100%;
  width: clamp(44px, 5vw, 62px);
  height: 11px;
}
.cig { position: relative; width: 100%; height: 100%; }
.cig-filter {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 30%;
  background: linear-gradient(#d8a869, #b4834a);
  border: 1px solid rgba(23, 17, 12, 0.7);
  border-radius: 0 3px 3px 0;
}
/* 烟身：从火头往滤嘴方向真实变短（--burn 0→1） */
.cig-stick {
  position: absolute;
  right: 30%;
  top: 0;
  bottom: 0;
  width: calc(70% * (1 - var(--burn, 0)));
  min-width: 0;
  background: linear-gradient(#f2e9d7, #d9c7a4);
  border: 1px solid rgba(23, 17, 12, 0.6);
  border-radius: 3px 0 0 3px;
  transition: width 0.4s linear;
}
/* 火头：始终停在燃烧前沿 */
.ember {
  position: absolute;
  top: 0.5px;
  right: calc(30% + 70% * (1 - var(--burn, 0)) - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe9b0, var(--tungsten) 55%, #c2401d);
  box-shadow: 0 0 8px 3px rgba(255, 159, 28, 0.8);
  opacity: 0;
  transition: right 0.4s linear;
}
/* 火头前一小截烟灰 */
.cig-ash {
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(30% + 70% * (1 - var(--burn, 0)) + 3px);
  width: min(6px, calc(70% * var(--burn, 0)));
  background: linear-gradient(#9c9487, #6f675c);
  border-radius: 3px;
  transition: right 0.4s linear, width 0.4s linear;
}
/* 抽完只剩烟屁股 */
.player.dead .cig-stick { width: 4%; }
.player.dead .ember { opacity: 0 !important; }
.smoke-stream {
  position: absolute;
  left: -2px;
  top: -18px;
  font-size: 10px;
  color: rgba(239, 227, 200, 0.7);
  animation: stream-up 2.2s ease-out infinite;
  opacity: 0;
}
@keyframes stream-up {
  0% { opacity: 0; transform: translateY(0) translateX(0) scale(0.7); }
  25% { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-22px) translateX(6px) scale(1.4); }
}

.player.lit .ember { opacity: 1; animation: ember-breathe 2.1s ease-in-out infinite; }
.player.lit.dragging .ember { animation: ember-hot 0.35s ease-in-out infinite; }
@keyframes ember-breathe {
  0%, 100% { box-shadow: 0 0 6px 2px rgba(255, 159, 28, 0.55); }
  50% { box-shadow: 0 0 12px 5px rgba(255, 159, 28, 0.95); }
}
@keyframes ember-hot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.5); }
}
.player.lit .smoke-stream { opacity: 1; }

.cig-bar {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.8);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.cig-fill {
  height: 100%;
  width: 100%;
  background: var(--tungsten);
  transition: width 0.5s linear;
}
.player.dead .cig-fill { background: #6f675c; }

.gift-tag {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  font-size: 10px;
  color: var(--line);
  background: var(--tungsten);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  padding: 0 6px;
  white-space: nowrap;
  z-index: 3;
  animation: gift-pop 0.5s cubic-bezier(0.2, 1.8, 0.4, 1);
}
@keyframes gift-pop { from { transform: translateX(-50%) scale(0.2) rotate(-8deg); } }

.gift-btn {
  position: absolute;
  top: 34%;
  right: -6px;
  font-size: 11px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  background: var(--paper);
  color: var(--line);
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s;
}
.player:hover .gift-btn,
.player:focus-within .gift-btn { opacity: 1; }

/* 公共烟灰缸 */
.ash-stand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 4px;
  z-index: 2;
}
.ashtray {
  position: relative;
  width: clamp(70px, 9vw, 110px);
  height: clamp(20px, 2.4vw, 30px);
  background: linear-gradient(#7d7364, #4f483e);
  border: 2px solid var(--smoke-black);
  border-radius: 4px 4px 10px 10px;
  overflow: hidden;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
.ash-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(#b7ac9b, #7d7364);
  transition: height 0.6s ease;
}
.ash-label {
  margin-top: 2px;
  font-size: 10px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--paper-dim);
}

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--wall-deep);
  border: 2px solid var(--smoke-black);
  border-radius: 8px;
  padding: 8px 10px;
}
.tool-btn {
  font-size: 14px;
  font-weight: 700;
  color: var(--line);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.tool-btn:hover { filter: brightness(1.06); }
.tool-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tool-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.5);
  transform: none;
  box-shadow: 0 3px 0 var(--line);
}
.tool-btn.primary { background: var(--cola); color: var(--paper-bright); }
.tool-btn.big { background: var(--tungsten); }
.tool-btn.holding { background: var(--mint); transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.cig-info {
  margin-left: auto;
  font-size: 12px;
  color: var(--paper-dim);
  text-align: right;
  font-family: Consolas, "Courier New", monospace;
}

/* ---------- 聊天（纸面便签风） ---------- */
.chat-panel {
  position: absolute;
  right: 0;
  top: 52px;
  bottom: 0;
  width: clamp(230px, 22vw, 300px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 2px solid var(--smoke-black);
  z-index: 6;
}
.chat-head {
  padding: 9px 12px;
  font-size: 13px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--line);
  background: #e6d7b4;
  border-bottom: 1px dashed rgba(23, 17, 12, 0.4);
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}
.msg {
  max-width: 88%;
  font-size: 13px;
  line-height: 1.45;
  color: var(--line);
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-radius: 8px 8px 8px 2px;
  padding: 6px 9px;
  align-self: flex-start;
  transform: rotate(calc(var(--tilt, 0) * 0.8deg));
  word-break: break-word;
  animation: msg-in 0.18s ease-out;
}
@keyframes msg-in { from { transform: translateY(6px) scale(0.96); opacity: 0; } }
.msg.me {
  align-self: flex-end;
  background: #dfe8d2;
  border-radius: 8px 8px 2px 8px;
}
.msg .m-name { font-weight: 700; font-size: 11px; margin-right: 5px; }
.msg.system {
  align-self: center;
  background: transparent;
  border: 1.5px dashed rgba(108, 92, 64, 0.7);
  color: #6c5c40;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 12px;
  text-align: center;
}

.emoji-row {
  display: flex;
  gap: 4px;
  padding: 6px 10px 0;
  overflow-x: auto;
}
.emoji-btn {
  font-size: 15px;
  background: transparent;
  border: 1px solid rgba(23, 17, 12, 0.3);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
}
.emoji-btn:hover { background: #e6d7b4; }
.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px 10px 12px;
}
.chat-form input {
  flex: 1;
  font-size: 13px;
  color: var(--line);
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}
.chat-form input:focus { border-color: var(--cola); }
.chat-form button {
  font-size: 15px;
  background: var(--cola);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
}
.chat-form button:active { transform: translateY(2px); box-shadow: none; }

/* ---------- 浮层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(12, 9, 7, 0.82);
}
.overlay.hidden { display: none; }

.door-card, .cabinet-card {
  width: min(92vw, 520px);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--paper);
  color: var(--line);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 26px 26px 24px;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.55);
}
.door-neon {
  text-align: center;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 38px;
  letter-spacing: 12px;
  color: var(--tube);
  text-shadow: 0 0 6px rgba(255, 90, 78, 0.9), 0 0 26px rgba(255, 90, 78, 0.45);
  animation: tube-buzz 5s infinite;
}
.door-card h1 {
  text-align: center;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 22px;
  margin: 8px 0 4px;
  letter-spacing: 4px;
  color: var(--line);
}
.door-sub {
  text-align: center;
  font-size: 13px;
  color: #6c5c40;
  margin: 0 0 18px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
}
.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #6c5c40;
}
.field input {
  width: 100%;
  font-size: 15px;
  color: var(--line);
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
}
.field input:focus { border-color: var(--cola); }

.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-slot {
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s;
}
.avatar-slot:hover { transform: scale(1.08); }
.avatar-slot.sel {
  border-color: var(--cola);
  box-shadow: 0 0 0 2px var(--cola);
  background: #f3e2c8;
}

.cta {
  width: 100%;
  font-size: 17px;
  font-weight: 800;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  letter-spacing: 4px;
  color: var(--line);
  background: var(--tungsten);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
  transition: transform 0.08s, box-shadow 0.08s;
}
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.conn-hint {
  text-align: center;
  font-size: 12px;
  margin-top: 10px;
  color: #6c5c40;
  min-height: 16px;
}

/* 烟柜 */
.cabinet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 15px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--line);
}
.cabinet-head b { color: var(--cola); }
.link-btn {
  font-size: 12px;
  color: #6c5c40;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline dotted;
}
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.pack-card {
  position: relative;
  text-align: center;
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-top-width: 4px;
  border-radius: 6px;
  padding: 10px 6px 8px;
  cursor: pointer;
  transition: transform 0.1s;
}
.pack-card:hover { transform: translateY(-2px); }
.pack-card:focus-visible { outline: 2px dashed var(--cola); outline-offset: 2px; }
.pack-card.sel { box-shadow: 0 0 0 2px var(--cola); }
.pack-card.rarity-灰 { border-top-color: #9a938a; }
.pack-card.rarity-蓝 { border-top-color: #5e7fa8; }
.pack-card.rarity-紫 { border-top-color: #8a6fa8; }
.pack-card.rarity-金 { border-top-color: #d8a63c; }
.pack-icon { font-size: 30px; display: block; }
.pack-img { display: block; width: 100%; height: 72px; object-fit: contain; margin: 0 auto; }
.pack-name { display: block; font-size: 13px; font-weight: 700; margin: 5px 0 2px; color: var(--line); }
.pack-rarity { font-size: 10px; color: #6c5c40; }
.pack-owned { position: absolute; top: 6px; right: 7px; font-size: 12px; }
.pack-note {
  margin-top: 12px;
  font-size: 13px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: #4d4030;
  border-left: 3px solid var(--cola);
  padding-left: 10px;
  min-height: 20px;
}

/* 提示与通知 */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  font-size: 13px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--line);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.toast.rarity { background: var(--tungsten); }
@keyframes toast-in { from { transform: translateY(14px) scale(0.9); opacity: 0; } }

.drag-hint {
  position: fixed;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--line);
  background: var(--tungsten);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 6px 16px;
  z-index: 15;
  animation: toast-in 0.15s ease-out;
}
.hidden { display: none !important; }

.gift-notice {
  position: fixed;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  z-index: 25;
}
.gift-card {
  background: var(--paper);
  color: var(--line);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: gift-drop 0.3s cubic-bezier(0.2, 1.7, 0.4, 1);
}
@keyframes gift-drop { from { transform: translateY(-30px) rotate(-3deg); opacity: 0; } }
.gift-card p { margin: 0 0 10px; font-size: 14px; font-family: "Kaiti SC", "STKaiti", "KaiTi", serif; }
.gift-actions { display: flex; gap: 8px; justify-content: center; }
.mini {
  font-size: 13px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  color: var(--line);
  background: var(--paper-bright);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
}
.mini.ok { background: var(--cola); color: var(--paper-bright); }
.mini:active { transform: translateY(2px); box-shadow: none; }

/* 点击舞台按住吸 */
.scene { cursor: grab; }
.scene.holding { cursor: grabbing; }

/* 跳跳糖烟屏幕震动 */
.room.wobble { animation: wobble 0.18s linear infinite; }
@keyframes wobble {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, 1px); }
}

/* 移动端 */
@media (max-width: 720px) {
  .room { padding: 6px; gap: 6px; grid-template-rows: auto 1fr auto auto; }

  .neon-main { font-size: 18px; letter-spacing: 4px; }
  .neon-sub { display: none; }
  .pill { font-size: 11px; padding: 2px 7px; }

  .chat-panel {
    position: static;
    width: 100%;
    height: 168px;
    border-left: none;
    border-top: 2px solid var(--smoke-black);
  }
  .chat-head { padding: 6px 10px; font-size: 12px; }
  .emoji-row { padding: 4px 8px 0; }
  .chat-form { padding: 6px 8px 8px; }

  /* 工具条：大吸按钮独占一行，其余四键均分 */
  .toolbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
  }
  .tool-btn { font-size: 12px; padding: 9px 2px; text-align: center; }
  .tool-btn.big { grid-column: 1 / -1; font-size: 15px; padding: 12px; }
  .cig-info { display: none; }

  /* 人物行：人多时可横滑，人少时居中 */
  .players {
    gap: 8px;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0 12px;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .players::-webkit-scrollbar { display: none; }
  .players > .player:first-child { margin-left: auto; }
  .players > .player:last-child { margin-right: auto; }
  .player { width: 76px; flex: 0 0 auto; }

  /* 背景装饰精简，只留雨窗和电脑区 */
  .shelf, .poster-a, .poster-b, .menu-board { display: none; }
  .rain-window { width: 84px; height: 96px; left: 3%; top: 4%; }
  .pc { min-width: 46px; padding: 4px 6px 6px; }
  .pc-screen { font-size: 9px; }
  .boss { font-size: 22px; }

  .door-card, .cabinet-card { padding: 18px 16px; }
  .door-neon { font-size: 28px; letter-spacing: 8px; }
  .avatar-slot { width: 42px; height: 42px; font-size: 22px; }
  .pack-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .pack-img { height: 56px; }
  .gift-notice { width: min(92vw, 420px); }
  .drag-hint { bottom: 150px; }
}

/* 超窄屏 */
@media (max-width: 420px) {
  .pill.weather { display: none; }
  .neon-main { font-size: 16px; letter-spacing: 3px; }
  .player { width: 68px; }
  .pc-strip { gap: 6px; }
  .pc { min-width: 40px; }
}

/* 手机浏览器地址栏伸缩时不露底 */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

/* 可达性 */
button:focus-visible,
input:focus-visible {
  outline: 2px dashed var(--cola);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
  .rain { animation: none; }
}