/**
 * 萌系视觉样式系统 (Cute Macaron Theme)
 */

:root {
  --primary-pink: #FF70A6;
  --primary-orange: #FF9F1C;
  --primary-yellow: #FFD166;
  --primary-green: #06D6A0;
  --primary-blue: #118AB2;
  --primary-purple: #9B5DE5;

  --bg-creamy: #FFF9F4;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-shadow: 0 10px 25px rgba(255, 112, 166, 0.12), 0 4px 10px rgba(0, 0, 0, 0.04);
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 10px;

  --font-cute: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: var(--font-cute);
  background: radial-gradient(circle at 10% 20%, #FFE5EC 0%, #FFF3E2 50%, #E8F7FF 100%);
  color: #4A4E69;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 顶部导航栏 */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid #FFE3EC;
  box-shadow: 0 4px 12px rgba(255, 112, 166, 0.08);
  z-index: 10;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 32px;
  animation: bounce 2s infinite ease-in-out;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(45deg, #FF5C8A, #FF9F1C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 11px;
  color: #9A8C98;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.round-badge {
  background: #FFF0F5;
  color: var(--primary-pink);
  font-weight: 700;
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid #FFCCD5;
}

.header-tools {
  display: flex;
  gap: 10px;
}

.btn-icon-tool {
  background: #FFF;
  border: 1.5px solid #FFD166;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: transform 0.15s, background 0.15s;
}

.btn-icon-tool:hover {
  transform: scale(1.1);
  background: #FFF9E6;
}

/* 游戏主体三栏架构 */
.game-viewport {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 16px;
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* 左侧：计分板与排行榜 */
.sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
  border: 2px solid #FFF;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #33272A;
  margin-bottom: 12px;
  border-bottom: 1.5px dashed #FFE3EC;
  padding-bottom: 8px;
}

.players-score-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  background: #FFF;
  border-left: 5px solid #CCC;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.25s;
}

.player-card.active-turn {
  background: #FFF5F8;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 112, 166, 0.25);
}

.p-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.tag-ai {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #9B5DE5;
  color: #FFF;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
}

.p-info {
  flex: 1;
}

.p-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.p-name {
  font-size: 14px;
  font-weight: 700;
  color: #2B2D42;
}

.p-char {
  font-size: 11px;
  color: #8D99AE;
}

.p-stats {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
}

.stat-star { color: #F77F00; }
.stat-coin { color: #00B4D8; }
.stat-cards { color: #7209B7; }

/* 中央：棋盘展示区与操作底栏 */
.board-main-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-container-wrapper {
  flex: 1;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  box-shadow: var(--card-shadow);
  border: 3px solid #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 控制底栏与骰子 */
.control-dock {
  background: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 2px solid #FFF;
}

.dice-interactive-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dice-cube {
  width: 58px;
  height: 58px;
  background: linear-gradient(145deg, #FFFFFF, #FFF0F5);
  border: 2px solid #FF85A1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #FF477E;
  box-shadow: 0 6px 14px rgba(255, 71, 126, 0.25);
  cursor: pointer;
  transition: transform 0.15s;
}

.dice-cube.rolling {
  animation: rollRotate 0.5s linear infinite;
}

.btn-cute-action {
  background: linear-gradient(45deg, #FF6584, #FF9F1C);
  color: #FFF;
  border: none;
  font-size: 16px;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 28px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 101, 132, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-cute-action:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(255, 101, 132, 0.45);
}

.btn-cute-action:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.btn-cute-action:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
  box-shadow: none;
}

.action-tip-text {
  font-size: 13px;
  font-weight: 600;
  color: #FF5C8A;
}

/* 手牌与道具栏 */
.cards-hand-dock {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px;
}

.btn-item-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #FFF;
  border: 1.5px solid #FFD166;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: transform 0.15s, border-color 0.15s;
}

.btn-item-card:hover {
  transform: translateY(-3px);
  border-color: #FF6584;
}

.btn-item-card .card-icon {
  font-size: 22px;
}

.btn-item-card .card-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.btn-item-card .card-name {
  font-size: 12px;
  font-weight: 700;
  color: #33272A;
}

.btn-item-card .card-desc {
  font-size: 10px;
  color: #7F8489;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-cards-tip {
  font-size: 12px;
  color: #9A8C98;
  font-style: italic;
}

/* 右侧：战报日志与表情互动 */
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.log-scroll-box {
  height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.log-item {
  line-height: 1.4;
  padding: 4px 8px;
  background: #FAFAFA;
  border-radius: 8px;
}

.log-time {
  color: #FF70A6;
  font-weight: 700;
}

/* 表情互动栏 */
.quick-emoji-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.btn-quick-emoji {
  background: #FFF;
  border: 1px solid #FFE3EC;
  border-radius: 10px;
  font-size: 20px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-quick-emoji:hover {
  transform: scale(1.2);
}

.chat-input-row {
  display: flex;
  gap: 6px;
}

.cute-input {
  flex: 1;
  border: 1.5px solid #FFCCD5;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}

.cute-input:focus {
  border-color: #FF5C8A;
}

.btn-cute-send {
  background: var(--primary-pink);
  color: #FFF;
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.chat-box {
  height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  margin-top: 8px;
}

.chat-msg-row {
  padding: 2px 6px;
  background: #FFF0F5;
  border-radius: 6px;
}

.chat-time {
  font-size: 10px;
  color: #8D99AE;
}

/* 浮动通知 Toast */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.cute-toast {
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  animation: toastSlideDown 0.3s ease-out;
}

.toast-info { background: #E0F2FE; color: #0369A1; border: 1.5px solid #BAE6FD; }
.toast-success { background: #DCFCE7; color: #15803D; border: 1.5px solid #BBF7D0; }
.toast-warning { background: #FEF3C7; color: #B45309; border: 1.5px solid #FDE68A; }

.cute-toast.fade-out {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.4s ease-in;
}

/* 模态弹窗通配 */
.cute-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 45, 66, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.cute-modal-overlay.hidden {
  display: none;
}

.cute-modal-content {
  background: #FFF;
  border-radius: var(--border-radius-lg);
  padding: 28px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border: 4px solid #FFE3EC;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header-row h2 {
  font-size: 22px;
  color: #2B2D42;
}

/* 角色选择网格 */
.char-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.char-card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #FFF9F4;
  border: 2px solid #FFE3EC;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.char-card-item.selected {
  border-color: #FF5C8A;
  background: #FFF0F5;
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(255, 92, 138, 0.2);
}

.char-avatar-box {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.char-title-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.char-name {
  font-size: 15px;
  font-weight: 800;
  color: #2B2D42;
}

.char-badge {
  color: #FFF;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.char-skill-name {
  font-size: 12px;
  color: #FF5C8A;
  font-weight: 700;
  margin-top: 2px;
}

.char-skill-desc {
  font-size: 11px;
  color: #8D99AE;
  line-height: 1.3;
}

.lobby-actions-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-lobby-mode {
  flex: 1;
  padding: 14px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-mode-quick {
  background: linear-gradient(45deg, #FF6584, #FF9F1C);
  color: #FFF;
  box-shadow: 0 4px 12px rgba(255, 101, 132, 0.3);
}

.btn-mode-online {
  background: #E8F7FF;
  color: #0284C7;
  border: 1.5px solid #BAE6FD;
}

.btn-lobby-mode:hover {
  transform: translateY(-2px);
}

/* 房间内座位 */
.room-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.lobby-slot {
  border: 2px dashed #CBD5E1;
  border-radius: 16px;
  padding: 16px 8px;
  text-align: center;
  background: #FAFAFA;
}

.lobby-slot.occupied {
  border-style: solid;
  border-color: #FF85A1;
  background: #FFF;
}

.slot-avatar {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.slot-name {
  font-size: 13px;
  font-weight: 700;
  color: #2B2D42;
}

.slot-char {
  font-size: 11px;
  color: #8D99AE;
}

.badge-host {
  display: inline-block;
  font-size: 10px;
  color: #D97706;
  font-weight: 700;
  margin-top: 4px;
}

/* 益智挑战弹窗样式 */
.puzzle-box {
  text-align: center;
  padding: 16px;
}

.puzzle-story {
  font-size: 15px;
  color: #4A4E69;
  margin-bottom: 12px;
}

.puzzle-formula {
  font-size: 32px;
  font-weight: 900;
  color: #FF5C8A;
  margin-bottom: 20px;
}

.puzzle-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-puzzle-opt {
  padding: 16px;
  font-size: 22px;
  font-weight: 800;
  background: #FFF;
  border: 2px solid #FFCCD5;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.15s;
}

.btn-puzzle-opt:hover {
  background: #FFF0F5;
  border-color: #FF5C8A;
}

.btn-puzzle-opt.correct {
  background: #DCFCE7;
  border-color: #22C55E;
  color: #15803D;
  transform: scale(1.05);
}

.btn-puzzle-opt.wrong {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #B91C1C;
}

/* 翻牌小游戏 */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.memory-card {
  height: 90px;
  perspective: 1000px;
  cursor: pointer;
}

.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.3s;
  transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-front, .memory-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.memory-front {
  background: linear-gradient(135deg, #FFB703, #FB8500);
  color: #FFF;
}

.memory-back {
  background: #FFF;
  border: 2px solid #06D6A0;
  transform: rotateY(180deg);
}

/* 极限反应游戏 */
.reaction-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}

.reaction-btn {
  height: 70px;
  font-size: 30px;
  background: #FFF;
  border: 2px solid #BAE6FD;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s;
}

.reaction-btn:hover {
  transform: scale(1.06);
}

.reaction-btn.correct {
  background: #DCFCE7;
  border-color: #22C55E;
}

.reaction-btn.wrong {
  background: #FEE2E2;
  border-color: #EF4444;
}

/* 分叉选择弹窗 */
.branch-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-branch-opt {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: #FFF;
  border: 2px solid #FFD166;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.btn-branch-opt:hover {
  border-color: #FF5C8A;
  background: #FFF9F4;
  transform: translateX(4px);
}

.branch-icon {
  font-size: 32px;
}

.branch-meta b {
  display: block;
  font-size: 15px;
  color: #2B2D42;
}

.branch-meta small {
  font-size: 12px;
  color: #8D99AE;
}

/* 获胜终局弹窗 */
.winner-box {
  text-align: center;
  padding: 20px 0;
}

.winner-trophy {
  font-size: 60px;
  animation: bounce 1s infinite alternate;
}

.winner-name-text {
  font-size: 26px;
  font-weight: 900;
  color: #FF5C8A;
  margin: 12px 0 6px;
}

.winner-reason-text {
  font-size: 15px;
  color: #718096;
  margin-bottom: 24px;
}

/* 动效关键帧 */
@keyframes bounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

@keyframes rollRotate {
  0% { transform: rotate(0deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1.1); }
}

@keyframes toastSlideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes modalPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 响应式移动端适配 */
@media (max-width: 1080px) {
  .game-viewport {
    grid-template-columns: 1fr;
    height: auto;
  }
  .sidebar-left, .sidebar-right {
    order: 2;
  }
  .board-main-area {
    order: 1;
  }
}
