/* Meme 风格 CSS */
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@700&display=swap');

:root {
  --primary-color: #00ff00; /* 瞎眼绿 */
  --secondary-color: #ff00ff; /* 瞎眼紫 */
  --accent-color: #ffff00; /* 瞎眼黄 */
  --bg-color: #1a1a1a;
  --border-color: #000;
  --font-family: "Comic Neue", "Comic Sans MS", "Chalkboard SE", sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  /* 迷幻背景 */
  background-image: 
    linear-gradient(45deg, #222 25%, transparent 25%, transparent 75%, #222 75%, #222), 
    linear-gradient(45deg, #222 25%, transparent 25%, transparent 75%, #222 75%, #222);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  max-width: 800px;
  background: #333;
  border: 4px solid var(--border-color);
  box-shadow: 0 0 20px var(--primary-color);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Settings */
.settings-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 200;
}

.meme-btn-small {
  background: var(--accent-color);
  color: black;
  border: 2px solid black;
  font-family: var(--font-family);
  font-weight: bold;
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: 3px 3px 0 black;
  white-space: nowrap;
  min-width: 90px;
}
.meme-btn-small:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 black;
}

/* Login */
#login-screen {
  justify-content: center;
  align-items: center;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><text x="10" y="50" font-size="20">😂</text><text x="60" y="20" font-size="30">👌</text></svg>');
}

.meme-panel {
  background: white;
  padding: 40px;
  border: 5px solid black;
  text-align: center;
  color: black;
  box-shadow: 10px 10px 0 var(--secondary-color);
  transform: rotate(-1deg);
}

.game-title {
  font-size: 3.5rem;
  margin: 0 0 20px 0;
  color: black;
  text-shadow: 4px 4px 0 var(--primary-color);
  font-family: 'Impact', sans-serif;
  letter-spacing: 2px;
}

.input-group label {
  display: block;
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 5px;
  background: black;
  color: white;
  display: inline-block;
  padding: 2px 5px;
  transform: rotate(2deg);
}

input[type="text"] {
  width: 100%;
  padding: 10px;
  font-size: 1.2rem;
  border: 3px solid black;
  font-family: var(--font-family);
  margin-bottom: 20px;
}

.meme-btn {
  font-family: var(--font-family);
  border: 3px solid black;
  padding: 12px 24px;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: 5px 5px 0 black;
  text-transform: uppercase;
  margin: 5px;
}
.meme-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 black;
}
.meme-btn.primary { background: var(--primary-color); color: black; }
.meme-btn.secondary { background: white; color: black; }
.meme-btn.super { background: linear-gradient(45deg, gold, orange); color: black; border-color: gold; }

/* Game UI */
.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #222;
  border-bottom: 3px solid var(--accent-color);
  color: white;
  z-index: 10;
}

.room-info {
  position: absolute;
  top: 50px;
  left: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 5;
}

.score-board {
  color: var(--accent-color);
  font-size: 1.5rem;
  font-weight: bold;
}

.recorder-panel {
  position: absolute;
  top: 50px;
  left: 10px; /* Moved to left for better visibility */
  background: rgba(0,0,0,0.8);
  border: 2px solid var(--accent-color);
  padding: 5px;
  border-radius: 5px;
  z-index: 90;
  max-width: 150px;
  font-size: 0.8rem;
}
.recorder-buy-btn {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 90;
}
#recorder-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.rec-item {
  background: white;
  color: black;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: bold;
}
.rec-item.zero { opacity: 0.3; }

.game-table {
  flex: 1;
  position: relative;
  background: #444; /* Dark table */
  background-image: radial-gradient(circle, #555 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: hidden;
}

.hole-cards {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
}

.opponent {
  position: absolute;
  top: 80px;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.opponent.left { left: 10px; }
.opponent.right { right: 10px; }

.avatar {
  width: 64px;
  height: 64px;
  background: #fff;
  border: 3px solid black;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
  box-shadow: 3px 3px 0 var(--secondary-color);
}
.avatar .face { font-size: 36px; }

.role-icon {
  position: absolute;
  top: -10px;
  right: -10px;
  background: gold;
  border: 2px solid black;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: black;
}
.role-icon.peasant { background: #ccc; }
.role-icon::after { content: "地"; }
.role-icon.peasant::after { content: "农"; }

.double-icon {
  position: absolute;
  bottom: -5px;
  left: -5px;
  background: var(--secondary-color);
  color: white;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid black;
  font-weight: bold;
}

.player-area {
  height: 240px;
  background: #2a2a2a;
  border-top: 4px solid var(--accent-color);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 20px;
}

.my-info-area {
  position: absolute;
  left: 10px;
  bottom: 80px;
}
.my-avatar {
  width: 80px;
  height: 80px;
  background: white;
  border: 3px solid black;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: 4px 4px 0 var(--primary-color);
}
.my-avatar .face { font-size: 48px; }

.controls {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
  white-space: nowrap;
}

.hand-cards {
  display: flex;
  justify-content: center;
  height: 130px;
  margin-top: 20px;
  perspective: 1000px;
}

/* Card Styles */
.card {
  width: 86px;
  height: 120px;
  background: white;
  border: 2px solid black;
  border-radius: 8px;
  position: relative;
  margin-left: -50px;
  cursor: pointer;
  transition: transform 0.1s, margin 0.1s;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
  padding: 0;
  font-weight: bold;
  font-family: sans-serif;
  overflow: hidden; /* 防止内容溢出 */
}
.card:first-child { margin-left: 0; }
.card.selected { transform: translateY(-25px); border-color: var(--secondary-color); box-shadow: 0 0 10px var(--secondary-color); }
.card.red { color: #d00; }
.card.black { color: #111; }

/* 显眼角标 */
.card-corner {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.c-val {
  font-size: 26px; /* 大号字体 */
  font-weight: 900;
  letter-spacing: -2px;
  font-family: 'Arial Black', 'Arial', sans-serif;
  text-align: center;
}

.c-suit {
  font-size: 24px;
  margin-top: -2px;
  font-weight: normal;
}

/* 调整中心图案位置 */
.card-center {
  position: absolute;
  bottom: 8px;
  right: 6px;
  font-size: 48px;
  line-height: 1;
  opacity: 1;
}

/* 卡片背面 */
.card-back {
  width: 45px;
  height: 60px;
  background: var(--secondary-color);
  border: 2px solid black;
  border-radius: 4px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><text x="5" y="15" font-size="10" fill="white">?</text></svg>');
}

/* 小牌样式调整 */
.card-small {
  width: 60px;
  height: 84px;
  margin-left: -35px;
  border-radius: 5px;
}

.card-small .c-val {
  font-size: 18px;
  letter-spacing: -1px;
}
.card-small .c-suit {
  font-size: 16px;
}
.card-small .card-center {
  font-size: 28px;
  bottom: 4px;
  right: 4px;
}
.card-small .card-corner {
  top: 2px;
  left: 2px;
}

.played-cards {
  display: flex;
  position: absolute;
  pointer-events: none;
}
#played-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
#played-left { top: 70px; left: 100px; transform: scale(0.8); }
#played-right { top: 70px; right: 100px; transform: scale(0.8); flex-direction: row-reverse; }
#played-right .card { margin-left: 0; margin-right: -35px; }

#game-status-text {
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-color);
  -webkit-text-stroke: 2px black;
  text-shadow: 4px 4px 0 black;
  display: none;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex; justify-content: center; align-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }

.meme-modal-content {
  background: white;
  border: 6px solid black;
  padding: 30px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 15px 15px 0 var(--primary-color);
  animation: bounceIn 0.5s;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); opacity: 1; }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 480px) {
  .card { width: 65px; height: 90px; margin-left: -40px; }
  .c-val { font-size: 22px; }
  .c-suit { font-size: 20px; }
  .card-center { font-size: 36px; bottom: 4px; right: 4px; }
  
  .hand-cards { height: 110px; }
  .meme-panel { padding: 20px; width: 95%; }
  .controls { transform: translateX(-50%) scale(0.9); width: 100%; justify-content: center; }
  .meme-btn { padding: 8px 12px; font-size: 1rem; }
}
