/* game.css — Soul Safety Party Board Game Styles */

/* ─── Game Section ─────────────────────────────────────────────────────────── */
.game-section {
  background: linear-gradient(180deg, #1a3a3a 0%, #162e2e 50%, #1a3333 100%);
  padding: var(--space-8) var(--space-4);
  position: relative;
  overflow: hidden;
}

.game-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-amber), var(--color-violet), var(--color-primary));
  background-size: 200% 100%;
  animation: shimmer 4s linear infinite;
}

.game-container {
  max-width: var(--content-wide);
  margin: 0 auto;
}

/* ─── Game Header ──────────────────────────────────────────────────────────── */
.game-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.game-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: #f0e4c8;
  margin: 0 0 var(--space-4) 0;
  text-shadow: 0 2px 12px rgba(201, 146, 42, 0.3);
}

.game-scores {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.game-score {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-score.raphael {
  border-color: rgba(201, 146, 42, 0.3);
}

.game-score.taylor {
  border-color: rgba(107, 127, 94, 0.3);
}

.game-avatar {
  font-size: 1.5rem;
  line-height: 1;
}

.game-name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.game-pts {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: #c9922a;
  min-width: 2ch;
  text-align: center;
  transition: all 0.3s ease;
}

.game-pts::after {
  content: ' pts';
  font-size: var(--text-xs);
  font-weight: 400;
  opacity: 0.6;
}

.pts-sparkle {
  animation: ptsSparkle 0.6s ease;
}

@keyframes ptsSparkle {
  0% { transform: scale(1); color: #c9922a; }
  40% { transform: scale(1.6); color: #ffe066; text-shadow: 0 0 12px rgba(255, 224, 102, 0.8); }
  100% { transform: scale(1); color: #c9922a; }
}

/* ─── Game Board ───────────────────────────────────────────────────────────── */
.game-board {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto var(--space-6);
  aspect-ratio: 700 / 400;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.03), transparent 70%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.board-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.board-svg text {
  pointer-events: none;
  user-select: none;
}

/* ─── Player Tokens ────────────────────────────────────────────────────────── */
.player-token {
  position: absolute;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.token-raphael {
  background: rgba(201, 146, 42, 0.9);
  border: 2px solid rgba(255, 224, 102, 0.5);
  box-shadow: 0 0 10px rgba(201, 146, 42, 0.4);
}

.token-taylor {
  background: rgba(107, 127, 94, 0.9);
  border: 2px solid rgba(160, 200, 140, 0.5);
  box-shadow: 0 0 10px rgba(107, 127, 94, 0.4);
}

.token-emoji {
  font-size: 14px;
  line-height: 1;
}

/* ─── Game Controls ────────────────────────────────────────────────────────── */
.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.game-roll-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #c9922a, #e0a830);
  color: #1a1612;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-interactive);
  box-shadow: 0 4px 20px rgba(201, 146, 42, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.game-roll-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 28px rgba(201, 146, 42, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.game-roll-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.game-roll-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.dice-face {
  font-size: 1.6rem;
  display: inline-block;
  line-height: 1;
}

.dice-spinning {
  animation: diceSpin 0.08s linear infinite;
}

.dice-landed {
  animation: diceBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes diceSpin {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes diceBounce {
  0% { transform: scale(1.3) rotate(15deg); }
  30% { transform: scale(0.9) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(3deg); }
  70% { transform: scale(0.98); }
  100% { transform: scale(1) rotate(0deg); }
}

.game-rolls-left {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.5);
}

.game-char-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-interactive);
}

.game-char-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ─── Task Card Overlay ────────────────────────────────────────────────────── */
.game-task-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-task-card {
  background: linear-gradient(180deg, #2a4a4a, #1e3636);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUpCard 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpCard {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.task-timer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #6b7f5e, #c9922a);
  border-radius: 3px 0 0 0;
  transition: width 1s linear;
  width: 100%;
}

.task-timer-bar::after {
  content: attr(data-time);
  position: absolute;
  right: 0;
  top: 8px;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-body);
  white-space: nowrap;
}

.task-type {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: #f0e4c8;
  margin-bottom: var(--space-2);
  margin-top: var(--space-2);
}

.task-prompt {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.task-input-area {
  margin-bottom: var(--space-4);
}

.task-input-area textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.task-input-area textarea:focus {
  border-color: rgba(201, 146, 42, 0.4);
}

.task-input-area textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.task-photo-area {
  margin-top: var(--space-3);
}

.task-photo-area button {
  padding: var(--space-2) var(--space-4);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.task-photo-area button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.task-photo-area img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
  object-fit: cover;
}

.task-actions {
  display: flex;
  gap: var(--space-3);
}

.task-submit-btn {
  flex: 1;
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6b7f5e, #7a9068);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-interactive);
}

.task-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107, 127, 94, 0.4);
}

.task-skip-btn {
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.task-skip-btn:hover {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ─── Mystery Box Overlay ──────────────────────────────────────────────────── */
.mystery-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.mystery-box {
  font-size: 5rem;
  line-height: 1;
  transition: all 0.3s;
}

.mystery-shaking {
  animation: mysteryShake 0.15s ease-in-out infinite;
}

.mystery-opening {
  animation: mysteryOpen 0.8s ease forwards;
}

.mystery-opened {
  animation: mysteryGlow 1.5s ease infinite;
}

@keyframes mysteryShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg) scale(1.05); }
  75% { transform: rotate(8deg) scale(1.05); }
}

@keyframes mysteryOpen {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.5); filter: brightness(2); }
  80% { transform: scale(0.9); filter: brightness(1.2); }
  100% { transform: scale(1.1); filter: brightness(1); }
}

@keyframes mysteryGlow {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 8px rgba(201, 146, 42, 0.5)); }
  50% { filter: brightness(1.2) drop-shadow(0 0 20px rgba(201, 146, 42, 0.8)); }
}

.mystery-result {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: #f0e4c8;
  text-align: center;
  max-width: 320px;
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 146, 42, 0.3);
  animation: resultPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes resultPop {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Character Select Modal ──────────────────────────────────────────────── */
.char-select-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.char-select-modal {
  background: linear-gradient(180deg, #2a4a4a, #1e3636);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUpCard 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.char-select-modal h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: #f0e4c8;
  margin: 0 0 var(--space-4) 0;
  text-align: center;
}

.char-section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--space-4) 0 var(--space-2) 0;
}

.char-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
}

.char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.char-card:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.char-selected {
  border-color: rgba(201, 146, 42, 0.5) !important;
  background: rgba(201, 146, 42, 0.1) !important;
  box-shadow: 0 0 12px rgba(201, 146, 42, 0.2);
}

.char-emoji {
  font-size: 2rem;
  line-height: 1;
}

.char-name {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.char-desc {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

.char-cost {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: rgba(201, 146, 42, 0.7);
}

.char-locked {
  opacity: 0.5;
  cursor: not-allowed !important;
}

.char-locked:hover {
  transform: none !important;
}

.char-locked-emoji {
  filter: grayscale(0.8);
}

.char-lock-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.7rem;
}

.char-close-btn {
  display: block;
  margin: var(--space-4) auto 0;
  padding: var(--space-2) var(--space-8);
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.char-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ─── Game Feed ────────────────────────────────────────────────────────────── */
.game-feed {
  max-width: 560px;
  margin: 0 auto;
}

.game-feed-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 var(--space-3) 0;
}

.game-feed-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 300px;
  overflow-y: auto;
  padding-right: var(--space-2);
}

.game-feed-items::-webkit-scrollbar {
  width: 4px;
}

.game-feed-items::-webkit-scrollbar-track {
  background: transparent;
}

.game-feed-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.game-feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: feedFadeIn 0.3s ease;
}

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

.feed-raphael {
  border-left: 2px solid rgba(201, 146, 42, 0.3);
}

.feed-taylor {
  border-left: 2px solid rgba(107, 127, 94, 0.3);
}

.feed-avatar {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-name {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  display: block;
  margin-bottom: 2px;
}

.feed-text {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
  word-break: break-word;
}

.feed-time {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  margin-top: 2px;
}

.game-feed-empty {
  text-align: center;
  padding: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.3);
}

/* ─── Toast Notification ───────────────────────────────────────────────────── */
.game-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 300;
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(135deg, #2a4a4a, #1e3636);
  border: 1px solid rgba(201, 146, 42, 0.3);
  border-radius: var(--radius-full);
  color: #f0e4c8;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

.game-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .game-section {
    padding: var(--space-6) var(--space-3);
  }

  .game-title {
    font-size: var(--text-xl);
  }

  .game-scores {
    gap: var(--space-3);
  }

  .game-board {
    aspect-ratio: auto;
    min-height: 280px;
  }

  .board-svg {
    min-height: 280px;
  }

  .char-grid-inner {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .game-roll-btn {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }

  .game-task-card {
    padding: var(--space-4);
  }

  .char-select-modal {
    padding: var(--space-4);
    max-height: 85vh;
  }

  .game-feed-items {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .game-score {
    padding: var(--space-1) var(--space-3);
  }

  .game-name {
    font-size: var(--text-xs);
  }

  .game-pts {
    font-size: var(--text-base);
  }

  .player-token {
    width: 22px;
    height: 22px;
  }

  .token-emoji {
    font-size: 11px;
  }
}
