/* UNO 牌桌样式 */
.screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
}

/* ===== 大厅 / 房间 ===== */
.lobby-card {
  background: #fff; border-radius: 24px; padding: 36px;
  width: 400px; max-width: 92vw; text-align: center;
  box-shadow: 0 8px 30px rgba(108, 92, 231, .25);
}
.lobby-card h1 { color: #6c5ce7; font-size: 42px; }
.lobby-card h2 { color: #6c5ce7; }
.subtitle { color: #888; margin: 8px 0 20px; }
.lobby-card input {
  width: 100%; padding: 12px; margin-bottom: 12px; font-size: 16px;
  border: 2px solid #d9d0ff; border-radius: 12px; outline: none; text-align: center;
}
.lobby-card input:focus { border-color: #6c5ce7; }
.btn-primary {
  background: #6c5ce7; color: #fff; border: none; border-radius: 12px;
  padding: 12px 24px; font-size: 17px; font-weight: bold; cursor: pointer;
  transition: transform .1s;
}
.btn-primary:hover { transform: scale(1.05); }
.btn-plain {
  background: #f0f0f0; color: #666; border: none; border-radius: 12px;
  padding: 10px 24px; font-weight: bold; cursor: pointer; margin-top: 14px;
}
.join-row { display: flex; gap: 10px; align-items: stretch; }
.join-row input { flex: 1; text-transform: uppercase; margin-bottom: 0 !important; }
.join-row .btn-secondary { flex-shrink: 0; }

/* 大厅选项卡 */
.lobby-hello {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 20px;
}
.lobby-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #f0ebff; display: inline-flex;
  align-items: center; justify-content: center; font-size: 30px;
}
.lobby-option {
  background: #f8f6ff; border-radius: 18px; padding: 18px;
  transition: box-shadow .15s;
}
.lobby-option:hover { box-shadow: 0 4px 16px rgba(108, 92, 231, .18); }
.btn-big { width: 100%; padding: 14px; font-size: 18px; }
.btn-secondary {
  background: #fff; color: #6c5ce7; border: 2px solid #6c5ce7;
  border-radius: 12px; padding: 12px 18px; font-size: 16px;
  font-weight: bold; cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: #f0ebff; }
.option-desc { color: #aaa; font-size: 13px; margin-top: 10px; }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: #ccc; margin: 16px 8px; font-size: 14px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: #e5e0f5;
}
.rp-avatar { font-size: 20px; }
.opp-avatar { font-size: 26px; }
.bot-tag {
  background: #6c5ce7; color: #fff; border-radius: 8px;
  font-size: 11px; padding: 1px 6px; margin-left: 4px;
}
.bot-remove {
  background: none; border: none; color: #ccc; cursor: pointer;
  margin-left: auto; font-size: 14px; padding: 2px 6px;
}
.bot-remove:hover { color: #e63946; }
#btn-add-bot { margin-top: 4px; width: 100%; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.lobby-avatar { overflow: hidden; }
.rp-avatar {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f0ebff; flex-shrink: 0;
}
.opp-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
  background: #f0ebff;
}
.my-avatar {
  display: inline-flex; width: 24px; height: 24px; border-radius: 50%;
  overflow: hidden; vertical-align: middle;
}
.error { color: #e63946; min-height: 20px; margin-top: 10px; }
.hint { color: #aaa; font-size: 13px; margin-top: 12px; }
.hint a { color: #6c5ce7; }

.room-code-big {
  font-size: 44px; font-weight: bold; letter-spacing: 10px; color: #333;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.room-code-big button {
  background: #f0ebff; border: none; border-radius: 10px;
  font-size: 22px; padding: 6px 10px; cursor: pointer; letter-spacing: 0;
}
#room-players { list-style: none; margin: 16px 0; }
#room-players li {
  background: #f6f3ff; border-radius: 12px; padding: 10px 16px;
  margin-bottom: 8px; font-size: 17px; font-weight: bold; color: #444;
  display: flex; align-items: center; gap: 8px;
}
#room-players li .offline { color: #e63946; font-size: 12px; }
.host-star { color: #f5a623; }

/* ===== 牌桌 ===== */
#screen-table {
  flex-direction: column; justify-content: flex-start;
  padding: 8px; gap: 6px;
}

#top-bar {
  width: 100%; max-width: 900px;
  display: flex; align-items: center; gap: 10px;
}
#top-bar button {
  background: rgba(255,255,255,.8); border: none; border-radius: 10px;
  font-size: 20px; padding: 6px 10px; cursor: pointer;
}
#last-action {
  flex: 1; text-align: center; color: #5b4ec4; font-weight: bold;
  background: rgba(255,255,255,.7); border-radius: 12px; padding: 8px;
  font-size: 14px; min-height: 20px;
}

#chat-bar {
  width: 100%; max-width: 900px;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  background: rgba(255,255,255,.8); border-radius: 12px; padding: 8px;
}
#chat-bar span {
  background: #f0ebff; border-radius: 14px; padding: 6px 12px;
  font-size: 14px; cursor: pointer;
}
#chat-bar span:hover { background: #ddd3ff; }

/* 对手区 */
#opponents {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  width: 100%; max-width: 900px; min-height: 86px;
}
.opp {
  background: rgba(255,255,255,.85); border-radius: 16px;
  padding: 8px 12px; text-align: center; min-width: 86px;
  border: 3px solid transparent;
}
.opp.current { border-color: #6c5ce7; animation: glow 1s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 16px #6c5ce7; } }
.opp .opp-name { font-weight: bold; font-size: 14px; color: #444; }
.opp .opp-name .offline { color: #e63946; font-size: 11px; }
.opp .opp-cards { font-size: 18px; letter-spacing: -2px; margin-top: 2px; }
.opp .opp-count { font-size: 12px; color: #888; }
.opp .uno-badge {
  background: #ff5252; color: #fff; border-radius: 8px;
  font-size: 11px; padding: 1px 6px; margin-left: 4px;
}
.opp .score-tag { font-size: 11px; color: #f5a623; font-weight: bold; }

/* 中央牌区 */
#center-area {
  display: flex; align-items: center; gap: 28px;
  margin: 6px 0;
}
#discard-area { text-align: center; }
#color-ring {
  border-radius: 16px; padding: 6px;
  border: 4px solid #999; transition: border-color .2s;
}
#direction { font-size: 22px; margin-top: 4px; }

/* 牌 */
.card {
  width: 64px; height: 92px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 22px; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  position: relative; flex-shrink: 0;
  user-select: none;
}
.card.cR { background: #e63329; }
.card.cY { background: #f5b800; color: #5c4300; }
.card.cG { background: #3ba55d; }
.card.cB { background: #2b7cd3; }
.card.cW { background: linear-gradient(135deg,#e63329,#f5b800,#3ba55d,#2b7cd3); }
.card.back { background: repeating-linear-gradient(45deg,#3a3a3a,#3a3a3a 6px,#555 6px,#555 12px); }
.back-logo {
  transform: rotate(-30deg); color: #f5b800; font-size: 16px;
  font-style: italic; text-shadow: 1px 1px 0 #e63329;
}
.draw-count {
  position: absolute; bottom: 4px; right: 6px; font-size: 12px; color: #ccc;
}
.card .corner {
  position: absolute; top: 3px; left: 5px; font-size: 11px; opacity: .85;
}
#draw-pile { cursor: pointer; }
#draw-pile.can-draw { animation: glow 1s infinite alternate; border-radius: 10px; }

/* 手牌区 */
#my-hand {
  display: flex; gap: 4px; overflow-x: auto;
  width: 100%; max-width: 900px; padding: 14px 10px 8px;
  min-height: 108px;
}
#my-hand .card { cursor: default; }
#my-hand .card.playable { cursor: pointer; transform: translateY(-10px); box-shadow: 0 6px 14px rgba(108,92,231,.6); }
#my-hand .card.playable:hover { transform: translateY(-16px) scale(1.05); }
#my-hand .card.drawn-pulse { animation: pulse-border .8s infinite alternate; }
@keyframes pulse-border { to { box-shadow: 0 0 18px #f5b800; } }

#my-info { color: #5b4ec4; font-weight: bold; padding-bottom: 6px; }
#turn-hint { color: #6c5ce7; font-weight: bold; min-height: 22px; font-size: 17px; }

#action-buttons { display: flex; gap: 12px; min-height: 44px; }
#action-buttons button {
  border: none; border-radius: 22px; padding: 10px 26px;
  font-size: 18px; font-weight: bold; cursor: pointer;
}
#btn-uno { background: #ff5252; color: #fff; animation: pulse-btn .7s infinite alternate; }
#btn-catch { background: #f5a623; color: #fff; animation: pulse-btn .7s infinite alternate; }
#btn-pass { background: #8e8e9e; color: #fff; }
@keyframes pulse-btn { to { transform: scale(1.08); } }

/* 弹层 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
/* 选色小浮层：浮在手牌上方，不遮挡屏幕 */
#color-modal {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 140px; z-index: 100;
}
.color-card {
  background: #fff; border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.color-title {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: bold; color: #555; margin-bottom: 10px; gap: 16px;
}
#color-cancel {
  background: #f0f0f0; border: none; border-radius: 8px;
  width: 26px; height: 26px; cursor: pointer; color: #888;
}
.gameover-card {
  background: #fff; border-radius: 24px; padding: 32px;
  text-align: center; max-width: 92vw;
}
.color-options { display: flex; gap: 10px; }
.color-btn {
  border: none; border-radius: 12px; padding: 14px 22px;
  font-size: 17px; font-weight: bold; color: #fff; cursor: pointer;
}
.color-btn.cR { background: #e63329; } .color-btn.cY { background: #f5b800; color: #5c4300; }
.color-btn.cG { background: #3ba55d; } .color-btn.cB { background: #2b7cd3; }

#winner-text { font-size: 26px; font-weight: bold; color: #6c5ce7; margin-bottom: 14px; }
#scoreboard { list-style: none; margin-bottom: 16px; }
#scoreboard li {
  font-size: 17px; padding: 6px 20px; color: #444;
  display: flex; justify-content: space-between; gap: 30px;
}
#scoreboard li .pts { font-weight: bold; color: #f5a623; }

/* toast */
#toast-box {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(60,50,120,.92); color: #fff; border-radius: 14px;
  padding: 8px 18px; font-size: 14px; animation: toast-in .2s;
}
.toast.error { background: #e63946; }
.toast.chat { background: rgba(58,120,200,.92); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ===== 手机端 ===== */
@media (max-width: 768px) {
  .card { width: 48px; height: 70px; font-size: 17px; border-radius: 8px; }
  #center-area { gap: 16px; }
  .opp { min-width: 70px; padding: 6px 8px; }
  #action-buttons button { padding: 10px 16px; font-size: 16px; }
  #my-hand { min-height: 92px; padding-top: 12px; }
  .lobby-card { padding: 24px 18px; }
}
