/* 广东麻将 - 界面样式 */
:root{
  --felt-1:#2c6b4c; --felt-2:#17402e; --wood:#6b4423; --wood-2:#8a5a2b;
  --gold:#e8c265; --ink:#1f2a24;
  --m:#c0392b; --s:#1e8449; --p:#1f6fb2; --h:#2c3e50;
  --panel:#12231c; --panel-2:#1a3227;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
  background:radial-gradient(circle at 50% 0%,#2a3b34,#0d1613 70%);
  color:#eaf3ee; overflow:hidden;
}
#scale{width:100%;height:100%;display:flex;align-items:center;justify-content:center;transform-origin:center center}
#app{
  width:1240px;height:760px;display:grid;
  grid-template-columns:920px 1fr; grid-template-rows:56px 1fr;
  grid-template-areas:"top top" "table side";
  gap:10px;padding:10px;
}

/* ---------- 顶栏 ---------- */
#topbar{grid-area:top;display:flex;align-items:center;gap:16px;
  background:linear-gradient(#1c3629,#132619);border:1px solid #2c5340;border-radius:12px;padding:0 16px}
.logo{font-size:20px;font-weight:800;letter-spacing:3px;color:var(--gold);text-shadow:0 2px 0 #0006}
.logo .sub{font-size:12px;font-weight:500;letter-spacing:1px;color:#9fc4ae;margin-left:8px}
.meta{display:flex;gap:8px;margin-left:auto}
.chip{background:#0e1d16;border:1px solid #2c5340;border-radius:999px;padding:4px 12px;font-size:13px;color:#bfe0cd}
.topbtns{display:flex;gap:6px}

/* ---------- 牌桌 ---------- */
#table{
  grid-area:table;position:relative;border-radius:16px;
  background:
    radial-gradient(ellipse at 50% 42%, #357a58 0%, var(--felt-1) 45%, var(--felt-2) 100%);
  border:6px solid var(--wood); box-shadow:inset 0 0 60px #0008, 0 10px 30px #0009;
  display:grid;
  grid-template-columns:210px 1fr 210px;
  grid-template-rows:104px 1fr 168px;
  grid-template-areas:"t t t" "l c r" "b b b";
  padding:8px; overflow:hidden;
}
.seat-top{grid-area:t;display:flex;flex-direction:column;align-items:center;gap:6px;justify-content:center}
.seat-left{grid-area:l;display:flex;flex-direction:column;align-items:center;gap:6px;justify-content:center}
.seat-right{grid-area:r;display:flex;flex-direction:column;align-items:center;gap:6px;justify-content:center}
.seat-bottom{grid-area:b;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px}

.seat-card{display:flex;align-items:center;gap:6px;background:#0d1f17cc;border:1px solid #2c5340;
  border-radius:999px;padding:3px 10px;font-size:13px}
.seat-card .wind{width:20px;height:20px;border-radius:4px;background:#2b4a3a;color:#ffe9a8;
  display:grid;place-items:center;font-size:12px;font-weight:700}
.seat-card .wind.dealer{background:var(--gold);color:#3a2705}
.seat-card .nm{color:#cfe8da}
.seat-card .sc{font-weight:700;color:var(--gold);min-width:34px;text-align:right}
.seat-card.active{border-color:var(--gold);box-shadow:0 0 0 2px #e8c26555,0 0 14px #e8c26555}
.seat-card.mine{position:absolute;left:10px;bottom:10px}

.melds{display:flex;gap:8px;align-items:flex-end;min-height:42px;flex-wrap:wrap;justify-content:center}
.hand-back{display:flex;gap:2px}
.hand-back.vert{flex-direction:column;gap:2px}

/* ---------- 中央 ---------- */
#center{grid-area:c;position:relative;display:grid;
  grid-template-columns:1fr 200px 1fr; grid-template-rows:1fr 150px 1fr;
  grid-template-areas:". dtop ." "dleft info dright" ". dbottom .";
  place-items:center;
}
.dz{display:flex;flex-wrap:wrap;gap:2px;align-content:flex-start;justify-content:center}
.dz-top{grid-area:dtop;width:440px;align-self:start}
.dz-bottom{grid-area:dbottom;width:440px;align-self:end}
.dz-left{grid-area:dleft;width:132px;align-self:center}
.dz-right{grid-area:dright;width:132px;align-self:center}
.info{grid-area:info;width:150px;height:132px;border-radius:12px;
  background:#0d1f17aa;border:1px solid #ffffff1a;display:grid;place-items:center;text-align:center;color:#9fc4ae}
.info-wind{font-size:30px;font-weight:800;color:#ffe9a8;line-height:1}
.info-wall{font-size:26px;font-weight:800;color:#fff;line-height:1.1}
.info-cap{font-size:11px;letter-spacing:2px}
.info-turn{font-size:11px;margin-top:4px;color:var(--gold);min-height:14px}

/* ---------- 牌 ---------- */
.tile{
  width:42px;height:58px;border-radius:7px;flex:0 0 auto;position:relative;
  background:linear-gradient(150deg,#fffaf0,#f1e8ce);
  box-shadow:0 2px 0 #b9ad8c,0 4px 8px #0006, inset 0 1px 0 #fff;
  display:flex;align-items:center;justify-content:center;user-select:none;overflow:hidden
}
.tile svg{width:88%;height:88%;display:block;pointer-events:none}
.tile.sm{width:30px;height:42px}
.tile.xs{width:24px;height:34px}
.tile.back{background:linear-gradient(160deg,#3f8f6a,#1f5238);
  box-shadow:0 2px 0 #123a26,0 3px 5px #0006}
.tile.back svg{width:92%;height:92%}
.tile.back.h{width:30px;height:20px;border-radius:3px}
.tile.back.xs{width:24px;height:16px;border-radius:3px}
.tile.back.xs.h{width:30px;height:20px}
.tile.back.xs.h{width:24px;height:16px}

.tile.dim{opacity:.55;filter:saturate(.6)}
.tile.new::before{content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;
  border:2px solid var(--gold);border-radius:7px;animation:pulse 1s infinite;pointer-events:none}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}}

/* 我的手牌 */
.myrow{display:flex;align-items:flex-end;gap:14px}
.hand{display:flex;gap:3px;align-items:flex-end;min-height:62px}
.hand .tile{cursor:default;transition:transform .1s,box-shadow .1s}
.hand .tile.clickable{cursor:pointer}
.hand .tile.clickable:hover{transform:translateY(-10px);box-shadow:0 4px 0 var(--tile-edge),0 8px 14px #000a}
.hand .tile.drawn{margin-left:14px}
.hand .tile.drawn::after{content:"";position:absolute;left:-9px;top:50%;width:6px;height:6px;
  border-radius:50%;background:var(--gold);transform:translateY(-50%);pointer-events:none}
.hand .tile.rec{box-shadow:0 2px 0 #b9ad8c,0 0 0 2px #4fd1a5,0 0 12px #4fd1a5aa}

/* 操作按钮 */
.actions{display:flex;gap:8px;align-items:center;min-height:44px}
.btn{border:1px solid #ffffff22;background:#22392e;color:#dff0e6;border-radius:8px;
  padding:7px 14px;font-size:14px;cursor:pointer;transition:.12s;font-family:inherit}
.btn:hover{background:#2e4d3d}
.btn.primary{background:linear-gradient(#e0b458,#c9963b);color:#271a05;font-weight:800;border-color:#0000}
.btn.ghost{background:#ffffff10}
.btn.big{padding:12px 30px;font-size:17px}
.btn.act{min-width:56px;font-size:16px;font-weight:800;border-radius:10px;padding:10px 16px}
.btn.hu{background:linear-gradient(#ff7a5c,#d63f21);color:#fff;border-color:#0000}
.btn.gang{background:linear-gradient(#ffd166,#e0a52e);color:#3a2705;border-color:#0000}
.btn.peng{background:linear-gradient(#7fd1c0,#39a08c);color:#05231c;border-color:#0000}
.btn.chi{background:linear-gradient(#9fb8ff,#5a7fd6);color:#061228;border-color:#0000}
.btn.pass{background:#ffffff18;color:#cfe0d6}
.btn:disabled{opacity:.4;cursor:not-allowed}

.hint{min-height:20px;font-size:13px;color:#ffe9a8;letter-spacing:1px}
.hint b{color:#7cf0c0}
.hint .w{display:inline-block;background:#0d1f17;border:1px solid #2c5340;border-radius:4px;
  padding:0 5px;margin:0 2px;color:#fff;font-size:12px}

/* ---------- 侧栏 ---------- */
#side{grid-area:side;display:flex;flex-direction:column;gap:10px;min-height:0}
.panel{background:linear-gradient(#16291f,#0f1d16);border:1px solid #2c5340;border-radius:12px;padding:12px}
.panel.grow{flex:1;display:flex;flex-direction:column;min-height:0}
.panel h3{font-size:13px;letter-spacing:2px;color:#8fb6a3;font-weight:600;margin-bottom:8px}
.scoreboard{list-style:none;display:flex;flex-direction:column;gap:6px}
.scoreboard li{display:flex;align-items:center;gap:8px;background:#0d1f17aa;border-radius:8px;padding:7px 10px;font-size:14px}
.scoreboard li.me{border:1px solid var(--gold)}
.scoreboard .w{width:20px;height:20px;border-radius:4px;background:#2b4a3a;color:#ffe9a8;display:grid;place-items:center;font-size:12px;font-weight:700}
.scoreboard .n{flex:1;color:#cfe8da}
.scoreboard .v{font-weight:800;color:var(--gold);font-variant-numeric:tabular-nums}
.scoreboard .d{font-size:12px;width:44px;text-align:right;font-variant-numeric:tabular-nums}
.up{color:#ff7b6b}.down{color:#6fdc9a}
.logbox{flex:1;overflow-y:auto;font-size:13px;line-height:1.75;color:#b9d4c6;padding-right:4px}
.logbox div{border-bottom:1px dashed #ffffff10;padding:1px 0}
.logbox .sys{color:#7fae98}
.logbox .win{color:var(--gold);font-weight:700}
.logbox .meld{color:#8fd6ff}
.logbox .kong{color:#ffc98f}
.logbox::-webkit-scrollbar{width:6px}
.logbox::-webkit-scrollbar-thumb{background:#2c5340;border-radius:3px}

/* ---------- 弹窗 ---------- */
.modal{position:fixed;inset:0;background:#04100bcc;backdrop-filter:blur(3px);
  display:none;place-items:center;z-index:50}
.modal.show{display:grid}
.modal-box{background:linear-gradient(#1b3227,#122219);border:1px solid #3a6b53;border-radius:16px;
  padding:24px 28px;min-width:380px;max-width:640px;max-height:82vh;overflow:auto;
  box-shadow:0 20px 60px #000a;text-align:center}
.modal-box h2{font-size:20px;color:var(--gold);margin-bottom:16px;letter-spacing:2px}
.modal-btns{display:flex;gap:10px;justify-content:center;margin-top:18px}
.result-box{min-width:460px}
.res-title{font-size:34px;font-weight:900;letter-spacing:6px;color:var(--gold);text-shadow:0 3px 0 #0006}
.res-hand{display:flex;gap:3px;justify-content:center;flex-wrap:wrap;margin:18px 0 12px;align-items:flex-end}
.res-fan{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-bottom:12px}
.res-fan .f{background:#0d1f17;border:1px solid #2c5340;border-radius:8px;padding:5px 11px;font-size:13px}
.res-fan .f b{color:var(--gold);margin-left:6px}
.res-fan .tot{background:linear-gradient(#e0b458,#c9963b);color:#271a05;font-weight:900;border-color:#0000}
.res-score{font-size:14px;color:#cfe8da;line-height:1.9;margin-bottom:18px}
.res-score span{margin:0 8px;font-variant-numeric:tabular-nums}

.rules{text-align:left;font-size:13.5px;line-height:1.85;color:#cfe0d6}
.rules h4{color:var(--gold);margin:14px 0 6px;font-size:14px}
.rules h4:first-child{margin-top:0}
.rules table{width:100%;border-collapse:collapse;margin-top:6px}
.rules td{padding:3px 6px;border-bottom:1px solid #ffffff12}
.rules td:last-child{text-align:right;color:var(--gold);white-space:nowrap}
.rules em{color:#ffd98a;font-style:normal}
.rules p{color:#b6cec1}

.settings{display:flex;flex-direction:column;gap:12px;min-width:340px}
.settings .row{display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:14px}
.settings select{background:#0d1f17;color:#dff0e6;border:1px solid #2c5340;border-radius:8px;
  padding:6px 10px;font-size:13px;font-family:inherit;min-width:180px}
