/* 山西扣点点 · 网页版样式（拟真麻将皮肤 · 移动端竖屏优先） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #efe9d8;
  user-select: none;
  /* 深绿绒布桌面：多层径向渐变 + 细密织纹 */
  background:
    radial-gradient(ellipse at 50% 35%, rgba(46, 122, 71, 0.5), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 15% 8%, rgba(96, 168, 108, 0.35), transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(22, 92, 48, 0.55), transparent 50%),
    linear-gradient(180deg, #0d6b35 0%, #0a5c2e 45%, #07502a 100%);
  background-attachment: fixed;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* ---------- 顶部 ---------- */
header {
  padding: 12px 14px 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.h-title {
  font-size: 24px; font-weight: 800;
  color: #ffd76a;
  letter-spacing: 3px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5), 0 0 18px rgba(255,215,106,0.35);
}
.h-sub { font-size: 12px; color: #d8d2bf; }
.h-actions { display: flex; gap: 6px; margin-left: 6px; }
.h-tag {
  padding: 3px 10px;
  border-radius: 11px;
  font-size: 12px;
  color: #ffd76a;
  background: rgba(255,215,106,0.14);
  border: 1px solid rgba(255,215,106,0.45);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.h-tag:active { transform: scale(0.95); }
.h-room { font-size: 12px; color: #ffd76a; margin-left: auto; white-space: pre-line; text-align: right; line-height: 1.4; }

/* ---------- 大厅 ---------- */
.view { flex: 1; overflow-y: auto; }
.lobby-form { padding: 34px 26px; display: flex; flex-direction: column; gap: 14px; }
.ipt {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}
.ipt::placeholder { color: rgba(255,255,255,0.42); }
.ipt:focus { border-color: #ffd76a; }
.lobby-row { display: flex; gap: 12px; }
.btn {
  flex: 1;
  height: 46px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: scale(0.96); box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.btn-primary { background: linear-gradient(180deg, #f0b83d, #c98a1e 55%, #a86e10); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.btn-ghost { background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08)); border: 1px solid rgba(255,255,255,0.3); }
.btn-warn { background: linear-gradient(180deg, #e2574f, #b02a2a 55%, #8f1f1f); text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.btn-info { background: linear-gradient(180deg, #4a92e8, #2859a8 55%, #1d4482); text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.btn-plain { background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.1)); border: 1px solid rgba(255,255,255,0.32); }

.room-card {
  margin: 10px 26px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,215,106,0.35);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  text-align: center;
}
.rc-title { font-size: 19px; font-weight: 700; color: #ffd76a; margin-bottom: 12px; }
.rc-members { font-size: 13px; line-height: 1.9; color: #e9e2cd; margin-bottom: 14px; white-space: pre-line; }
.rc-tip { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 12px; }

/* ---------- 对局桌布 ---------- */
#view-game { display: flex; flex-direction: column; padding: 6px 8px 0; position: relative; }
.seat { position: relative; }
.seat-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.seat-name { color: #ffd76a; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.seat-score { color: #e6dfc9; }
.ting-badge, .dealer-badge {
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 11px;
  background: rgba(255,215,106,0.22);
  color: #ffd76a;
  border: 1px solid rgba(255,215,106,0.55);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.seat-top { text-align: center; padding: 4px 0; }
.seat-side { position: absolute; top: 62px; width: 100px; }
.seat-left { left: 0; }
.seat-right { right: 0; text-align: right; }

/* 牌 —— mahjong_graphic 开源麻将牌面（PNG 位图，可商用） */
.tile-img {
  display: block;
  width: 32px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
  position: relative;
  pointer-events: auto;
}
.tile-img.tile-sm { width: 20px; height: 27px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.tile-img.tile-xsm { width: 18px; height: 25px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }

.hand-back-row { display: flex; justify-content: center; gap: 2px; padding: 2px 0; }

.discard-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 1px; padding: 2px 0 4px; max-width: 250px; margin: 0 auto; }
.melds-row { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; padding: 2px 0; }
.meld { display: inline-flex; align-items: center; gap: 1px; background: rgba(0,0,0,0.2); border-radius: 6px; padding: 2px; border: 1px solid rgba(255,255,255,0.08); }
.meld-label { font-size: 9px; color: #ffd76a; margin-left: 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* 中央 */
.center { flex: 1; text-align: center; padding: 8px 4px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.last-discard { min-height: 58px; display: flex; align-items: center; justify-content: center; }
.ld-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ld-tile { width: 40px; height: 55px; border-radius: 6px; box-shadow: 0 5px 12px rgba(0,0,0,0.55); animation: ld-pop 0.18s ease-out; }
@keyframes ld-pop { from { transform: scale(0.65); opacity: 0.35; } to { transform: scale(1); opacity: 1; } }
.ld-name { font-size: 11px; color: #ffd76a; text-shadow: 0 1px 2px rgba(0,0,0,0.55); }
.c-lines { font-size: 12px; color: #e6dfc9; line-height: 1.6; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.c-lines .turn-active { color: #ffd76a; font-weight: 600; }
.hint { font-size: 14px; color: #ffd76a; font-weight: 600; min-height: 20px; padding: 4px 0; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.log { font-size: 11px; color: rgba(255,255,255,0.55); line-height: 1.5; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* 底部 */
.bottom { padding: 4px 6px 8px; }
#my-hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 100px;
  padding: 8px 4px;
}
#my-hand .tile-img { cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; width: 64px; height: 88px; touch-action: none; }
#my-hand .tile-img.selected {
  transform: translateY(-16px);
  box-shadow: 0 8px 14px rgba(0,0,0,0.5), 0 0 0 2px #ffd76a;
  border-radius: 6px;
}
#my-hand .tile-img.disabled { opacity: 0.35; filter: grayscale(0.5); }

.action-bar { display: flex; gap: 8px; justify-content: center; padding: 8px 0; min-height: 48px; flex-wrap: wrap; }
.action-bar .btn { flex: none; min-width: 66px; height: 40px; border-radius: 20px; font-size: 14px; }

/* 结算 */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.settle-card {
  width: 84%;
  max-width: 380px;
  background: linear-gradient(180deg, #11713a, #0a5c2e);
  border: 2px solid #ffd76a;
  border-radius: 16px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.12);
}
.settle-title { font-size: 22px; font-weight: 800; color: #ffd76a; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.settle-line { font-size: 13px; color: #e9e2cd; line-height: 1.7; }
.fan-tag { display: inline-block; margin: 2px; padding: 1px 9px; border-radius: 11px; background: rgba(255,215,106,0.2); color: #ffd76a; font-size: 12px; border: 1px solid rgba(255,215,106,0.4); }
.settle-scores { margin: 14px 0; font-size: 14px; line-height: 1.9; color: #fff; }
.settle-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.82);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 30;
  max-width: 80%;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}

/* 皮肤/规则弹层 */
.pop-card {
  width: 86%;
  max-width: 380px;
  max-height: 82%;
  overflow-y: auto;
  background: linear-gradient(180deg, #11713a, #0a5c2e);
  border: 2px solid #ffd76a;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.12);
}
.pop-title { font-size: 19px; font-weight: 800; color: #ffd76a; margin-bottom: 14px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.skin-list { display: flex; flex-direction: column; gap: 10px; }
.skin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.18);
  cursor: pointer;
  text-align: left;
}
.skin-item.active { border-color: #ffd76a; box-shadow: 0 0 0 1px #ffd76a, inset 0 0 12px rgba(255,215,106,0.08); }
.skin-item .skin-name { color: #fff; font-size: 15px; font-weight: 600; }
.skin-item .skin-desc { color: rgba(255,255,255,0.62); font-size: 12px; margin-top: 3px; }
.skin-item .skin-check { margin-left: auto; color: #ffd76a; font-size: 18px; font-weight: 800; }
.skin-prev { display: flex; gap: 3px; }
.skin-prev .tile-img { width: 22px; height: 30px; border-radius: 3px; }
.pop-rules .rules-body { text-align: left; }
.rule-sec { color: #ffd76a; font-weight: 700; font-size: 14px; margin: 12px 0 4px; }
.rule-p { color: #e9e2cd; font-size: 12.5px; line-height: 1.75; margin-bottom: 2px; }

.hidden { display: none !important; }

/* ---------- 横屏适配（按钮点击 / 旋转手机都会加 .landscape-mode，JS 统一控制） ---------- */
body.landscape-mode {
  #app { max-width: none; }
  header { padding: 6px 10px 3px; gap: 8px; }
  .h-title { font-size: 19px; letter-spacing: 2px; }
  .h-sub { font-size: 11px; }
  #view-game { padding: 3px 6px 0; }
  .seat-top { padding: 1px 0; }
  .seat-head { font-size: 12px; gap: 6px; }
  .seat-side { top: 40px; width: 86px; }
  .tile-img { width: 25px; height: 34px; border-radius: 4px; }
  .tile-img.tile-sm { width: 16px; height: 22px; }
  .tile-img.tile-xsm { width: 15px; height: 21px; }
  .discard-row { max-width: 175px; }
  .center { padding: 3px 2px; gap: 1px; }
  .last-discard { min-height: 42px; }
  .ld-tile { width: 30px; height: 41px; }
  .ld-name { font-size: 10px; }
  .c-lines { font-size: 11px; line-height: 1.4; }
  .hint { font-size: 12px; min-height: 15px; padding: 2px 0; }
  .log { display: none; }
  .bottom { padding: 2px 4px 3px; }
  #my-hand { min-height: 70px; gap: 5px; padding: 3px 2px; }
  #my-hand .tile-img { width: 46px; height: 63px; }
  .action-bar { padding: 3px 0; min-height: 36px; gap: 6px; }
  .action-bar .btn { height: 30px; min-width: 54px; border-radius: 15px; font-size: 12px; }
  .meld-label { font-size: 8px; }
  .lobby-form { padding: 14px 22px; gap: 9px; }
  .room-card { margin: 5px 22px; padding: 10px 16px; }
}

