/* 墨契 · 联机房间界面样式（配套 js/pvp/screens.js 与 js/pvp/ui.js）
   只在 #pvp-panel 里生效；主页骨架（.pvp-head / #pvp-menu / 齿轮）归 css/pvp.css，这里一个都不覆盖。
   类名统一 p 前缀，避免和 style.css 的 .card / .panel / .line 撞车。 */

.pvpscreens { position: relative; width: min(1080px, 100%); margin: 0 auto; padding: 4px 0 40px; }
.pvpscreens h3 { margin: 0 0 12px; font-size: 22px; letter-spacing: 6px; color: #f3e6cb; font-weight: 600; }
.pempty { margin: 18px 0; color: #9c8a70; font-size: 15px; line-height: 1.8; }
.pvperror {
  margin: 14px 0 0; padding: 10px 14px; font-size: 14px; color: #ffb3a2;
  background: rgba(88, 26, 18, 0.55); border: 1px solid rgba(179, 74, 52, 0.55); border-radius: 3px;
}
.pvpconn {
  position: sticky; top: 0; z-index: 4; display: inline-block; margin: 6px 0 0;
  padding: 3px 10px; font-size: 12px; letter-spacing: 1px; border-radius: 999px;
  background: rgba(24, 17, 11, 0.9); border: 1px solid rgba(201, 162, 74, 0.35); color: #a9977c;
}
.pvpconn.is-open { color: #9fd3a8; border-color: rgba(110, 170, 110, 0.5); }
.pvpconn.is-reconnecting, .pvpconn.is-connecting { color: #f0c881; }
.pvpconn.is-offline, .pvpconn.is-closed { color: #e08b78; border-color: rgba(179, 74, 52, 0.5); }

/* ---------------------------------------------------------------- 大厅 */
.plobby-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plobby-head.is-busy h3 { opacity: 0.55; }
.plobby-actions, .pform-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.plobby-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.plobby-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; border-radius: 3px;
  background: linear-gradient(180deg, rgba(38, 27, 18, 0.86), rgba(22, 15, 10, 0.9));
  border: 1px solid rgba(201, 162, 74, 0.22);
}
.plobby-name { font-size: 17px; color: #f1e6ca; letter-spacing: 2px; }
.plobby-meta { margin-top: 4px; font-size: 12px; color: #9c8a70; letter-spacing: 1px; }

/* ---------------------------------------------------------------- 表单 */
.pvpform { max-width: 460px; margin: 0 auto; }
.pfield { display: block; margin: 0 0 12px; }
.pfield > span { display: block; margin-bottom: 5px; font-size: 13px; color: #a9977c; letter-spacing: 2px; }
.pinput {
  width: 100%; padding: 9px 11px; font-family: var(--serif); font-size: 15px;
  color: var(--parch-3); background: rgba(12, 8, 5, 0.85);
  border: 1px solid rgba(201, 162, 74, 0.3); border-radius: 2px;
}
.pinput:focus-visible { outline: 2px solid rgba(233, 201, 138, 0.7); outline-offset: 1px; }

/* ---------------------------------------------------------------- 房间等待 */
.pwait-hint { margin: 10px 0 14px; font-size: 13px; color: #9c8a70; line-height: 1.8; }
.pwait-seats { display: flex; gap: 12px; flex-wrap: wrap; }
.pwait-seat {
  flex: 1 1 200px; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 3px; background: rgba(20, 14, 9, 0.8); border: 1px solid rgba(201, 162, 74, 0.2);
}
.pwait-seat.is-empty { opacity: 0.55; border-style: dashed; }
.pwait-name { flex: 1 1 auto; font-size: 16px; color: #f1e6ca; }
.pwait-flag { font-size: 12px; color: #c9a24a; letter-spacing: 1px; }
.pwait-you { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(201, 162, 74, 0.2); color: #f0d79a; }
.pwait-actions { margin-top: 16px; }
.pwait-wait { font-size: 14px; color: #9c8a70; }

/* ---------------------------------------------------------------- 牌桌 */
.pvptable { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pboard {
  padding: 8px 10px; border-radius: 4px;
  background: linear-gradient(180deg, rgba(26, 18, 12, 0.86), rgba(14, 10, 7, 0.9));
  border: 1px solid rgba(201, 162, 74, 0.18);
}
.pboard.is-top { border-color: rgba(150, 90, 60, 0.3); }
.pboard-head { display: flex; gap: 14px; align-items: baseline; font-size: 13px; color: #a9977c; letter-spacing: 1px; }
.pboard-head.is-offline .pboard-name { color: #e08b78; }
.pboard-head.is-active .pboard-name { color: #ffe9bd; text-shadow: 0 0 14px rgba(255, 190, 100, 0.35); }
.pboard-name { font-size: 15px; color: #e8dcc4; }
.pboard-lanes { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.pline { display: flex; gap: 6px; }
.pslot {
  flex: 1 1 0; min-width: 0; height: 62px; padding: 4px 6px; border-radius: 3px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: rgba(10, 7, 4, 0.55); border: 1px dashed rgba(201, 162, 74, 0.16);
  cursor: default; transition: border-color 0.15s ease, background 0.15s ease;
}
.pslot.is-front { height: 72px; border-color: rgba(201, 162, 74, 0.28); }
.pslot.is-unit {
  border-style: solid; border-color: rgba(201, 162, 74, 0.4);
  background: linear-gradient(180deg, rgba(58, 42, 26, 0.9), rgba(30, 21, 13, 0.95));
}
.pslot.is-acted { opacity: 0.62; }
.pslot.is-ambush { border-color: rgba(120, 130, 160, 0.55); }
.pslot.is-targetable { border-color: #ffd27d; box-shadow: 0 0 0 1px rgba(255, 210, 125, 0.7), 0 0 16px rgba(255, 160, 80, 0.35); cursor: pointer; }
.pslot.is-selected { border-color: #ffe9bd; box-shadow: inset 0 0 0 1px rgba(255, 233, 189, 0.8); }
.punit-name { font-size: 12px; color: #e8dcc4; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punit-stats { display: flex; justify-content: space-between; font-size: 14px; }
.punit-atk { color: #ffd27d; }
.punit-hp { color: #9fd3a8; }
.punit-hp[data-dmg]:not([data-dmg="0"]) { color: #e08b78; }
.punit-sigils { font-size: 10px; color: #8f9e86; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pvpmid { display: flex; align-items: center; gap: 14px; padding: 2px 4px; }
.pclock { position: relative; flex: 1 1 auto; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.pclock-fill { position: absolute; left: 0; top: 0; bottom: 0; display: block; background: linear-gradient(90deg, #c9a24a, #ffd27d); transition: width 0.5s linear; }
.pclock.is-low .pclock-fill { background: linear-gradient(90deg, #9c3126, #e07b3c); }
.pclock-label { position: absolute; right: 8px; top: -18px; font-size: 11px; color: #9c8a70; letter-spacing: 1px; }
.pvpturn { flex: 0 0 auto; font-size: 14px; color: #a9977c; letter-spacing: 2px; }
.pvpturn.is-mine { color: #ffe9bd; text-shadow: 0 0 14px rgba(255, 190, 100, 0.4); }
.pvpnote { font-size: 11px; color: #6b6154; letter-spacing: 1px; }
.pvpactions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pvpactions-note { font-size: 12px; color: #9c8a70; }

/* 手牌：横排小卡，横向滚动（窄屏不压塌） */
.phand { display: flex; gap: 6px; margin-top: 8px; padding-bottom: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pcard.phand-card { flex: 0 0 auto; width: 74px; cursor: pointer; }
.pcard.phand-card.is-disabled { opacity: 0.5; cursor: default; }
.pcard.phand-card.is-selected { box-shadow: 0 0 0 2px #ffe9bd; }

/* 卡面 */
.pcard {
  position: relative; border-radius: 3px; overflow: hidden;
  background: #1d2b29; border: 1px solid rgba(201, 162, 74, 0.45);
}
.pcard-art { display: block; line-height: 0; background: #1d2b29; }
.pcard-art svg, .pcard-art img { display: block; width: 100%; height: auto; }
.pcard-art.is-flat { height: 96px; background: radial-gradient(circle at 50% 40%, #435048, #101a18); }
.pcard-cost {
  position: absolute; left: 3px; top: 3px; min-width: 18px; padding: 0 4px; border-radius: 999px;
  font-size: 12px; line-height: 18px; text-align: center;
  color: #17110c; background: #ffd27d; font-weight: 700;
}
.pcard-name { padding: 3px 5px 2px; font-size: 12px; color: #f1e6ca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-meta, .pcard-stats { padding: 0 5px 4px; font-size: 10px; color: #9c8a70; }
.pcard-stats { display: flex; gap: 4px; font-size: 12px; color: #ffd27d; }
.pcard-stats i { color: #6b6154; font-style: normal; }
.pcard.r-special { border-color: rgba(140, 190, 150, 0.6); }
.pcard.r-limited { border-color: rgba(120, 160, 220, 0.6); }
.pcard.r-elite { border-color: rgba(230, 170, 90, 0.85); box-shadow: 0 0 12px rgba(230, 170, 90, 0.25); }
.pcard.is-compact .pcard-name { padding-bottom: 4px; }

/* ---------------------------------------------------------------- 聊天 */
.pchat { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.pchat.is-disabled { opacity: 0.6; }
.pchat-log {
  height: 96px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px;
  font-size: 13px; line-height: 1.7; border-radius: 3px;
  background: rgba(8, 6, 4, 0.6); border: 1px solid rgba(201, 162, 74, 0.14);
}
.pchat-line { display: flex; gap: 8px; }
.pchat-who { flex: 0 0 auto; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9a24a; }
.pchat-line.is-mine .pchat-who { color: #9fd3a8; }
.pchat-text { flex: 1 1 auto; color: #e8dcc4; word-break: break-word; }
.pchat-form { display: flex; gap: 8px; }
.pchat-input {
  flex: 1 1 auto; min-width: 0; padding: 8px 11px; font-family: var(--serif); font-size: 15px;
  color: var(--parch-3); background: rgba(12, 8, 5, 0.85);
  border: 1px solid rgba(201, 162, 74, 0.3); border-radius: 2px;
}

/* ---------------------------------------------------------------- 结算 / 吐司 / 确认 */
.pvpend {
  margin-top: 10px; padding: 16px; text-align: center; border-radius: 3px;
  background: rgba(18, 12, 8, 0.88); border: 1px solid rgba(201, 162, 74, 0.3);
}
.pvpend h3 { letter-spacing: 10px; font-size: 26px; }
.pvpend.is-win h3 { color: #ffd27d; text-shadow: 0 0 22px rgba(255, 190, 100, 0.4); }
.pvpend.is-lose h3 { color: #b8806e; }
.pvpend p { margin: 0 0 12px; font-size: 13px; color: #9c8a70; }
.pvpend .pform-actions { justify-content: center; }

.ptoast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 90;
  max-width: min(520px, calc(100% - 48px)); padding: 9px 16px; border-radius: 3px;
  font-size: 14px; line-height: 1.6; color: #f3e6cb; text-align: center;
  background: rgba(24, 17, 11, 0.96); border: 1px solid rgba(201, 162, 74, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}
.ptoast.is-error { color: #ffc2b0; border-color: rgba(179, 74, 52, 0.65); }
.ptoast.is-warn { color: #f0c881; }

.pconfirm {
  position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 3, 2, 0.72);
}
.pconfirm-card {
  width: min(400px, calc(100% - 48px)); padding: 20px; border-radius: 4px;
  background: linear-gradient(180deg, #241a11, #17100a); border: 1px solid rgba(201, 162, 74, 0.45);
}
.pconfirm-card h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: 3px; color: #f3e6cb; }
.pconfirm-card p { margin: 0 0 16px; font-size: 14px; line-height: 1.7; color: #a9977c; }
.pconfirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------------- 紧凑视口 */
@media (max-width: 980px) {
  .pvpscreens { width: 100%; }
  .pslot { height: 54px; }
  .pslot.is-front { height: 62px; }
  .pcard.phand-card { width: 64px; }
  .pboard-head { font-size: 12px; gap: 10px; }
}
@media (max-width: 640px) {
  .pvpscreens h3 { font-size: 19px; letter-spacing: 4px; }
  .pslot { height: 48px; padding: 3px 4px; }
  .pslot.is-front { height: 56px; }
  .punit-name { font-size: 11px; }
  .punit-sigils { display: none; }
  .pvpmid { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .pslot, .pclock-fill { transition: none; }
}
