/* Tic-Tac-Toe Specific Styles */

.ttt-game-layout {
  display: grid;
  /* Default layout: Top player, Board, Bottom player, Abilities */
  grid-template-areas:
    "player-top"
    "board"
    "player-bottom"
    "ability-bar";
  grid-template-columns: 1fr; /* Single column */
  grid-template-rows: auto auto auto auto; /* Default rows, overridden in mobile */
  width: 100%;
  /* min-height: 100vh; Removed to allow natural page scrolling */
  padding: 1rem;
  padding-bottom: 2rem; /* Add space at the bottom */
  box-sizing: border-box;
  gap: 1rem; /* Spacing between areas */
}

.ttt-player-info-top { grid-area: player-top; }
.ttt-player-info-left { grid-area: player-left; display: none; } /* Hide side by default */
.ttt-player-info-right { grid-area: player-right; display: none; } /* Hide side by default */
.ttt-player-info-bottom { grid-area: player-bottom; }
.ttt-board {
  grid-area: board;
  display: grid; /* Make the board itself a grid */
  aspect-ratio: 1 / 1; /* Keep it square */
  border: 2px solid var(--border-strong);
  
   /* Limit width relative to grid cell */
  /* max-height: 40vh; */ /* Limit height relative to grid cell */
  /* max-height: 100%; Removed */
  /* min-height: 0; Removed */
  /* width: 90%; Removed - Let max-width/height and aspect-ratio control size */
  /* height: 100%; Removed */
  /* max-width: 100%; */
  /* height: auto; */
  width: 100%;
  margin: unset; /* Center the board within its grid area */
  /* align-self: center; Removed */
  /* justify-self: center; Removed */
  gap: 3px; /* Space between cards */
  object-fit: contain;
}
.ttt-ability-bar { grid-area: ability-bar; }

/* Mobile-specific overrides */
@media (max-width: 767px) {
  .ttt-game-layout {
    /* Mobile: Prioritize board space, size others to content */
    grid-template-rows: min-content minmax(300px, auto) min-content min-content;
    gap: 0.75rem; /* Slightly reduce gap */
    padding-left: 0; /* Remove horizontal padding */
    padding-right: 0; /* Remove horizontal padding */
    /* display: block; Removed to restore grid behavior */
  }
  .ttt-board {
    width: 90vw; /* Use viewport width */
    max-width: 400px; /* Slightly smaller max */
    margin: 0.5rem auto; /* Adjust vertical margin */
  }
  .ttt-game-layout .ttt-player-info {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    position: relative;
    padding: 1rem;
    box-shadow: 5px 5px 0px var(--overlay-dark);
  }
  .ttt-game-layout .ttt-player-info .player-details {
    display: contents;
  }
  .player-avatar {
    margin-bottom: 0; /* Remove bottom margin */
    align-items: center;
  }
  /* Increased specificity for mobile avatar size */
  .ttt-game-layout .ttt-player-info .player-avatar img {
    width: 50px; /* Smaller avatar */
    height: 50px;
    margin-bottom: 0; /* Ensure no bottom margin here either */
  }
  /* Player details wrapper is removed for grid layout on mobile */
  /* .player-details block overridden above */
  .player-name {
    font-size: 1.2rem;
    margin-bottom: 0; /* Remove bottom margin for flex layout */
    flex-grow: 1; /* Allow name to take available space */
    text-align: center; /* Center name in middle column */
  }
  .player-energy {
      flex-shrink: 0; /* Prevent energy from shrinking */
      text-align: right; /* Align energy right */
      width: 50px;
  }
   .ttt-ability-bar {
     padding: 0.4rem;
     margin: 0 auto; /* Center bar within its area */
     width: 100%; /* Ensure it takes full width of its area */
   }
   .ttt-player-info.ttt-player-info-right,
   .ttt-player-info.ttt-player-info-left {
      display: none; /* Hide left/right player info on mobile */
   }
   /* Removed redundant mobile overrides for .ttt-ability-button. */
   /* The main styles starting at line ~241 will now apply on mobile too. */
   /* Increase specificity for mobile gap override */
   .ttt-ability-bar .ability-buttons {
     gap: 0.25rem; /* Smaller gap for mobile - Restored */
     /* flex-wrap: wrap; /* Reverted - User wants single row */ */
     /* Team colors for current turn on mobile */
     .ttt-player-info-top.current-turn {
       border-color: var(--team1-primary);
       box-shadow: 0 0 5px var(--team1-primary);
       background-color: var(--brand-surface-alt); /* Ensure active bg */
     }
     .ttt-player-info-bottom.current-turn {
       border-color: var(--team2-primary);
       box-shadow: 0 0 5px var(--team2-primary);
       background-color: var(--brand-surface-alt); /* Ensure active bg */
     }
   }
   .ttt-player-info-top{
    background-color: var(--team1-primary);
    margin-left: 3rem;
    margin-right: 3rem;
  }
   .ttt-player-info-bottom{
     background-color: var(--team2-primary);
     margin-left: 3rem;
     margin-right: 3rem;
   }
  /* Team colors for current turn on mobile */
  .ttt-player-info-top.current-turn {
    border-color: var(--team1-primary);
    box-shadow: 0 0 5px var(--team1-primary);
     /* background-color: var(--brand-surface-alt); /* Ensure active bg */
    margin-left: 2rem;
    margin-right: 2rem;
  }
  .ttt-player-info-bottom.current-turn {
    border-color: var(--team2-primary);
    box-shadow: 0 0 5px var(--team2-primary);
     /* background-color: var(--brand-surface-alt); Ensure active bg */
    margin-left: 2rem;
    margin-right: 2rem;
  }

  /* --- Mobile Ability Button Content Styling (Increased Specificity) --- */
  .ttt-game-layout .ttt-ability-button .ability-icon { /* Added .ttt-game-layout */
    font-size: 3rem;
    position: absolute;
    top: -20px;
    left: 0;
    bottom: 30px;
    transform: none;
    margin-bottom: 0.1rem;
  }
  .ttt-game-layout .ttt-ability-button .ability-description { /* Added .ttt-game-layout */
    font-size: 0.8rem;
    font-family: sans-serif;
    font-weight: bold;
    position: relative;
    /* top: 10px; */
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
  }
  .ttt-game-layout .ttt-ability-button .ability-cost { /* Added .ttt-game-layout */
    font-size: 1.2rem;
    position: absolute;
    top: -5px;
    right: 0px;
    padding: 0 4px;
  }
  /* --- End Mobile Ability Button Content Styling --- */
}

/* Desktop layout adjustments */
@media (min-width: 768px) {
  .ttt-game-layout {
    flex: 1;
    min-height: 0;
    height: 100%;
    grid-template-areas:
      "player-left board       player-right"
      "ability-bar ability-bar ability-bar"; /* Row 2 */ /* CORRECTED - ability bar spans all columns */
    grid-template-columns: minmax(clamp(100px, 15vw, 200px), 1fr)  minmax(0, 55vh)  minmax(clamp(100px, 15vw, 200px), 1fr); /* Adjusted min width */
    grid-template-rows: 1fr auto; /* Main content row takes available space, ability bar is auto */
    align-items: center; /* Vertically center items in the main row */
    justify-content: center;
    max-width: 1600px;
    width: 100%;
    /* height: 100vh; /* Consider setting a height if you want it viewport-high, but can cause overflow */
    /* Let's use min-height instead to prevent content clipping on smaller viewports */
    padding: clamp(1rem, 4vw, 3rem);
    /* min-height: 70vh; */ /* Adjust as needed */
    margin: 0 auto;
     /* Reduced padding slightly */
    box-sizing: border-box;
    row-gap: clamp(1rem, 2vw, 8rem); /* Reduced gap slightly */
    column-gap: clamp(1rem, 5vw, 8rem);
  }
  /* Increase specificity to ensure mobile elements are hidden */
  .ttt-game-layout .ttt-player-info-top,
  .ttt-game-layout .ttt-player-info-bottom {
    display: none !important; /* Hide top/bottom on wider screens (using !important as a safeguard if specificity alone fails) */
  }
  /* --- Player Card Styling --- */
  .ttt-player-info-left,
  .ttt-player-info-right {
    /* --- Container Query Setup --- */
    container-type: inline-size; /* Base scaling on width */
    container-name: player-card;

    /* --- Layout & Box Model --- */
    display: flex;
    flex-direction: column;
    /* align-items: center; /* Center content horizontally */
    /* justify-content: flex-start; /* Align content to the top */
    justify-content: center; /* Let's try centering all content vertically */
    align-items: center; /* And horizontally */
    gap: 5%; /* Use percentage gap based on height? Or use cqi/cqb? Let's try fixed relative to font-size first: 1rem */
    /* gap: 1rem; /* Space between avatar container and details */
    text-align: center;
    padding: 8%; /* Use percentage padding */
    box-sizing: border-box;
    width: 100%; /* Take width from grid column */
    /* min-width: 150px; Moved to grid column */
    /* max-width: 250px; /* Increased max-width slightly */
    aspect-ratio: 2.5 / 3.5; /* Keep aspect ratio */
    border-radius: 16px; /* Keep rounded corners */
    box-shadow: 5px 5px 0px var(--overlay-dark); /* Keep shadow */
    border: 1px solid transparent; /* Keep base border */
    /* Transitions */
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                background-color 0.3s ease;
    transform: scale(0.9); /* Base scale - adjust if needed */
    /* transform: translateY(-50px) scale(0.8); /* Removed Y translate from base */
    overflow: hidden; /* Hide overflow if content gets too big */
  }

  /* Avatar container - make it flexible */
  .ttt-player-info .player-avatar {
    width: 60%; /* Let the container take significant width */
    height: auto;
    max-width: 150px; /* Add a max pixel width for very large cards */
    aspect-ratio: 1 / 1;
    margin-bottom: 0.5rem; /* Add some space below avatar container */
    /* display: flex and justify-content: center already inherited? Check if needed */
    display: flex;
    justify-content: center;
  }

  /* Avatar image - scale using container width */
  .ttt-player-info .player-avatar img {
    width: 100%; /* Image takes full width of its container (.player-avatar) */
     /* Height is automatic based on aspect ratio */
    aspect-ratio: 1 / 1; /* Force square */
    border-radius: 50%;
    background-color: var(--brand-surface-alt);
    display: block; /* Prevents extra space below image */
    /* Remove conflicting margins */
    /* margin-bottom: -8rem; REMOVED */
    /* margin-top: 20%; REMOVED */
    object-fit: cover; /* Ensure image covers the area nicely */
  }

  /* Player details container */
  .ttt-player-info .player-details {
     display: flex;
     flex-direction: column;
     align-items: center; /* Center name and energy */
     gap: 0.25rem; /* Small gap between name and energy */
     width: 100%; /* Take full width */
  }

  /* Player Name - Use container queries */
   .ttt-player-info .player-name { /* Simplified selector */
     font-size: clamp(0.8rem, 15cqw, 1.5rem);
     font-weight: bold;
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
     /* margin-bottom: 0.5rem; /* Replaced by gap on .player-details */
     line-height: 1.2; /* Adjust line height */
   }

   /* Player Energy - Use container queries */
   .ttt-player-info .player-energy { /* Simplified selector */
     font-size: clamp(0.7rem, 25cqw, 3rem); /* Scale font based on card width */
     font-weight: bold;
     display: flex; /* Align icon and text */
     align-items: center;
     justify-content: center;
   }

   /* Energy Icon specific sizing if needed */
   .ttt-player-info .player-energy .energy-icon {
     /* Font size on parent might be enough, but you can adjust here */
     /* Example: font-size: 1.1em; */
     margin-right: 0.3em;
   }

   /* Team colors */
   .ttt-player-info-left { background-color: var(--team1-primary); }
   .ttt-player-info-right { background-color: var(--team2-primary); }

   /* Current turn emphasis for desktop */
   .ttt-player-info.current-turn { /* Simplified selector */
      transform: translateY(-10px) scale(1.08); /* Scale up instead of translate+scale */
      /* transform: translateY(-20px) scale(1.10); /* Alternative: less dramatic translate */
      /* border-color: currentColor;  Use the background color (team color) for border */
      box-shadow: 10px 10px 0px var(--overlay-dark); /* Add glow + existing shadow */
      z-index: 5; /* Bring forward */
   }
    /* --- End Player Card Styling --- */
   /* --- Desktop Ability Bar Styles (Gap only) --- */
   /* The button styles themselves are now global */
   .ability-buttons {
       gap: 1rem; /* Use larger gap for desktop */
   }
   /* --- End Desktop Ability Bar Styles --- */
}

/* Styles for individual cells */
.ttt-cell {
  border: 1px solid var(--border-strong);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem; /* Adjust as needed */
  font-weight: bold;
  cursor: default;
  position: relative; /* For absolute positioning of effects */
}

.ttt-cell.clickable {
  cursor: pointer;
  background-color: var(--overlay-light);
}
.ttt-cell.clickable:hover {
  background-color: var(--overlay-light);
}

/* Apply color directly to the inner span with the piece class */
.ttt-cell .piece-x {
  color: var(--team1-primary); /* Team 1 color */
}
.ttt-cell .piece-o {
  color: var(--team2-primary); /* Team 2 color */
}

/* Remove color from cell itself, it's now on the inner span */
.ttt-cell.piece-x { /* Can keep for other cell-level styling if needed */ }
.ttt-cell.piece-o { /* Can keep for other cell-level styling if needed */ }

/* Styling for the SVG game pieces */
.game-piece-svg {
  width: 75%; /* Adjust size relative to cell */
  height: 75%;
  object-fit: contain; /* Ensure SVG scales nicely */
  display: block; /* Remove extra space below image */
  margin: auto; /* Center within flex container (cell) */
}

/* Animation for the placed piece */
.placed-piece {
  animation: placePieceAnim 0.3s ease-out;
}

@keyframes placePieceAnim {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Player Info Styles */
.ttt-player-info {
  display: flex;
  flex-direction: column; /* Default for top/bottom */
  align-items: center;
  text-align: center;
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid transparent; /* Base border */
  box-shadow: 5px 5px 0px var(--overlay-dark); /* Add shadow for emphasis */
  /* Define all transitions on the base element */
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              background-color 0.3s ease; /* Added background-color for completeness */
}
.ttt-player-info.current-turn {
  /* Base current turn styles - border/shadow/background handled by specific rules in media queries */
}
/* Styles for the div containing the avatar img */
/* Styles for the div containing the avatar img within TTT */
.ttt-player-info .player-avatar {
  display: flex; /* Use flex to center image */
  justify-content: center;
  /* text-align: center; Removed */
  /* Ensure margin only exists on desktop */
  /*width: auto;  Allow avatar container to take full width for centering */
  margin-right: inherit;
}

/* Styles for the avatar img itself within TTT */
.ttt-player-info .player-avatar img {
  /* width: 100px; Base width */
  /* height: 100px;  Base height */
  border-radius: 50%;
  /* margin-bottom: 0.5rem; Moved to desktop rule */
  background-color: var(--brand-surface-alt); /* Background for avatar */
  display: inline-block; /* Ensure text-align works */
  vertical-align: middle; /* Align nicely if needed */
}
.player-details {
  /* Styles for name/energy container */
}
.player-name {
  /* font-weight: bold; */
  margin-bottom: 0.25rem;
}
.player-energy {
  color: var(--text-primary); /* Use primary text for energy */
  font-weight: bold;
}
.energy-icon {
  display: inline-block;
  margin-right: 0.2em;
}

/* Ability Bar Styles */
.ttt-ability-bar {
  padding: 0.5rem;
  text-align: center;
  background-color: var(--overlay-dark);
  border-radius: 24px;
  /* min-height: 0; Removed */
  max-width: 600px; /* Limit width */
  margin: 0.5rem auto 0 auto; /* Center horizontally (top=0.5rem, horizontal=auto, bottom=0) */
}
.ttt-ability-bar h4 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  color: var(--text-secondary);
}
.ability-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
/* --- Consolidated Ability Button Styles (Used for Mobile & Desktop) --- */
.ttt-ability-button {
  aspect-ratio: unset;
  /* padding: 0.8rem 1rem; */ /* Padding is complex due to absolute positioning */
  background-color: var(--button-bg);
  border: 1px solid var(--border-strong);
  border-radius: 16px; /* Rounded corners */
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center content vertically */
  /* width: 100px; Fixed width */
  min-height: 80px; /* Minimum height */
  height: auto; /* Allow height to adjust */
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  position: relative; /* Needed for absolute positioning of children */
  box-shadow: 5px 5px 0 var(--overlay-dark); /* 3D effect */
  padding: 0.5rem 0.2rem; /* Padding for button */
}

.ttt-ability-button:hover:not(:disabled) {
  background-color: var(--button-hover);
  border-color: var(--team1-primary);
  color: var(--team1-primary);
}

.ttt-ability-button:disabled {
  opacity: 0.7; /* Increased opacity */
  cursor: not-allowed;
  background-color: var(--overlay-light);
  color: var(--text-primary); /* Set text color */
  /* Add text shadow for outline effect */
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* Style the icon */
.ttt-ability-button .ability-icon {
  font-size: 3rem; /* Large icon */
  margin-bottom: 0.3rem; /* Space below icon */
  left: 0px; /* Position icon */
  bottom: 30px;
  flex-grow: 0;
  flex-shrink: 0;
  position: absolute; /* Absolute position */
}

.ability-description-wrapper {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  flex: 1;
}

/* Style the description */
.ttt-ability-button .ability-description {
  font-size: 0.8rem; /* Small description text - Restored */
  color: var(--text-primary);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  margin-bottom: 0; /* No margin below description */
  top: 10px;
  position: relative; /* Relative to allow stacking */
  /* flex-shrink: 0; */ /* Removed to allow description to shrink */
  white-space: normal; /* Allow text wrapping */
  word-break: break-word; /* Break long words if necessary */
  line-height: 1.1; /* Adjust line height slightly for wrapping */
}

/* Style the cost */
.ttt-ability-button .ability-cost {
  font-size: 2rem; /* Large cost text */
  font-weight: bold;
  color: var(--accent-warning); /* Keep warning color for cost */
  position: absolute; /* Absolute position */
  top: -8px; /* Position cost top-right */
  right: -5px;
  padding: 1px 5px; /* Padding around cost */
  border-radius: 3px; /* Rounded background for cost */
  line-height: 1; /* Tight line height */
  flex-shrink: 0;
  /* Optional: Add a background to make cost pop */
  /* background-color: rgba(0, 0, 0, 0.5); */
  text-shadow: 1px 1px 2px var(--brand-background); /* Add dark drop shadow */
}

/* Style for active targeting */
.ttt-ability-button.active-targeting {
  border-color: var(--team1-primary); /* Accent border */
  box-shadow: 0 0 8px var(--team1-primary); /* Accent shadow */
  color: var(--team1-primary); /* Accent text color */
}
/* --- End Consolidated Ability Button Styles --- */

/* Active state for 3D press effect */
.ttt-ability-button:active {
  box-shadow: none;
  transform: translate(3px, 3px);
}
.ability-icon {
  margin-right: 0.3em;
}
.ability-cost {
  font-size: 0.8em;
}

/* Targeting, Frozen, Effects */
.ttt-cell.targeting {
  outline: 2px dashed var(--team1-primary);
  outline-offset: -2px;
}
.effect-icon {
  width: 70%;
  height: 70%;
  object-fit: contain;
  opacity: 0.8;
  position: absolute; /* Position over the cell */
  top: 15%;
  left: 15%;
  pointer-events: none; /* Don't interfere with clicks */
}
.ttt-cell.frozen {
  background-color: rgba(77,183,192,0.1);
}
.ttt-cell.frozen .freeze-icon {
  filter: grayscale(0.5) brightness(1.2);
  opacity: 0.6;
}
.ttt-cell.exploded .explosion-effect {
  animation: pulse 0.5s ease-out;
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.5; }
  70% { transform: scale(1.1); opacity: 0.9; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Steal effect animation */
.stolen-piece-effect {
  animation: stealEffectAnim 0.5s ease-in-out;
}

@keyframes stealEffectAnim {
  0% { transform: rotate(0deg) scale(1); filter: brightness(1); }
  50% { transform: rotate(180deg) scale(1.2); filter: brightness(1.5) saturate(2); }
  100% { transform: rotate(360deg) scale(1); filter: brightness(1); }
}

/* Bomb placed by owner indicator */
.ttt-cell.bomb-placed-owner .bomb-icon {
  /* Make it subtle, maybe smaller or less opaque than other icons */
  width: 30%;
  height: 30%;
  opacity: 0.5;
  position: absolute;
  bottom: 5px; /* Position it somewhere distinct */
  right: 5px;
  filter: grayscale(1); /* Optional: make it less prominent */
}

/* Shield indicator */
/* Corrected selector to match JS class name */
.ttt-cell.shielded .shield-lock-icon {
  /* Example: Position top-left, slightly transparent */
  width: 40%;
  height: 40%;
  opacity: 0.5;
  position: absolute;
  top: 5px;
  left: 5px;
  filter: drop-shadow(0 0 2px hsla(189, 100%, 50%, 0.7)); /* Use HSL value for --accent-shield-glow */
}

/* Added rule for saturation effect on shielded pieces */
.ttt-cell.shielded .game-piece-svg {
  filter: saturate(50%);
}

/* Swap effect animation */
.swap-effect {
  animation: swapEffectAnim 0.4s ease-in-out;
}

@keyframes swapEffectAnim {
  0%, 100% { outline: none; background-color: var(--overlay-light); } /* Assuming default clickable bg */
  50% { outline: 3px solid var(--accent-warning); background-color: #FFC85733; } /* Flash warning color */
}

/* Energy Gain Animation */
@keyframes energy-gain-pulse {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(4) rotate(-10deg); }
  50% { transform: scale(3) rotate(10deg); }
  75% { transform: scale(4) rotate(-10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.energy-pulse-animation {
  animation: energy-gain-pulse 0.5s ease-in-out;
  /* Ensure the icon is displayed correctly during animation */
  display: inline-block; /* Already set on .energy-icon, but good to ensure */
}

/* Overlays (Copied from games.css for self-containment, adjust if needed) */
.ttt-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--overlay-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  color: var(--text-primary); /* Use primary text for overlays */
  text-align: center;
}
.ttt-overlay .overlay-content {
  padding: 2rem;
}
.ttt-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--text-inverse); /* Use inverse border for spinner */
  border-radius: 50%;
  animation: spinner 1s linear infinite;
  margin: 1rem auto 0 auto;
}

/* Toast (Copied from games.css for self-containment, adjust if needed) */
.ttt-toast {
  position: fixed;
  top: 50%; /* Changed from bottom */
  left: 50%;
  transform: translate(-50%, -50%); /* Added Y translation */
  background-color: var(--overlay-dark);
  color: var(--text-primary); /* Use primary text for toasts */
  padding: 20px 40px; /* Increased padding */
  font-size: 1.2rem; /* Added font-size */
  border-radius: 4px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.ttt-toast.show {
  opacity: 1;
}

/* --- Tic-Tac-Toe Card Flip Animation --- */
.ttt-cell {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    /* Ensure cells scale with board size */
    aspect-ratio: 1 / 1;
    overflow: visible;
    /*margin: 2px;  Space between cards */
  }
  
  .card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(.4,2,.6,1);
    perspective: 600px;
    will-change: transform;
    display: block;
  }
  
  /* Card fly-in animation for game start */
  .card-fly-in {
    animation: cardFlyIn 0.45s cubic-bezier(.4,2,.6,1) both;
  }
  @keyframes cardFlyIn {
    from {
      transform: translateY(-100vh) scale(0.7) rotate(-10deg);
      opacity: 0;
    }
    70% {
      opacity: 1;
      transform: translateY(10px) scale(1.05) rotate(2deg);
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
  .card-front, .card-back {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    display: flex; align-items: center; justify-content: center;
    top: 0; left: 0;
  }

/* Darken card backs when it's not your turn */
#game-interface.my-turn .card-back img,
.ttt-game-layout.my-turn .card-back img {
  filter: none;
}
#game-interface:not(.my-turn) .card-back img,
.ttt-game-layout:not(.my-turn) .card-back img {
  filter: brightness(0.6);
  transition: filter 0.2s;
}
  .card-back {
    z-index: 2;
  }
  .card-front {
    transform: rotateY(180deg);
    z-index: 1;
  }
  .card.flipped {
    transform: rotateY(180deg);
  }
  
  /* Responsive scaling for mobile */
  @media (max-width: 600px) {
    .ttt-cell, .card {
      min-width: 40px;
      min-height: 40px;
    }
  }
  
  /* Accessibility: visually indicate focus */
  .ttt-cell:focus-within .card,
  .ttt-cell:focus .card {
    outline: 2px solid var(--accent-color, #ffcc00);
    outline-offset: 2px;
  }

  /* Styles for bombed cooldown state */
  .ttt-cell.bombed-cooldown .card {
    opacity: 0.3; /* Make card semi-transparent */
    pointer-events: none; /* Prevent interaction with the hidden card */
    /* Optionally hide the card completely: */
    /* visibility: hidden; */
    transition: opacity 0.3s ease;
   }

   /* Style the cooldown timer number */
   .ttt-cell.bombed-cooldown .bombed-cooldown-timer {
     display: flex; /* Use flex to center */
     justify-content: center;
     align-items: center;
     position: absolute; /* Position over the cell */
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     font-size: 2.5rem; /* Large number */
     font-weight: bold;
     color: var(--accent-warning); /* Warning color */
     text-shadow: 1px 1px 2px rgba(0,0,0,0.7); /* Make it pop */
     pointer-events: none; /* Don't interfere with clicks */
     z-index: 3; /* Ensure it's above the faded card */
   }

   /* Remove styles for the old icon if they existed */
   /* .ttt-cell.bombed-cooldown .bombed-cooldown-icon { display: none; } */