* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  background: #1c1410;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", monospace;
  color: #f4ecd6;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画布：像素风，按比例放大 */
#game {
  width: min(94vw, 640px);
  height: auto;
  aspect-ratio: 4 / 3;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid #5a3b27;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  background: #caa472;
}

/* 角落按钮 */
.corner-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px; height: 40px;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 30;
}
.corner-btn:hover { background: rgba(0,0,0,0.65); }

/* 标题页 */
#title-screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #2e2118, #120c08);
  z-index: 40;
  transition: opacity .5s;
}
#title-screen.hide { opacity: 0; pointer-events: none; }
.title-card {
  text-align: center;
  padding: 32px 28px;
  background: rgba(244,236,214,0.06);
  border: 2px solid #5a3b27;
  border-radius: 14px;
  max-width: 360px;
}
.title-card h1 { font-size: 30px; letter-spacing: 2px; color: #ffcf8a; }
.title-card .sub { margin: 10px 0 22px; color: #d8c7a6; font-size: 13px; }
#start-btn {
  font-size: 16px; padding: 12px 28px;
  border: none; border-radius: 10px;
  background: #d8694e; color: #fff; cursor: pointer;
  box-shadow: 0 4px 0 #a8432e;
}
#start-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a8432e; }
.title-card .hint { margin-top: 18px; font-size: 11px; color: #b6a583; line-height: 1.6; }

/* 开场登记：选角色 + 填公司 */
.onboard { margin: 8px 0 4px; }
.onboard-label { font-size: 12px; color: #ffcf8a; margin: 14px 0 8px; text-align: left; letter-spacing: 1px; }
#char-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.char-opt {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px; font-size: 22px;
  background: rgba(244,236,214,0.05); color: #f4ecd6;
  border: 2px solid #5a3b27; border-radius: 12px; cursor: pointer;
  transition: .15s; user-select: none;
}
.char-opt span { font-size: 11px; color: #d8c7a6; }
.char-opt:hover { background: rgba(244,236,214,0.12); }
.char-opt.selected { border-color: #ffcf8a; background: rgba(255,207,138,0.18); box-shadow: 0 0 0 2px rgba(255,207,138,0.35); }
.char-opt.selected span { color: #ffcf8a; }
#company-input {
  width: 100%; box-sizing: border-box;
  padding: 11px 14px; font-size: 14px;
  background: rgba(0,0,0,0.25); color: #f4ecd6;
  border: 2px solid #5a3b27; border-radius: 10px; outline: none;
  margin-top: 2px;
}
#company-input::placeholder { color: #9c8a6e; }
#company-input:focus { border-color: #ffcf8a; }
#start-btn { margin-top: 18px; width: 100%; }

/* 欢迎 HUD */
#welcome-hud {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 25; pointer-events: none;
  padding: 8px 16px; border-radius: 20px;
  background: rgba(0,0,0,0.5); color: #ffcf8a;
  font-size: 13px; white-space: nowrap;
  opacity: 0; transition: opacity .6s, transform .6s;
}
#welcome-hud.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 内容面板 */
#panel-overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(10,6,3,0.55);
  z-index: 50;
}
#panel-overlay.show { display: flex; }
#panel-content {
  width: min(88vw, 460px);
  max-height: 76vh;
  overflow-y: auto;
  background: #f4ecd6;
  color: #3a2a1c;
  border: 3px solid #8a6440;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.6);
}
#panel-content h2 { font-size: 20px; color: #8a3b27; margin-bottom: 10px; }
#panel-content h3 { font-size: 14px; margin: 16px 0 8px; color: #5a3b27; }
#panel-content p, #panel-content li { font-size: 13px; line-height: 1.7; }
#panel-content .lead { margin-bottom: 6px; }
#panel-content a { color: #b8512f; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  background: #e7d3b1; color: #5a3b27;
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
  border: 1px solid #c9a877;
}
.chips.big span { font-size: 14px; padding: 8px 14px; }
.exp { list-style: none; }
.exp li { margin-bottom: 8px; }
.exp b { color: #8a3b27; margin-right: 6px; }
.cards { display: grid; gap: 10px; }
.card {
  background: #fff8ea; border: 1px solid #d8c39a;
  border-radius: 10px; padding: 12px 14px; position: relative;
}
.card b { font-size: 14px; }
.card p { color: #6a5238; margin-top: 4px; }
.card .tag {
  position: absolute; top: 10px; right: 12px;
  background: #d8694e; color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 10px;
}
#panel-close {
  position: absolute; bottom: 18px;
  background: #8a3b27; color: #fff; border: none;
  padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 12px;
}

/* 手机摇杆 */
#touch-controls {
  position: absolute; bottom: 18px; left: 0; right: 0;
  display: none;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 35;
  pointer-events: none;
}
.dpad { display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(2, 46px); gap: 4px; pointer-events: auto; }
.dpad .mid { grid-column: 1 / 4; display: flex; justify-content: center; gap: 4px; }
.tb {
  width: 46px; height: 46px; font-size: 16px;
  background: rgba(0,0,0,0.4); color: #fff; border: 1px solid #5a3b27;
  border-radius: 10px; cursor: pointer; user-select: none;
}
.tb:active { background: rgba(216,105,78,0.7); }
.e-btn {
  align-self: flex-end;
  width: 64px; height: 64px; font-size: 22px; font-weight: bold;
  background: rgba(216,105,78,0.85); color: #fff; border: none;
  border-radius: 50%; cursor: pointer; pointer-events: auto; user-select: none;
}
.e-btn:active { transform: scale(0.92); }

/* 触屏设备显示摇杆 */
@media (hover: none) and (pointer: coarse) {
  #touch-controls { display: flex; }
}

/* 电视放大播放 */
#tv-overlay { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
#tv-overlay.hidden { display: none; }
#tv-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
.tv-pop { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; transform: scale(.25); opacity: 0; transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .3s; }
.tv-pop.show { transform: scale(1); opacity: 1; }
.tv-close { position: absolute; top: -14px; right: -14px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; background: #ff5c5c; color: #fff; font-size: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.tv-close:hover { transform: scale(1.08); }
.tv-bezel { position: relative; width: min(92vw, 1100px); max-height: 76vh; aspect-ratio: 16 / 9; background: linear-gradient(160deg, #2c2c33, #141417 60%, #0c0c0f); border-radius: 26px; padding: 16px; box-shadow: 0 40px 120px rgba(0,0,0,.75), inset 0 2px 3px rgba(255,255,255,.12), inset 0 -3px 8px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.05); }
.tv-screen { position: relative; width: 100%; height: 100%; border-radius: 14px; overflow: hidden; background: #000; box-shadow: inset 0 0 60px rgba(0,0,0,.9); }
.tv-screen::before { content: "LIN·TV"; position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(40px,8vw,120px); font-weight: 800; letter-spacing: 8px; color: rgba(255,255,255,.05); background: radial-gradient(circle at 30% 30%, #1b1730 0%, #0a0814 60%, #050409 100%), repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 2px, transparent 2px 4px); }
.tv-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; z-index: 1; }
.scanlines { position: absolute; inset: 0; pointer-events: none; z-index: 3; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.16) 3px, rgba(0,0,0,.16) 4px); mix-blend-mode: multiply; opacity: .55; }
.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }
.glow { position: absolute; inset: 0; pointer-events: none; z-index: 5; box-shadow: inset 0 0 120px rgba(120,90,255,.1); }
.osd-ch { position: absolute; top: 16px; right: 20px; z-index: 6; font-family: "Courier New", monospace; font-size: 24px; font-weight: 700; color: #fff; text-shadow: 0 0 12px rgba(120,180,255,.9), 0 2px 4px #000; letter-spacing: 1px; }
.osd-name { position: absolute; top: 48px; right: 20px; z-index: 6; font-size: 13px; color: #cfe3ff; text-shadow: 0 1px 3px #000; max-width: 40vw; text-align: right; }
.ch-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 7; width: 60px; height: 60px; border-radius: 50%; cursor: pointer; border: 1px solid rgba(255,255,255,.18); background: rgba(10,10,20,.45); color: #fff; font-size: 36px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: .15s; backdrop-filter: blur(3px); }
.ch-arrow:hover { background: rgba(255,255,255,.16); transform: translateY(-50%) scale(1.08); }
.ch-arrow:active { transform: translateY(-50%) scale(.94); }
.ch-arrow.left { left: 14px; }
.ch-arrow.right { right: 14px; }
.ticker { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 9px; padding: 10px 18px; font-size: 13px; color: #e9f1ff; background: linear-gradient(to top, rgba(0,0,0,.78), transparent); text-shadow: 0 1px 3px #000; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 10px #ff4d4d; animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.sound-btn { position: absolute; top: 14px; left: 16px; z-index: 7; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 1px solid rgba(255,255,255,.15); background: rgba(10,10,20,.45); font-size: 18px; transition: .15s; }
.sound-btn:hover { background: rgba(255,255,255,.16); }
.tv-brand { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: 3px; color: #5a566b; padding-bottom: 4px; }
.tv-power { position: absolute; bottom: 9px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #6cff9e; box-shadow: 0 0 10px #6cff9e; }
#tv-strip { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; max-width: 94vw; }
.ch-chip { cursor: pointer; padding: 7px 13px; border-radius: 20px; font-size: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #cfc8e6; transition: .15s; }
.ch-chip:hover { border-color: rgba(255,255,255,.25); }
.ch-chip.active { background: #ffcf5c; color: #2a1d00; border-color: #ffcf5c; font-weight: 700; }
