/* 落地站样式 —— 版式 1:1 移植自 lottery-game-frontweb@mj/frontweb 的
 * src/styles/wokekj-room-entry.css。
 *
 * 移植时做的三件事:
 *  1. 去掉 .wokekj-skin 作用域前缀 —— 这里整站就这一个页面, 不需要皮肤隔离
 *  2. url(../assets/wokekj/x.png) → url(/assets/img/x.png)
 *  3. --u 由外层给死 375 宽手机列, 改成跟着视口走 (见下方 :root)
 *
 * --u 是原设计的基准单位: 原稿按 375 宽出图、1rem=37.5px, 换算下来 --u = 视口宽 / 100。
 * ⚠️ 不能直接写 100vw/100: 电脑上窗口一千多像素, 背景图和按钮会被拉到荒谬的大小
 * (lottery-game-frontweb 那边"电脑上铺满整屏"的坑踩过两次)。所以钳在 500px。
 */

:root {
  --u: calc(min(100vw, 500px) / 100);
}

* {
  box-sizing: border-box;
}

/* 必须放在所有 display 规则之前生效: 本文件给 .history-title 之类设了 display:flex,
 * 而 display:flex 的优先级高于 [hidden] 自带的 display:none —— 不加这条, JS 里
 * el.hidden = true 会**完全不起作用**, 空历史的标题会一直挂在页面上。 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #0d1b2a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

/* 宽屏时居中成一条手机列, 两侧留深色底 —— 跟游戏前端一个观感 */
body {
  display: flex;
  justify-content: center;
}

/* ── 页面骨架 ─────────────────────────────────────────────── */

.room-entry-page {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: url(/assets/img/login-bg.jpg) bottom / cover no-repeat;
  color: #fff;
  font-size: calc(3.2 * var(--u));
  -webkit-font-smoothing: antialiased;
}

.room-status {
  height: env(safe-area-inset-top, 0px);
  background: transparent;
}

/* ── 顶栏 ─────────────────────────────────────────────────── */

.room-header {
  height: calc(15.4667 * var(--u));
  display: flex;
  justify-content: space-between;
  padding: calc(0.8 * var(--u)) calc(5.3333 * var(--u)) 0;
  background: url(/assets/img/room-nav-bg.png) bottom / 100% auto no-repeat;
}

.room-user {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

.room-avatar {
  width: calc(12 * var(--u));
  height: calc(12 * var(--u));
  flex: 0 0 auto;
  border-radius: calc(1.3333 * var(--u));
  background: url(/assets/img/profile-avatar-thumb.png) center / cover no-repeat;
  overflow: hidden;
}

.room-user-copy {
  margin-left: calc(1.6 * var(--u));
  line-height: 1;
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.4 * var(--u)) rgba(0, 0, 0, 0.25);
}

.room-name {
  width: 6em;
  max-width: calc(24 * var(--u));
  overflow: hidden;
  font-size: calc(4 * var(--u));
  line-height: calc(4.5 * var(--u));
  white-space: nowrap;
  text-overflow: ellipsis;
}

.room-id {
  max-width: calc(26.6667 * var(--u));
  margin-top: calc(1.3333 * var(--u));
  overflow: hidden;
  font-size: calc(3.2 * var(--u));
  line-height: calc(3.8 * var(--u));
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── 主体 ─────────────────────────────────────────────────── */

.room-main {
  position: relative;
  padding-top: calc(5.3333 * var(--u));
  padding-bottom: calc(24 * var(--u)); /* 给右下角刷新按钮留出滚动余量 */
}

.room-tabs {
  display: flex;
  justify-content: center;
  gap: calc(3.2 * var(--u));
}

.room-tab {
  width: calc(25.3333 * var(--u));
  height: calc(8.6667 * var(--u));
  border: 0;
  padding: 0;
  color: #fff;
  font-size: calc(3.4667 * var(--u));
  line-height: calc(8.6667 * var(--u));
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.4 * var(--u)) rgba(0, 0, 0, 0.28);
  background: url(/assets/img/room-tab-active.png) center / 100% 100% no-repeat;
  appearance: none;
}

/* 6 格房号输入: 真 input 铺满整块且几乎透明, 数字画在下面 6 个 slot 上。
 * 这样既保住系统原生的数字键盘/粘贴/输入法, 又能长成一格一个数字的样子。 */
.room-code-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(2.5333 * var(--u));
  height: calc(21.3333 * var(--u));
  margin: calc(5.3333 * var(--u)) calc(4 * var(--u)) 0;
  border: 0;
  background: url(/assets/img/room-code-bg.png) center / 100% 100% no-repeat;
}

.room-code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  opacity: 0.01;
}

.room-code-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(10.1333 * var(--u));
  height: calc(10.1333 * var(--u));
  border-radius: calc(1.8667 * var(--u));
  color: #fff;
  font-size: calc(5.2 * var(--u));
  line-height: 1;
  background: transparent;
  text-shadow: 0 calc(0.3 * var(--u)) calc(0.5 * var(--u)) rgba(0, 0, 0, 0.36);
  pointer-events: none;
}

.room-remark {
  display: flex;
  align-items: center;
  width: calc(84 * var(--u));
  height: calc(5.6 * var(--u));
  margin: calc(4 * var(--u)) auto 0;
  font-size: calc(4 * var(--u));
  line-height: calc(5.6 * var(--u));
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.5 * var(--u)) rgba(0, 0, 0, 0.24);
}

.room-remark-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.room-checkbox {
  position: relative;
  width: calc(5.3333 * var(--u));
  height: calc(5.3333 * var(--u));
  margin-right: calc(1.6 * var(--u));
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: calc(0.5 * var(--u));
  background: rgba(255, 255, 255, 0.08);
}

.room-checkbox.checked::after {
  content: "";
  position: absolute;
  left: calc(1 * var(--u));
  top: calc(0.3 * var(--u));
  width: calc(1.8 * var(--u));
  height: calc(3.2 * var(--u));
  border: solid #62b6ff;
  border-width: 0 calc(0.5 * var(--u)) calc(0.5 * var(--u)) 0;
  transform: rotate(45deg);
}

.enter-room-btn {
  display: block;
  width: calc(84 * var(--u));
  height: calc(11.2 * var(--u));
  margin: calc(4 * var(--u)) auto;
  border: 0;
  padding: 0 0 calc(0.8 * var(--u));
  color: #fff;
  font-size: calc(4.5333 * var(--u));
  line-height: calc(11.2 * var(--u));
  text-shadow: 0 calc(0.3 * var(--u)) calc(0.6 * var(--u)) rgba(47, 31, 160, 0.75);
  background: url(/assets/img/enter-room-btn.png) center / 100% 100% no-repeat;
  appearance: none;
}

.enter-room-btn:disabled {
  filter: grayscale(0.5);
  opacity: 0.7;
}

/* ── 提示条 ───────────────────────────────────────────────── */

.room-hint {
  width: calc(84 * var(--u));
  margin: 0 auto calc(3 * var(--u));
  font-size: calc(3.6 * var(--u));
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.4 * var(--u)) rgba(0, 0, 0, 0.4);
}

.room-hint--error {
  color: #ffd7d0;
}

/* ── 房间历史 ─────────────────────────────────────────────── */

.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 calc(4 * var(--u));
  font-size: calc(4.2667 * var(--u));
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.4 * var(--u)) rgba(0, 0, 0, 0.24);
}

.history-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(4 * var(--u));
  height: calc(4 * var(--u));
  border-radius: 50%;
  color: #3bb7d3;
  background: rgba(255, 255, 255, 0.95);
  font-size: calc(3 * var(--u));
  font-weight: 700;
  text-shadow: none;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(5.3333 * var(--u));
  padding: 0;
}

.history-item {
  display: block;
  width: 25%;
  border: 0;
  padding: 0;
  margin-bottom: calc(5.3333 * var(--u));
  color: #fff;
  font-size: calc(3.7333 * var(--u));
  line-height: 1.08;
  text-align: center;
  text-shadow: 0 calc(0.2 * var(--u)) calc(0.4 * var(--u)) rgba(0, 0, 0, 0.5);
  background: transparent;
  appearance: none;
}

/* 历史条目的小图标。
 *
 * 原素材 room-history-avatar.png 是个带 "MJ" 字母标的占位头像 —— 那是品牌标识,
 * 本站明确不挂, 所以不用它。这里用一个内联的中性房子图形代替: 尺寸/圆角/浅色块
 * 都跟原来一致, 视觉重量不变, 但不带任何品牌信息, 也不多一个外部请求。 */
.history-item-icon {
  display: block;
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  margin: 0 auto calc(2.6667 * var(--u));
  border-radius: calc(2.1333 * var(--u));
  background: rgba(244, 246, 248, 0.92)
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="%23b4bcc4" d="M24 9 5.5 23.2a1.6 1.6 0 0 0 1 2.9H10V39a1.6 1.6 0 0 0 1.6 1.6h8.2V30.4h8.4v10.2h8.2A1.6 1.6 0 0 0 38 39V26.1h3.5a1.6 1.6 0 0 0 1-2.9Z"/></svg>')
    center / 62% auto no-repeat;
}

.history-item span {
  display: block;
}

/* ── 右下角刷新 ───────────────────────────────────────────── */

/* fixed 定位要贴的是那条居中手机列的右边, 不是浏览器窗口的右边, 否则宽屏上会飘到
 * 页面最右侧、离内容十万八千里。 */
.refresh-float {
  position: fixed;
  right: calc(50vw - min(50vw, 250px) - 0.4 * var(--u));
  bottom: calc(18.2 * var(--u));
  width: calc(17.2 * var(--u));
  height: calc(11.8 * var(--u));
  border: 0;
  border-radius: calc(6.4 * var(--u)) 0 0 calc(6.4 * var(--u));
  padding: 0;
  background: rgba(255, 255, 255, 0.65);
  appearance: none;
}

.refresh-float::before {
  content: "";
  position: absolute;
  inset: calc(0.8 * var(--u)) calc(2.8 * var(--u)) calc(0.8 * var(--u)) calc(3 * var(--u));
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.96-.7 2.8l1.46 1.46C19.54 14.98 20 13.54 20 12c0-4.42-3.58-8-8-8ZM6.7 9.2 5.24 7.74C4.46 9.02 4 10.46 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3c-3.31 0-6-2.69-6-6 0-1.01.25-1.96.7-2.8Z"/></svg>')
    center / contain no-repeat;
}

.room-refresh {
  bottom: calc(19.5 * var(--u));
}

/* ── 进房后的游戏容器 (原样保留) ──────────────────────────── */

.frame-container {
  position: fixed;
  inset: 0;
  background: #000;
}

.content-frame {
  width: 100%;
  height: 100%;
  border: none;
}
