* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; background: #12141c; color: #e8e6df; }
#app { max-width: 560px; margin: 0 auto; padding: 12px 12px 90px; }
button { font-family: inherit; border: 0; border-radius: 10px; cursor: pointer; font-size: 16px; }
input, select { font-family: inherit; font-size: 16px; border-radius: 10px; border: 1px solid #3a3f52; background: #1d2130; color: #fff; padding: 10px 12px; }
label { display: block; margin: 14px 0 6px; color: #9aa3b8; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; }
.row button, .go { background: #3f6fff; color: #fff; padding: 10px 18px; font-weight: 700; }
.dicebtn { background: #2c3350 !important; font-size: 24px; padding: 8px 14px !important; }
.dicebtn:active { transform: rotate(180deg) scale(1.1); }
.wide { display: block; width: 100%; margin: 12px 0; padding: 14px; font-size: 18px; font-weight: 700; }
.primary { background: linear-gradient(135deg, #3f6fff, #7a4dff); color: #fff; }
.danger { background: linear-gradient(135deg, #ff4d4d, #c92a2a); color: #fff; }
.lite { background: #262b3d; color: #cfd6e6; padding: 8px 12px; }

/* 大廳 */
.hero { text-align: center; padding: 108px 8px 14px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, rgba(18,20,28,.05) 0%, rgba(18,20,28,.55) 55%, rgba(18,20,28,.92) 100%), url(assets/hero.webp) center 30%/cover no-repeat #2a2f45; }
.hero h1 { font-size: 30px; letter-spacing: 2px; text-shadow: 0 2px 8px #000; }
.hero p { color: #e0e4ee; margin-top: 6px; font-size: 14px; text-shadow: 0 1px 4px #000; }
.hero .off { color: #ffb84d; }
.card { background: #1a1e2c; border: 1px solid #262b3d; border-radius: 16px; padding: 14px 16px 18px; margin-top: 14px; }
.card > input { width: 100%; }
.newbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.newbtns .big { display: flex; flex-direction: column; gap: 4px; padding: 14px 6px; font-size: 26px; color: #fff; }
.newbtns .big b { font-size: 15px; } .newbtns .big small { font-size: 11px; opacity: .85; font-weight: 400; }
.big.chui { background: linear-gradient(160deg, #7a4dff, #4d2fb3); }
.big.croc { background: linear-gradient(160deg, #2eaf5e, #1d7a3f); }
.big.bomb { background: linear-gradient(160deg, #ff7a2e, #c9481d); }
.big.g350 { background: linear-gradient(160deg, #e0a72e, #a86f14); }
.big.g18 { background: linear-gradient(160deg, #c04848, #7a1f1f); }
.big.sicbo { background: linear-gradient(160deg, #8e44ad, #5b2c6f); }
.big.codeg { background: linear-gradient(160deg, #2980b9, #1a5276); }

/* 骰寶 */
.betbtns { display: flex; gap: 12px; margin: 14px 0; }
.betbtns button { flex: 1; padding: 22px 0 16px; font-size: 34px; font-weight: 900; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; border: 3px solid transparent; }
.betbtns button small { font-size: 13px; font-weight: 400; opacity: .85; }
.betbig { background: linear-gradient(160deg, #c0392b, #7c1f14); color: #fff; }
.betsmall { background: linear-gradient(160deg, #2471a3, #154360); color: #fff; }
.betbtns button.sel { border-color: #ffd166; box-shadow: 0 0 18px #ffd16688; transform: scale(1.03); }
.betlist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 14px; color: #b9c1d4; text-align: left; }

/* 350 */
.panel.g350 { text-align: center;
  background: linear-gradient(180deg, rgba(24,16,8,.72), rgba(24,16,8,.9)), url(assets/bowl.webp) center/cover no-repeat #1a1e2c; }
.bowl { min-height: 96px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px;
  background: radial-gradient(ellipse at center, #3a2d17e6 0%, #241a0cf0 75%); border: 3px solid #6b5326;
  border-radius: 50% / 38%; margin: 4px auto 12px; max-width: 340px; padding: 14px 24px; box-shadow: inset 0 6px 18px #000a, 0 4px 14px #0008; }
.bowl em { font-style: normal; font-size: 40px; line-height: 1; color: #fff; }
.bowl em.d100 { color: #ff6b6b; text-shadow: 0 0 12px #ff6b6b88; }
.bowl em.d50 { color: #ffd166; text-shadow: 0 0 12px #ffd16688; }
.bowlhint { color: #8a7548; font-size: 15px; }
.bowl.shaking { animation: bowlshake .28s infinite; }
@keyframes bowlshake { 0%,100% { transform: translate(0,0) rotate(0); } 25% { transform: translate(-3px,1px) rotate(-1.2deg); } 50% { transform: translate(2px,-2px) rotate(.8deg); } 75% { transform: translate(3px,1px) rotate(1.2deg); } }
em.rollin { display: inline-block; animation: tumble .3s infinite linear; color: #fff; }
@keyframes tumble { 0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(90deg) translateY(-6px); } 50% { transform: rotate(180deg) translateY(0); } 75% { transform: rotate(270deg) translateY(-4px); } 100% { transform: rotate(360deg) translateY(0); } }
em.popin { display: inline-block; animation: pop .3s; }
@keyframes pop { 0% { transform: scale(1.7); } 60% { transform: scale(.85); } 100% { transform: scale(1); } }
.stopbig { background: linear-gradient(135deg, #2eaf5e, #1d7a3f); color: #fff; font-size: 20px; padding: 16px;
  border: 2px solid #7de08d; box-shadow: 0 0 18px #2eaf5e88; animation: glowpulse 1.3s infinite; }
.scboard { margin-top: 14px; text-align: left; }
.scline { display: flex; justify-content: space-between; padding: 4px 8px; border-bottom: 1px dashed #2e3550; font-size: 14px; }
.scline span { color: #ffd166; }
.roomcard { display: flex; align-items: center; gap: 12px; background: #222739; border-radius: 12px; padding: 12px; margin-top: 8px; cursor: pointer; }
.roomcard:active { background: #2c3350; }
.roomcard .ric { font-size: 28px; }
.rmeta { flex: 1; } .rmeta small { display: block; color: #9aa3b8; margin-top: 2px; }
.rn { color: #7de08d; font-weight: 700; }
.empty { color: #6c7690; text-align: center; padding: 18px 0 6px; }

/* 房間 */
.roombar { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.rtitle { flex: 1; text-align: center; } .rtitle small { display: block; color: #9aa3b8; }
.code { color: #ffd166; letter-spacing: 2px; }
.pbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pchip { background: #222739; border: 1px solid #2e3550; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.pchip.turn { border-color: #ffd166; background: #3a3420; box-shadow: 0 0 8px #ffd16655; }
.pchip.out { opacity: .38; text-decoration: line-through; }
.pchip.off { opacity: .55; }
.pchip i { font-style: normal; margin-left: 4px; color: #ffd166; }
.gswitch { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; -webkit-overflow-scrolling: touch; }
.gswitch button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #1a1e2c; border: 1px solid #2e3550; border-radius: 10px; padding: 6px 10px; font-size: 20px; color: #cfd6e6; }
.gswitch button small { font-size: 10px; color: #8b94ab; }
.gswitch button.cur { border-color: #ffd166; background: #3a3420; box-shadow: 0 0 8px #ffd16644; }
.gswitch button.cur small { color: #ffd166; }
.timer { text-align: center; color: #ffd166; font-weight: 700; padding: 4px; }
.timer.hurry { color: #ff6b6b; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.panel { background: #1a1e2c; border: 1px solid #262b3d; border-radius: 16px; padding: 16px; margin: 10px 0; }
.panel.intro p { color: #b9c1d4; line-height: 1.7; font-size: 15px; }
.panel.intro p + p { margin-top: 8px; }
.wait { text-align: center; color: #8b94ab; padding: 12px; }

.drinkcall { text-align: center; background: linear-gradient(160deg, #a01818, #5e0c0c); border: 2px solid #ff6b6b;
  color: #fff; font-size: 22px; font-weight: 900; padding: 18px 12px; border-radius: 16px; margin: 8px 0;
  box-shadow: 0 0 24px #ff4d4d66; animation: glowpulse 1.2s infinite; }
.drinkcall .dnames { font-size: 30px; color: #ffd166; margin: 8px 0; text-shadow: 0 2px 6px #000; word-break: break-all; }
.yourturn { text-align: center; background: linear-gradient(90deg, #3a3420, #4a3714, #3a3420); color: #ffd166;
  font-weight: 900; font-size: 18px; padding: 10px; border-radius: 12px; margin: 6px 0; box-shadow: 0 0 14px #ffd16633; animation: glowpulse 1.4s infinite; }
@keyframes glowpulse { 50% { box-shadow: 0 0 26px #ffd16677; } }
.pchip .kick { margin-left: 6px; color: #ff6b6b; text-decoration: none; font-weight: 900; cursor: pointer; padding: 0 2px; }
.invite .invbig { text-align: center; font-size: 18px; margin: 8px 0 4px; line-height: 1.7; }

/* 吹牛喊注選擇器 */
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; }
.stepper button { width: 54px; height: 54px; font-size: 28px; font-weight: 900; background: #2c3350; color: #fff; border-radius: 14px; }
.stepper button:active { background: #3f6fff; }
.stepper b { font-size: 32px; min-width: 48px; text-align: center; color: #ffd166; }
.stepper span { color: #9aa3b8; }
.facechips { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.facechips button { flex: 1; max-width: 62px; padding: 6px 0 4px; font-size: 26px; line-height: 1.1; background: #222739; color: #cfd6e6; border: 2px solid #2e3550; border-radius: 12px; display: flex; flex-direction: column; align-items: center; }
.facechips button small { font-size: 11px; color: #8b94ab; }
.facechips button.sel { border-color: #ffd166; background: #3a3420; color: #fff; box-shadow: 0 0 10px #ffd16644; }
.go:disabled, .wide:disabled { opacity: .45; }

/* 吹牛骰 */
.bidnow { font-size: 17px; margin-bottom: 10px; }
.bidnow b { color: #ffd166; font-size: 22px; }
.bidnow small { color: #8b94ab; }
.mydice { font-size: 15px; color: #9aa3b8; margin-bottom: 12px; }
.mydice em, .rvrow em { font-style: normal; font-size: 34px; line-height: 1; color: #fff; margin-right: 2px; }
.actbox select { padding: 12px; font-size: 18px; }
.actbox .row { justify-content: center; margin-bottom: 10px; }
.reveal h3 { color: #ffd166; margin-bottom: 10px; font-size: 16px; }
.rvrow { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.rvrow b { min-width: 72px; font-size: 14px; }
.rvrow em.hit { text-shadow: 0 0 10px #ffd166; color: #ffd166; }
.reveal p { margin-top: 10px; color: #b9c1d4; }

/* 鱷魚拔牙 */
.panel.croc { border-color: #1d7a3f66;
  background: linear-gradient(180deg, rgba(8,26,14,.55), rgba(8,26,14,.88)), url(assets/croc.webp) center/cover no-repeat #14351f; }
.crochead { text-align: center; margin-bottom: 12px; color: #c9ecd2; font-weight: 700; text-shadow: 0 1px 3px #000; }
.teeth { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.tooth { font-size: 24px; padding: 10px 0; background: #fffef5; border-radius: 10px; box-shadow: 0 3px 0 #b9b39a; }
.tooth:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #b9b39a; }
.tooth.pressed { background: #2c3350; color: #6c7690; box-shadow: none; }
.tooth.sore { background: #ff4d4d; animation: shake .5s; }
.tooth:disabled { cursor: default; opacity: .9; }
.tooth.pressed:disabled { opacity: .5; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* 猜炸彈 */
.panel.bomb { text-align: center; }
.bombimg { height: 96px; display: block; margin: 0 auto 10px; filter: drop-shadow(0 4px 10px #000a); }
.bombimg.scared { animation: bowlshake .35s infinite; }
.range { font-size: 20px; margin-bottom: 12px; }
.range b { color: #ffd166; font-size: 30px; }
.boom { font-size: 26px; color: #ff6b6b; font-weight: 900; margin: 10px 0; animation: shake .5s; }
.panel.bomb input { width: 130px; text-align: center; font-size: 22px; }
.panel.bomb .row { justify-content: center; }
.lastg { margin-top: 12px; color: #8b94ab; font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 10px; }
.box { font-size: 24px; padding: 8px 0; background: #262b3d; border: 1px solid #3a3f52; border-radius: 10px; min-height: 46px; }
.box:active:not(:disabled) { transform: scale(.92); background: #3a3420; }
.box.opened { background: #151824; border-color: #22273a; opacity: .45; }
.box.isbomb { background: #a01818; border-color: #ff6b6b; animation: shake .5s; opacity: 1; }
.box:disabled { cursor: default; }
.boomover { position: fixed; inset: 0; z-index: 99; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, #ff8a3d99 0%, #a0181866 45%, #000c 100%); animation: boomflash 1.8s forwards; pointer-events: none; }
.boomover span { font-size: 40vw; animation: boomgrow 1.8s forwards; }
@keyframes boomflash { 0% { opacity: 0; } 8% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes boomgrow { 0% { transform: scale(.1) rotate(-15deg); } 25% { transform: scale(1.25) rotate(6deg); } 45% { transform: scale(.95); } 100% { transform: scale(1.1); } }

/* 記錄 + 聊天 */
.logchat { margin-top: 12px; }
.log { background: #151824; border-radius: 12px 12px 0 0; border: 1px solid #262b3d; border-bottom: 0;
  max-height: 130px; overflow-y: auto; padding: 10px 12px; font-size: 13px; color: #9aa3b8; line-height: 1.8; }
.chat { background: #10131d; border: 1px solid #262b3d; max-height: 110px; overflow-y: auto; padding: 8px 12px; font-size: 14px; line-height: 1.8; }
.chat b { color: #7db5e0; }
.chatrow { padding: 8px; background: #151824; border: 1px solid #262b3d; border-top: 0; border-radius: 0 0 12px 12px; }

.reconn { background: #4a3714; color: #ffd166; text-align: center; padding: 8px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; animation: blink 1.6s infinite; }

/* QR 邀請 */
.qrmask { position: fixed; inset: 0; background: #000a; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.qrbox { background: #1a1e2c; border: 1px solid #3a3f52; border-radius: 20px; padding: 20px; text-align: center; max-width: 340px; width: 100%; }
.qrbox h3 { margin-bottom: 12px; }
.qrbox img { width: 100%; max-width: 260px; border-radius: 12px; background: #fff; padding: 6px; }
.qrbox .qrcode-text { margin: 10px 0 4px; font-size: 16px; }
.introqr { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.introqr img { width: 128px; height: 128px; border-radius: 10px; background: #fff; padding: 4px; flex: none; }
.introqr div { line-height: 1.9; font-size: 15px; }
.introqr small { color: #9aa3b8; }

.tip { color: #8b94ab; font-size: 13px; text-align: center; padding: 14px 10px 4px; line-height: 1.7; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #ffd166; color: #201a00; font-weight: 700; padding: 10px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
