/* CSS Custom Properties for extra styling not covered by Tailwind */

:root {
  --bounce-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Custom Scrollbar for a modern look */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #F8FAFC;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: #4A148C;
  border-radius: 10px;
  border: 2px solid #F8F9FA;
}
::-webkit-scrollbar-thumb:hover {
  background: #311B92;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

@keyframes floatSlow {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes floatUpFade {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  80% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes flyRight {
  0% { transform: translateX(-100vw) translateY(0); }
  25% { transform: translateX(-50vw) translateY(-20px); }
  50% { transform: translateX(0vw) translateY(20px); }
  75% { transform: translateX(50vw) translateY(-10px); }
  100% { transform: translateX(100vw) translateY(0); }
}

@keyframes jumpArc {
  0% { transform: translateY(0) scaleX(-1); }
  50% { transform: translateY(-30px) scaleX(-1); }
  100% { transform: translateY(0) scaleX(-1); }
}

@keyframes scrollBg {
  0% { background-position: 0 0; }
  100% { background-position: -1000px 0; }
}

@keyframes swim {
  0% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(20px) translateY(10px); }
  100% { transform: translateX(0) translateY(0); }
}

.cloud-anim {
  animation: float 6s ease-in-out infinite;
}

.cloud-anim-slow {
  animation: floatSlow 8s ease-in-out infinite;
}

.animate-pop {
  animation: popIn 0.5s var(--bounce-easing) forwards;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-float-up {
  animation: floatUpFade 1s forwards;
  pointer-events: none;
}

.animate-fly {
  animation: flyRight 10s linear infinite;
}

.animate-jump {
  animation: jumpArc 0.5s ease-out;
}

.animate-scroll-bg {
  animation: scrollBg 2s linear infinite;
}

.animate-swim {
  animation: swim 3s ease-in-out infinite;
}


/* Glassmorphism Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* Flashcard Flip Effect */
.flashcard-scene {
  perspective: 1000px;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.flashcard-scene.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 1rem;
}
.flashcard-back {
  transform: rotateY(180deg);
}

/* Drag & Drop */
.draggable {
  cursor: grab;
}
.draggable:active {
  cursor: grabbing;
}
.drop-zone {
  transition: all 0.2s ease;
}
.drop-zone.drag-over {
  background-color: rgba(78, 205, 196, 0.2);
  border-color: #4ECDC4;
  transform: scale(1.05);
}

/* Custom Audio Player Styling */
.custom-audio-player {
  filter: sepia(20%) saturate(70%) grayscale(1) contrast(99%) invert(12%);
  border-radius: 50px;
  background-color: #F8F9FA;
}
.custom-audio-player::-webkit-media-controls-panel {
  background-color: #F8F9FA;
}
.custom-audio-player::-webkit-media-controls-play-button {
  background-color: #4A148C;
  border-radius: 50%;
  cursor: pointer;
}
.custom-audio-player::-webkit-media-controls-play-button:hover {
  background-color: #311B92;
}

/* --- Maze RPG Game Styles --- */
.maze-board {
    --cell-size: 55px;
    --cell-gap: 3px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(13, var(--cell-size));
    grid-template-rows: repeat(13, var(--cell-size));
    gap: var(--cell-gap);
    background: #78350f;
    padding: 15px;
    border-radius: 1rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
    border: 6px solid #b45309;
    margin: 0 auto;
    direction: ltr;
    max-width: 100%;
    overflow: auto;
}

#maze-player {
    --cell-size: 55px;
    --cell-gap: 3px;
    position: absolute;
    left: calc(var(--x, 1) * (var(--cell-size) + var(--cell-gap)) + 15px);
    top: calc(var(--y, 1) * (var(--cell-size) + var(--cell-gap)) + 15px);
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--cell-size) * 0.7);
    z-index: 10;
    transition: left 0.15s ease, top 0.15s ease;
    pointer-events: none;
}

#maze-player::before {
    content: "";
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    background: rgba(217, 119, 6, 0.3);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 10px #d97706;
    z-index: -1;
    animation: player-pulse 1.2s infinite alternate;
}

.maze-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--cell-size) * 0.6);
    transition: all 0.25s ease;
    position: relative;
    user-select: none;
}

.maze-cell.wall {
    background: linear-gradient(145deg, #b45309, #451a03);
    border: 1px solid #d97706;
}
.maze-cell.path {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}
.maze-cell.door-locked {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    border: 2px solid #fca5a5;
    color: white;
    cursor: pointer;
    animation: door-glow 1s infinite alternate;
}
.maze-cell.door-unlocked {
    background: linear-gradient(135deg, #10b981, #064e3b);
    border: 2px solid #a7f3d0;
    color: white;
}
.maze-cell.start {
    background: #e2e8f0;
    border: 2px dashed #64748b;
}
.maze-cell.end {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border: 2px solid #fde68a;
    animation: gold-pulse 1.2s infinite alternate;
}

@keyframes door-glow {
    0% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
    100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
}
@keyframes player-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 15px #f59e0b; }
}
@keyframes gold-pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
    100% { transform: scale(1.05); box-shadow: 0 0 25px rgba(245, 158, 11, 1); }
}

/* Tactile Console D-pad */
.maze-controls-layout {
    margin-top: 15px;
    position: relative;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.maze-controls-layout .ctrl-btn {
    position: absolute;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    font-weight: bold;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.maze-controls-layout .ctrl-btn:active {
    transform: scale(0.9);
    background: #e2e8f0;
}
#ctrl-up { top: 0; left: 50%; transform: translateX(-50%); }
#ctrl-up:active { transform: translateX(-50%) scale(0.9); }
#ctrl-down { bottom: 0; left: 50%; transform: translateX(-50%); }
#ctrl-down:active { transform: translateX(-50%) scale(0.9); }
#ctrl-left { left: 0; top: 50%; transform: translateY(-50%); }
#ctrl-left:active { transform: translateY(-50%) scale(0.9); }
#ctrl-right { right: 0; top: 50%; transform: translateY(-50%); }
#ctrl-right:active { transform: translateY(-50%) scale(0.9); }

@media (max-width: 768px) {
    .maze-board {
        --cell-size: 25px;
        --cell-gap: 2px;
        padding: 8px;
    }
    #maze-player {
        --cell-size: 25px;
        --cell-gap: 2px;
    }
}

/* --- Professional Game Effects & SVGs --- */
.game-bg-waves {
    background: linear-gradient(to bottom, #0ea5e9 0%, #38bdf8 100%);
    position: relative;
}
.game-bg-waves::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 120px;
    background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1440 320" xmlns="http://www.w3.org/2000/svg"><path fill="%23ffffff" fill-opacity="0.3" d="M0,160L48,170.7C96,181,192,203,288,202.7C384,203,480,181,576,149.3C672,117,768,75,864,69.3C960,64,1056,96,1152,117.3C1248,139,1344,149,1392,154.7L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') bottom/cover no-repeat;
    animation: wave-slide 10s linear infinite;
    pointer-events: none;
}

@keyframes wave-slide {
    0% { background-position-x: 0; }
    100% { background-position-x: 1440px; }
}

.isometric-stairs {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    perspective: 1200px;
}

.stair-step {
    width: 250px;
    height: 60px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    transform: rotateX(60deg) rotateZ(45deg);
    transform-style: preserve-3d;
    box-shadow: 
      -15px 15px 0 #1e3a8a,
      -15px 15px 20px rgba(0,0,0,0.4);
    margin-top: -25px;
    transition: all 0.5s;
    position: relative;
    border: 1px solid #93c5fd;
}

.car-sprite {
    width: 140px;
    height: 70px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50"><path d="M10 30 h 80 v 10 h -80 z" fill="%23ef4444"/><circle cx="25" cy="40" r="10" fill="%231f2937"/><circle cx="75" cy="40" r="10" fill="%231f2937"/><path d="M20 30 l 10 -15 h 30 l 15 15 z" fill="%23b91c1c"/><rect x="40" y="18" width="10" height="10" fill="%2360a5fa" opacity="0.8"/></svg>') no-repeat center/contain;
    filter: drop-shadow(0 15px 10px rgba(0,0,0,0.4));
}

.exhaust-flame {
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 20px;
    background: radial-gradient(ellipse at right, #fbbf24, #ef4444, transparent);
    animation: flicker 0.1s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.7; transform: translateY(-50%) scaleX(0.8); }
    100% { opacity: 1; transform: translateY(-50%) scaleX(1.2); }
}

.particle-explosion {
    position: absolute;
    pointer-events: none;
    width: 12px;
    height: 12px;
    background: #fbbf24;
    border-radius: 50%;
    animation: popOut 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 100;
}

@keyframes popOut {
    0% { transform: scale(1) translate(0,0); opacity: 1; }
    100% { transform: scale(0) translate(var(--tx), var(--ty)); opacity: 0; }
}

.target-broken {
    animation: breakApart 0.6s forwards;
}

@keyframes breakApart {
    0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 10px red); }
    100% { transform: scale(1.5) rotate(45deg); opacity: 0; filter: grayscale(1); }
}

/* Character Animation for Stairs */
.runner-char {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 20;
    filter: drop-shadow(0 10px 5px rgba(0,0,0,0.5));
}

/* Fishing Hook Enhancements */
.fishing-line {
    background: linear-gradient(to right, #9ca3af, #f3f4f6, #9ca3af);
    box-shadow: 0 0 5px rgba(255,255,255,0.8);
}

/* Flash Screen for Errors */
.flash-error {
    animation: flashRed 0.5s;
}
@keyframes flashRed {
    0% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: inset 0 0 50px 20px rgba(239, 68, 68, 0.5); }
    100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
}
