@layer components {
  .bird-game {
    padding: 1rem;
    background:
      radial-gradient(ellipse at 10% 20%, rgba(255, 209, 102, 0.6) 0%, transparent 50%),
      radial-gradient(ellipse at 90% 80%, rgba(239, 71, 111, 0.3) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 50%, rgba(6, 214, 160, 0.2) 0%, transparent 70%),
      linear-gradient(180deg, #87CEEB 0%, #E0F6FF 50%, #F0FFF4 100%);
    position: relative;
    overflow: hidden;
    min-block-size: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  /* Floating decorative clouds */
  .bird-game::before,
  .bird-game::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50px;
    pointer-events: none;
    z-index: 0;
  }

  .bird-game::before {
    width: 120px;
    height: 60px;
    top: 10%;
    left: -10%;
    animation: float-cloud 25s linear infinite;
  }

  .bird-game::after {
    width: 80px;
    height: 40px;
    top: 25%;
    left: -5%;
    animation: float-cloud 35s linear infinite 10s;
  }

  @keyframes float-cloud {
    0% { transform: translateX(0); opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { transform: translateX(calc(100vw + 150px)); opacity: 0; }
  }

  /* Floating bubbles/shapes */
  .bird-game__phase {
    position: relative;
    z-index: 1;
  }

  .bird-game:fullscreen {
    max-inline-size: none;
    block-size: 100dvb;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .bird-game:fullscreen .bird-game__phase {
    max-inline-size: 44rem;
    inline-size: 100%;
  }

  .bird-game__phase:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .bird-game__header {
    text-align: center;
    margin-block-end: var(--block-space-double);
  }

  .bird-game__title {
    font-size: 3rem;
    font-weight: 900;
    color: #FF5A5F;
    text-shadow:
      3px 3px 0 #FFD166,
      6px 6px 0 #264653,
      8px 8px 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
    transform: rotate(-2deg);
    animation: title-bounce 2s ease-in-out infinite;
  }

  @keyframes title-bounce {
    0%, 100% { transform: rotate(-2deg) translateY(0); }
    50% { transform: rotate(-1deg) translateY(-5px); }
  }

  /* ===== LEARN PHASE ===== */

  .bird-game__learn-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    inline-size: 100%;
  }

  .bird-game__learn-card {
    inline-size: 100%;
    max-inline-size: 24rem;
    background: rgba(255, 255, 255, 0.95);
    border: 5px solid #264653;
    border-radius: var(--radius-lg, 1rem);
    box-shadow:
      0 8px 0 #264653,
      0 15px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .bird-game__learn-card--enter {
    animation: card-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  @keyframes card-enter {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }

  .bird-game__learn-image-wrap {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
  }

  .bird-game__learn-image-wrap img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .bird-game__learn-info {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    text-align: center;
  }

  .bird-game__learn-zh {
    font-size: 2.25rem;
    font-weight: 900;
    color: #264653;
    letter-spacing: 4px;
    line-height: 1.3;
  }

  .bird-game__learn-pinyin {
    font-size: 1.1rem;
    color: #06D6A0;
    font-weight: 600;
    letter-spacing: 1px;
  }

  .bird-game__learn-en {
    font-size: 1rem;
    color: #888;
    font-weight: 500;
    text-transform: capitalize;
  }

  .bird-game__learn-sound-btn {
    position: absolute;
    top: -1.5rem;
    right: 1rem;
    inline-size: 3rem;
    block-size: 3rem;
    background-color: #FFD166;
    color: #264653;
    border: 4px solid #264653;
    border-radius: 50%;
    box-shadow: 0 4px 0 #264653;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
  }

  .bird-game__learn-sound-btn:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 6px 0 #264653;
  }

  .bird-game__learn-sound-btn:active {
    transform: scale(0.95) translateY(4px);
    box-shadow: 0 0 0 #264653;
  }

  .bird-game__learn-sound-btn.is-playing {
    background-color: #06D6A0;
    animation: bounce-pulse 1s infinite;
  }

  /* Learn Navigation */
  .bird-game__learn-nav {
    display: flex;
    gap: 1rem;
    justify-content: center;
    inline-size: 100%;
  }

  .bird-game__learn-prev-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    border: 4px solid #264653;
    box-shadow: 0 6px 0 #264653;
    color: #264653;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .bird-game__learn-prev-btn:hover {
    background: #f0f4f8;
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 10px 0 #264653;
  }

  .bird-game__learn-prev-btn:active {
    transform: scale(0.95) translateY(6px);
    box-shadow: 0 0 0 #264653;
  }

  .bird-game__learn-prev-btn svg {
    transition: transform 0.2s ease;
  }

  .bird-game__learn-prev-btn:hover svg {
    transform: translateX(-3px);
  }

  .bird-game__learn-next-btn {
    --btn-kids-bg: #06D6A0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
  }

  .bird-game__learn-next-btn svg {
    transition: transform 0.2s ease;
  }

  .bird-game__learn-next-btn:hover svg {
    transform: translateX(3px);
  }

  /* ===== QUIZ PHASE ===== */

  .bird-game__stage {
    display: grid;
    gap: 1.5rem;
    justify-items: center;
    inline-size: 100%;
    max-inline-size: 52rem;
  }

  /* Sound Button at Top */
  .bird-game__sound-btn {
    --control-height: 7rem;
    inline-size: var(--control-height);
    block-size: var(--control-height);
    background-color: #FFD166;
    color: #264653;
    border: 5px solid #264653;
    border-radius: 50%;
    box-shadow: 0 8px 0 #264653;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .bird-game__sound-btn svg {
    width: 3rem;
    height: 3rem;
  }

  .bird-game__sound-btn:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 0 #264653;
  }

  .bird-game__sound-btn:active {
    transform: scale(0.95) translateY(8px);
    box-shadow: 0 0 0 #264653;
  }

  .bird-game__sound-btn.is-playing {
    background-color: #06D6A0;
    animation: bounce-pulse 1s infinite;
  }

  @keyframes bounce-pulse {
    0%, 100% { transform: scale(1) translateY(0); box-shadow: 0 8px 0 #264653; }
    50% { transform: scale(1.1) translateY(-6px); box-shadow: 0 14px 0 #264653; }
  }

  /* Two Image Options */
  .bird-game__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    inline-size: 100%;
  }

  .bird-game__options--disabled {
    pointer-events: none;
  }

  .bird-game__option {
    position: relative;
    padding: 0;
    border: 5px solid #264653;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.95);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
      0 6px 0 #264653,
      0 10px 20px rgba(0, 0, 0, 0.1);
  }

  .bird-game__option:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 0 #264653;
  }

  .bird-game__option:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #264653;
  }

  .bird-game__option img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: filter 0.3s ease;
  }

  /* Option label (Chinese name under image) */
  .bird-game__option-label {
    padding: 0.5rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #264653;
    letter-spacing: 2px;
    background: #f8f9fa;
    border-top: 3px solid #264653;
  }

  /* Symbol overlay */
  .bird-game__symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    border: 4px solid white;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
  }

  /* Correct option styling */
  .bird-game__option--correct {
    border-color: #06D6A0;
    box-shadow: 0 6px 0 #06D6A0;
  }

  .bird-game__option--correct img {
    filter: brightness(1.1);
  }

  .bird-game__option--correct .bird-game__option-label {
    background: #06D6A0;
    color: white;
    border-top-color: #06D6A0;
  }

  .bird-game__option--correct .bird-game__symbol {
    transform: translate(-50%, -50%) scale(1);
    background: linear-gradient(135deg, #06D6A0 0%, #04b88a 100%);
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  /* Wrong option styling */
  .bird-game__option--wrong {
    border-color: #FF5A5F;
    box-shadow: 0 6px 0 #FF5A5F;
    opacity: 0.8;
  }

  .bird-game__option--wrong img {
    filter: grayscale(50%) brightness(0.8);
  }

  .bird-game__option--wrong .bird-game__option-label {
    background: #FF5A5F;
    color: white;
    border-top-color: #FF5A5F;
  }

  .bird-game__option--wrong .bird-game__symbol {
    transform: translate(-50%, -50%) scale(1);
    background: linear-gradient(135deg, #FF5A5F 0%, #e04a50 100%);
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  @keyframes pop-in {
    0% { transform: translate(-50%, -50%) scale(0); }
    60% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
  }

  /* ===== COMPLETION PHASE ===== */
  .bird-game__phase--complete {
    text-align: center;
  }

  .bird-game__complete-content {
    background: rgba(255, 255, 255, 0.95);
    border: 5px solid #264653;
    border-radius: var(--radius-lg, 1rem);
    box-shadow:
      0 8px 0 #264653,
      0 15px 30px rgba(0, 0, 0, 0.15);
    padding: 2.5rem 3rem;
    animation: complete-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  @keyframes complete-appear {
    0% { opacity: 0; transform: scale(0.8) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }

  .bird-game__complete-stars {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: stars-bounce 1s ease-in-out infinite;
  }

  @keyframes stars-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
  }

  .bird-game__complete-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #FF5A5F;
    text-shadow:
      2px 2px 0 #FFD166,
      4px 4px 0 #264653;
    margin-bottom: 0.75rem;
  }

  .bird-game__complete-message {
    font-size: 1.25rem;
    color: #264653;
    margin-bottom: 2rem;
    font-weight: 600;
  }

  .bird-game__restart-btn {
    --btn-kids-bg: #06D6A0;
    color: white;
    font-size: 1.25rem;
    padding: 1rem 2rem;
  }

  /* Next Button */
  .bird-game__next-btn {
    --btn-kids-bg: #EF476F;
    color: white;
    font-size: 1.25rem;
    padding: 1rem 2rem;
    animation: fade-in-up 0.3s ease;
  }

  @keyframes fade-in-up {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .bird-game__progress {
    text-align: center;
    margin-block-start: var(--block-space);
    font-size: var(--text-sm);
    color: #264653;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: inline-block;
  }

  .bird-game__progress .btn {
    margin-inline-start: 1rem;
  }

  /* ===== FULLSCREEN OVERRIDES ===== */

  .bird-game:fullscreen .bird-game__title {
    font-size: 3.5rem;
  }

  .bird-game:fullscreen .bird-game__learn-card {
    max-inline-size: 28rem;
  }

  .bird-game:fullscreen .bird-game__learn-zh {
    font-size: 2.75rem;
  }

  .bird-game:fullscreen .bird-game__learn-pinyin {
    font-size: 1.3rem;
  }

  .bird-game:fullscreen .bird-game__learn-en {
    font-size: 1.15rem;
  }

  .bird-game:fullscreen .bird-game__sound-btn {
    --control-height: 8rem;
  }

  .bird-game:fullscreen .bird-game__sound-btn svg {
    width: 3.5rem;
    height: 3.5rem;
  }

  .bird-game:fullscreen .bird-game__option-label {
    font-size: 1.5rem;
    padding: 0.75rem;
  }

  .bird-game:fullscreen .bird-game__sound-btn {
    --control-height: 8rem;
  }

  .bird-game:fullscreen .bird-game__sound-btn svg {
    width: 3.5rem;
    height: 3.5rem;
  }

  .bird-game:fullscreen .bird-game__next-btn {
    font-size: 1.4rem;
    padding: 1.1rem 2.25rem;
  }

  /* ===== RESPONSIVE ===== */

  @media (max-width: 42rem) {
    .bird-game__title {
      font-size: 2.25rem;
    }

    .bird-game__options {
      gap: 0.75rem;
    }

    .bird-game__option {
      border-width: 4px;
    }

    .bird-game__option-label {
      font-size: 1rem;
      padding: 0.4rem;
      border-top-width: 2px;
      letter-spacing: 1px;
    }

    .bird-game__symbol {
      width: 4rem;
      height: 4rem;
      font-size: 2rem;
      border-width: 3px;
    }

    .bird-game__learn-card {
      border-width: 4px;
      box-shadow: 0 6px 0 #264653;
    }

    .bird-game__learn-zh {
      font-size: 1.75rem;
    }

    .bird-game__learn-sound-btn {
      inline-size: 2.5rem;
      block-size: 2.5rem;
      border-width: 3px;
      top: -1.25rem;
    }

    .bird-game__learn-sound-btn svg {
      width: 18px;
      height: 18px;
    }

    .bird-game__complete-content {
      padding: 1.5rem 2rem;
    }

    .bird-game__complete-stars {
      font-size: 2.5rem;
    }

    .bird-game__complete-title {
      font-size: 1.75rem;
    }

    .bird-game__complete-message {
      font-size: 1rem;
    }

    .bird-game__restart-btn {
      font-size: 1.1rem;
      padding: 0.75rem 1.5rem;
    }
  }
}
