/* ============ 扫雷联机版 · 公共样式 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #e8eef8;
  background: radial-gradient(900px 700px at 50% -10%, #1a2941 0%, #0b0f17 55%, #070a10 100%);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- 顶部导航 ---------- */
.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.topnav .back {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 17px;
  color: #a9b8cc;
  transition: background .18s;
}
.topnav .back:active { background: rgba(255,255,255,.1); }
.topnav h1 {
  flex: 1; min-width: 0;
  margin: 0;
  font-size: 17px; font-weight: 800; letter-spacing: .06em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 面板 ---------- */
.panel {
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.note { margin: 0; font-size: 13px; line-height: 1.7; color: #93a4ba; }
.note b { color: #e8eef8; }
.steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; color: #93a4ba; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: #8fa1b8; }
.field input, .field select, .input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(0,0,0,.26);
  color: #e8eef8;
  font-size: 14px; font-weight: 600;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input::placeholder, .input::placeholder { color: #5f7189; font-weight: 500; }
.field input:focus, .field select:focus, .input:focus {
  border-color: rgba(47,124,246,.7);
  box-shadow: 0 0 0 3px rgba(47,124,246,.15);
}
.field select option { background: #151c28; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 560px) {
  .form-grid { grid-template-columns: 1.2fr .9fr .9fr; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.07);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px; font-weight: 800;
  text-align: center;
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(160deg, #2f7cf6, #1d5bd0);
  box-shadow: 0 10px 24px -12px rgba(47,124,246,.9);
}
.btn.pink {
  border-color: transparent;
  background: linear-gradient(160deg, #ff6b8a, #e11d48);
  box-shadow: 0 10px 24px -12px rgba(225,29,72,.9);
}
.btn.ghost { background: rgba(255,255,255,.05); color: #a9b8cc; }
.btn.small { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.btn.block { width: 100%; }

/* ---------- 入口页 ---------- */
.entry { justify-content: center; gap: 26px; }
.entry-head { text-align: center; }
.logo-badge {
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  font-size: 30px;
  border-radius: 20px;
  background: linear-gradient(150deg, #2b3b52, #1a2537);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 20px 40px -18px #000, inset 0 1px 0 rgba(255,255,255,.12);
}
.entry-head h1 { margin: 0 0 6px; font-size: 30px; font-weight: 900; letter-spacing: .3em; text-indent: .3em; }
.entry-head p { margin: 0; font-size: 10px; letter-spacing: .34em; color: #6f8099; text-indent: .34em; }
.entry-cards { display: grid; gap: 14px; }
@media (min-width: 620px) { .entry-cards { grid-template-columns: 1fr 1fr; } }
.entry-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(47,124,246,.16), rgba(255,255,255,.03) 60%);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 24px 50px -30px #000;
  transition: transform .18s ease, box-shadow .18s ease;
  touch-action: manipulation;
}
.entry-card.online {
  background: linear-gradient(160deg, rgba(225,29,72,.18), rgba(255,255,255,.03) 60%);
}
.entry-card:active { transform: scale(.985); }
@media (hover: hover) {
  .entry-card:hover { transform: translateY(-2px); box-shadow: 0 30px 60px -30px #000; }
}
.entry-icon { font-size: 30px; line-height: 1; }
.entry-card h2 { margin: 6px 0 0; font-size: 20px; letter-spacing: .06em; }
.entry-card p { margin: 0; font-size: 13px; line-height: 1.75; color: #93a4ba; }
.entry-cta { margin-top: 10px; font-size: 13px; font-weight: 800; color: #7db2ff; }
.entry-card.online .entry-cta { color: #ff8fa6; }
.entry-foot { text-align: center; font-size: 11px; letter-spacing: .18em; color: #4f6178; }

/* ---------- 大厅 ---------- */
.nick-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 999px;
}
.nick-chip input {
  width: 84px;
  background: transparent;
  border: 0;
  color: #e8eef8;
  font-size: 12.5px; font-weight: 700;
  outline: none;
  text-align: right;
}
.nick-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }

.join-row { display: flex; gap: 10px; }
.join-row .input { flex: 1; text-align: center; letter-spacing: .3em; font-weight: 800; font-size: 16px; }
.join-row .btn { flex: 0 0 auto; padding-left: 22px; padding-right: 22px; }

.rooms-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 2px 0; }
.rooms-head h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.rooms-head span { font-size: 11.5px; color: #6f8099; }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  transition: background .15s, transform .08s;
  text-align: left;
  width: 100%;
  color: inherit;
}
.room-card:active { transform: scale(.992); background: rgba(255,255,255,.07); }
.room-card .info { flex: 1; min-width: 0; }
.room-card .name {
  font-size: 14px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-card .meta {
  margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 11px; color: #8fa1b8;
}
.room-card .arrow { color: #5f7189; font-size: 16px; flex: 0 0 auto; }
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 800;
  background: rgba(255,255,255,.07);
  color: #a9b8cc;
}
.badge.blue { background: rgba(47,124,246,.14); color: #7db2ff; }
.badge.pink { background: rgba(225,29,72,.15); color: #ff8fa6; }
.badge.green { background: rgba(61,220,151,.13); color: #54e0a4; }
.badge.amber { background: rgba(240,161,58,.14); color: #ffbf70; }
.empty {
  margin: 0; padding: 26px 10px;
  text-align: center; font-size: 12.5px; color: #5f7189;
  border: 1px dashed rgba(255,255,255,.09);
  border-radius: 14px;
}

/* ---------- 房间页 ---------- */
.code-card {
  text-align: center;
  padding: 18px 16px 16px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(47,124,246,.16), rgba(255,255,255,.03) 65%);
  border: 1px solid rgba(255,255,255,.09);
}
.code-card .label { font-size: 11px; letter-spacing: .26em; color: #8fa1b8; text-indent: .26em; }
.code {
  margin: 8px 0 12px;
  font-size: 40px; font-weight: 900;
  letter-spacing: .24em; text-indent: .24em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.room-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #8fa1b8;
  padding: 0 4px;
}
.room-meta .timeout { color: #ffbf70; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  min-width: 0;
}
.player-row .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; flex: 0 0 auto; }
.player-row .pname {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-row .crown { font-size: 12px; }
.player-row .kick {
  border: 0;
  background: rgba(225,29,72,.15);
  color: #ff8fa6;
  font-size: 10.5px; font-weight: 800;
  padding: 5px 8px;
  border-radius: 8px;
}
.room-actions { display: flex; gap: 10px; }
.room-actions .btn { flex: 1; }
.tip { margin: 0; text-align: center; font-size: 10.5px; line-height: 1.6; color: #5f7189; }

/* 续命模式开关 */
.revive-panel { padding: 14px 16px; }
.revive-row { display: flex; align-items: center; gap: 14px; }
.revive-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.revive-info h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.switch {
  position: relative;
  width: 52px; height: 30px; flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
  transition: background .18s, border-color .18s;
}
.switch span {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #8fa1b8;
  transition: transform .18s, background .18s, box-shadow .18s;
}
.switch.on { background: rgba(61,220,151,.28); border-color: rgba(61,220,151,.55); }
.switch.on span { transform: translateX(22px); background: #3ddc97; box-shadow: 0 0 10px #3ddc97; }
/* ============ 统一轮播图 ============ */
.banner-wrap {
  position: relative;
  border-radius: 16px;
  /* 不裁剪：容器高度由图片自然撑开 */
  min-height: 120px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
}
.banner-track {
  display: flex; width: 100%;
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.banner-slide {
  flex: 0 0 100%;
  position: relative;
  text-align: center;
  background: linear-gradient(135deg, #1e2a3a, #111927);
}
.banner-slide img {
  max-width: 100%;
  max-height: 420px;      /* 上限防超大图 */
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;   /* 完整显示，不裁剪 */
  opacity: 0;
  transition: opacity .4s ease;
  border-radius: 14px;
}
.banner-slide.loaded img { opacity: 1; }
.banner-slide.img-fail {
  background: linear-gradient(135deg, #2a3a4a, #1a2535);
  display: grid; place-items: center;
}
.banner-slide.img-fail::before {
  content: '🖼️ 图片加载失败';
  color: #4b5a72; font-size: 12px;
}
.banner-slide::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55));
  pointer-events: none;
}
.banner-caption {
  position: absolute; left: 16px; right: 16px; bottom: 12px;
  z-index: 2;
  color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.banner-caption h3 { margin: 0 0 2px; font-size: 15px; font-weight: 800; }
.banner-caption p { margin: 0; font-size: 11.5px; opacity: .9; }
.banner-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 3;
}
.banner-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  transition: all .2s;
  cursor: pointer;
}
.banner-dots span.on { background: #fff; width: 14px; border-radius: 3px; }

/* 对局页紧凑版 */
.play-banner-wrap {
  position: relative;
  border-radius: 10px;
  /* 对局页也不裁剪，但限制最大高度 */
  max-height: 160px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  flex: 0 0 auto;
  overflow: hidden;
}
.play-banner-wrap .banner-slide img { max-height: 150px; border-radius: 8px; }
.play-banner-wrap .banner-caption h3 { font-size: 13px; }
.play-banner-wrap .banner-caption p { font-size: 10.5px; }
.play-banner-wrap .banner-dots { bottom: 4px; }
.play-banner-wrap .banner-dots span { width: 4px; height: 4px; }
.play-banner-wrap .banner-dots span.on { width: 10px; }

/* 雷数设置 */
.mines-panel { padding: 14px 16px; gap: 12px; }
.mines-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mines-head h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.mines-num-wrap { flex: 0 0 auto; }
.mines-num-wrap input {
  width: 72px; text-align: center;
  font-weight: 800;
  padding: 7px 8px;
}
.mines-slider-wrap { display: flex; flex-direction: column; gap: 6px; }
.mines-slider-wrap input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  outline: none;
  margin: 6px 0;
}
.mines-slider-wrap input[type=range]:disabled { opacity: .4; }
.mines-slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(160deg, #ff6b8a, #e11d48);
  border: 2px solid #101823;
  cursor: pointer;
  box-shadow: 0 4px 10px -2px rgba(225,29,72,.6);
}
.mines-slider-wrap input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(160deg, #ff6b8a, #e11d48);
  border: 2px solid #101823;
  cursor: pointer;
  box-shadow: 0 4px 10px -2px rgba(225,29,72,.6);
}
.density-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
}
.density-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(61,220,151,.8), rgba(240,161,58,.8), rgba(225,29,72,.9));
  transition: width .15s ease;
}
.mines-row-info {
  display: flex; gap: 16px; justify-content: space-between;
  font-size: 11px; color: #8fa1b8; letter-spacing: .04em;
}
.mines-row-info b { color: #cfe0f5; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 加入顺序编号 */
.order-idx {
  width: 18px; height: 18px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  font-size: 10px; font-weight: 800;
  color: #8fa1b8;
}

/* 入口卡片改为按钮时的复位 */
button.entry-card { width: 100%; text-align: left; color: inherit; font: inherit; }

/* 结算排名 */
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 11px;
  font-size: 12.5px;
}
.rank-row .idx { width: 20px; color: #6f8099; font-weight: 800; text-align: center; }
.rank-row .rname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-row .rval { color: #93a4ba; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.rank-row.win { border-color: rgba(61,220,151,.3); background: rgba(61,220,151,.08); }

/* ---------- 浮层 / 提示 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(6,9,14,.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.overlay.show { opacity: 1; visibility: visible; }
.overlay .card {
  width: min(340px, 100%);
  padding: 24px 20px 20px;
  text-align: center;
  border-radius: 22px;
  background: linear-gradient(170deg, #1d2839, #111a26);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 30px 80px -24px #000;
  transform: translateY(14px) scale(.96);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.25);
  display: flex; flex-direction: column; gap: 10px;
}
.overlay.show .card { transform: none; }
.overlay .emoji { font-size: 42px; line-height: 1; }
.overlay h2 { margin: 0; font-size: 20px; letter-spacing: .04em; }
.overlay p { margin: 0 0 6px; font-size: 13px; line-height: 1.7; color: #93a4ba; }
.overlay p b { color: #e8eef8; }

.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: 84vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: #1d2839;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 18px 40px -16px #000;
  font-size: 13px; font-weight: 600;
  color: #fff;
  text-align: center;
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity .22s, transform .22s, visibility .22s;
  z-index: 80;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* 口令弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5,8,13,.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: .2s;
}
.modal.show { opacity: 1; visibility: visible; }
.modal-card {
  width: min(340px, 100%);
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(170deg, #1d2839, #111a26);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 80px -24px #000;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-card h3 { margin: 0; font-size: 16px; }
.modal-card p { margin: 0; font-size: 12px; color: #8fa1b8; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* 死信页 */
.fatal { align-items: center; justify-content: center; text-align: center; }
.fatal .emoji { font-size: 46px; }
.fatal h1 { margin: 0; font-size: 20px; letter-spacing: .06em; }
.fatal p { margin: 0; max-width: 380px; font-size: 13px; line-height: 1.8; color: #93a4ba; }

@media (max-width: 380px) {
  .code { font-size: 34px; }
  .nick-chip input { width: 70px; }
  .join-row .btn { padding-left: 16px; padding-right: 16px; }
}
