@layer reset, base, layout, components, game, motion, responsive;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    min-width: 320px;
    min-height: 100%;
  }

  body,
  h1,
  p {
    margin: 0;
  }

  button {
    font: inherit;
  }
}

@layer base {
  :root {
    --sky: oklch(83% 0.105 222);
    --sky-deep: oklch(70% 0.14 225);
    --cream: oklch(98% 0.035 89);
    --paper: oklch(99% 0.018 88);
    --ink: oklch(35% 0.055 345);
    --ink-soft: oklch(48% 0.06 345);
    --coral: oklch(70% 0.19 26);
    --coral-dark: oklch(55% 0.17 23);
    --sun: oklch(88% 0.18 91);
    --sun-dark: oklch(72% 0.16 73);
    --leaf: oklch(69% 0.15 149);
    --blue: oklch(68% 0.15 241);
    --focus: oklch(46% 0.16 255);
    --paper-shadow: oklch(46% 0.07 344 / 0.2);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    color: var(--ink);
    font-family: "Hiragino Maru Gothic ProN", "Yuanti SC", "Microsoft YaHei", sans-serif;
    font-synthesis: none;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background:
      radial-gradient(circle at 6% 10%, color-mix(in oklch, var(--sun) 88%, transparent) 0 3px, transparent 4px),
      radial-gradient(circle at 94% 88%, color-mix(in oklch, var(--coral) 74%, transparent) 0 4px, transparent 5px),
      linear-gradient(135deg, transparent 0 49.6%, color-mix(in oklch, var(--sky-deep) 13%, transparent) 49.7% 50.3%, transparent 50.4%) 0 0 / 72px 72px,
      var(--cream);
    -webkit-font-smoothing: antialiased;
  }

  button {
    color: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  button:focus-visible,
  a:focus-visible {
    outline: 4px solid var(--focus);
    outline-offset: 4px;
  }

  .skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    border-radius: 999px;
    color: var(--paper);
    background: var(--ink);
    font-weight: 900;
    text-decoration: none;
    transform: translateY(-170%);
    transition: transform 180ms var(--ease-out);
  }

  .skip-link:focus {
    transform: translateY(0);
  }
}

@layer layout {
  .game-shell {
    display: grid;
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    min-height: 100dvh;
    margin-inline: auto;
    grid-template-rows: auto minmax(430px, 1fr) auto;
    gap: clamp(12px, 2vh, 22px);
    padding-block: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
  }

  .game-hud {
    display: grid;
    grid-template-columns: auto minmax(270px, 1fr) auto;
    align-items: center;
    gap: 20px;
  }

  .hud-actions {
    display: flex;
    justify-self: end;
    align-items: center;
    gap: 9px;
  }

  .playfield {
    position: relative;
    min-height: 430px;
    overflow: hidden;
    border: 4px solid var(--ink);
    border-radius: 34px 27px 38px 30px;
    background: var(--sky);
    box-shadow:
      0 8px 0 color-mix(in oklch, var(--ink) 18%, var(--cream)),
      0 18px 30px color-mix(in oklch, var(--sky-deep) 20%, transparent);
    isolation: isolate;
  }

  .controls {
    display: grid;
    grid-template-columns: auto minmax(90px, 1fr) minmax(130px, 180px) minmax(90px, 1fr) auto;
    align-items: center;
    gap: clamp(10px, 2vw, 22px);
  }
}

@layer components {
  .brand-mark {
    display: inline-flex;
    justify-self: start;
    align-items: center;
    gap: 10px;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    font-weight: 950;
    letter-spacing: -0.03em;
  }

  .brand-mark__plane {
    display: grid;
    width: 42px;
    height: 35px;
    place-items: center;
    border: 3px solid var(--ink);
    border-radius: 64% 38% 54% 42%;
    color: var(--paper);
    background: var(--coral);
    box-shadow: 3px 3px 0 var(--sun);
    font-size: 1rem;
    rotate: -7deg;
  }

  .mission-card {
    display: flex;
    min-width: min(310px, 32vw);
    align-items: center;
    gap: 12px;
    padding: 8px 18px 8px 11px;
    border: 3px solid var(--ink);
    border-radius: 999px 900px 999px 820px;
    background: var(--paper);
    box-shadow: 0 4px 0 var(--paper-shadow);
  }

  .mission-card > div {
    display: grid;
    min-width: 0;
  }

  .mission-card span:not(.target-mini) {
    color: var(--ink-soft);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.11em;
  }

  .mission-card strong {
    overflow: hidden;
    font-size: clamp(0.84rem, 1.5vw, 1rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .target-mini {
    position: relative;
    display: block;
    width: 36px;
    height: 34px;
    flex: 0 0 auto;
    border: 3px solid var(--ink);
    border-radius: 8px;
    background: linear-gradient(to bottom, transparent 27%, var(--ink) 27% 35%, transparent 35%), var(--cream);
    rotate: -5deg;
  }

  .target-mini::before,
  .target-mini::after {
    position: absolute;
    top: 17px;
    width: 3px;
    height: 4px;
    border-radius: 50%;
    background: var(--ink);
    content: "";
  }

  .target-mini::before {
    left: 9px;
  }

  .target-mini::after {
    right: 9px;
  }

  .target-mini i {
    position: absolute;
    right: 11px;
    bottom: 4px;
    left: 11px;
    height: 5px;
    border-bottom: 2px solid var(--ink);
    border-radius: 50%;
  }

  .score-bubble {
    display: flex;
    min-width: 92px;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border: 3px solid var(--ink);
    border-radius: 22px 28px 21px 26px;
    background: var(--sun);
    box-shadow: 0 4px 0 var(--sun-dark);
    rotate: 1deg;
  }

  .score-bubble span {
    font-size: 0.74rem;
    font-weight: 900;
  }

  .score-bubble strong {
    font-size: 1.55rem;
    line-height: 1;
  }

  .weather-badge {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 3px solid var(--ink);
    border-radius: 22px 25px 20px 26px;
    background: color-mix(in oklch, var(--sky) 58%, var(--paper));
    box-shadow: 0 4px 0 var(--paper-shadow);
    transition: background-color 260ms linear, transform 260ms var(--ease-out);
  }

  .weather-badge span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--sun);
    font-size: 1.05rem;
    line-height: 1;
  }

  .weather-badge strong {
    max-width: 4.8em;
    font-size: 0.7rem;
    font-weight: 950;
    line-height: 1.08;
  }

  .weather-badge[data-weather="cloudy"] {
    background: oklch(85% 0.025 250);
  }

  .weather-badge[data-weather="cloudy"] span,
  .weather-badge[data-weather="rain"] span {
    color: var(--paper);
    background: oklch(58% 0.055 250);
  }

  .weather-badge[data-weather="rain"] {
    background: oklch(79% 0.055 238);
  }

  .weather-badge[data-weather="snow"] {
    background: oklch(94% 0.035 215);
  }

  .weather-badge[data-weather="snow"] span {
    color: var(--blue);
    background: var(--paper);
  }

  .health-meter {
    display: flex;
    min-width: 148px;
    min-height: 48px;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 3px solid var(--ink);
    border-radius: 22px 18px 24px 20px;
    background: var(--paper);
    box-shadow: 0 4px 0 var(--paper-shadow);
  }

  .health-meter__heart {
    color: var(--coral);
    font-size: 1.35rem;
    line-height: 1;
    text-shadow: 1px 2px 0 color-mix(in oklch, var(--ink) 26%, transparent);
  }

  .health-meter__body {
    display: grid;
    min-width: 66px;
    flex: 1;
    gap: 3px;
  }

  .health-meter__body > span:first-child {
    font-size: 0.6rem;
    font-weight: 950;
    line-height: 1;
  }

  .health-meter__track {
    position: relative;
    display: block;
    width: 100%;
    height: 8px;
    overflow: hidden;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: color-mix(in oklch, var(--ink) 10%, var(--paper));
  }

  .health-meter__track i {
    position: absolute;
    inset: 0;
    display: block;
    border-radius: inherit;
    background: var(--leaf);
    transform: scaleX(var(--health-ratio, 1));
    transform-origin: left center;
    transition: transform 280ms var(--ease-out), background-color 180ms linear;
  }

  .health-meter > strong {
    min-width: 2.1em;
    font-size: 0.94rem;
    text-align: right;
  }

  .health-meter[data-level="medium"] .health-meter__track i {
    background: var(--sun-dark);
  }

  .health-meter[data-level="low"] .health-meter__track i {
    background: var(--coral);
  }

  .sound-toggle {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--paper);
    box-shadow: 0 4px 0 var(--paper-shadow);
    cursor: pointer;
    transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
  }

  .sound-toggle span {
    height: 20px;
    font-size: 1.25rem;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
  }

  .sound-toggle i {
    font-size: 0.56rem;
    font-style: normal;
    font-weight: 900;
  }

  .sound-toggle[data-enabled="false"] {
    color: var(--ink-soft);
    background: color-mix(in oklch, var(--ink) 7%, var(--paper));
  }

  .sound-toggle[data-enabled="false"] span {
    text-decoration: line-through 3px;
  }

  .move-button,
  .fire-button,
  .start-button {
    border: 4px solid var(--ink);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
  }

  .move-button {
    display: grid;
    width: clamp(62px, 8vw, 78px);
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: var(--paper);
    box-shadow: 0 7px 0 color-mix(in oklch, var(--ink) 26%, var(--cream));
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 950;
    line-height: 1;
  }

  .fire-button {
    position: relative;
    display: grid;
    min-height: 78px;
    place-items: center;
    align-content: center;
    border-radius: 50% 48% 45% 52% / 47% 54% 46% 52%;
    color: var(--paper);
    background: var(--coral);
    box-shadow:
      0 8px 0 var(--coral-dark),
      0 12px 0 color-mix(in oklch, var(--ink) 25%, var(--cream));
    rotate: -1deg;
  }

  .fire-button strong {
    font-size: clamp(1.35rem, 2.8vw, 1.9rem);
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.04em;
  }

  .fire-button small {
    margin-top: 4px;
    color: color-mix(in oklch, var(--paper) 86%, var(--sun));
    font-size: 0.67rem;
    font-weight: 900;
  }

  .fire-button__flash {
    position: absolute;
    top: -12px;
    right: 8px;
    color: var(--sun);
    font-size: 1.5rem;
    text-shadow: 2px 2px 0 var(--ink);
  }

  .control-note {
    display: grid;
    justify-items: start;
    line-height: 1.2;
  }

  .control-note--right {
    justify-items: end;
    text-align: right;
  }

  .control-note strong {
    font-size: clamp(0.75rem, 1.6vw, 0.94rem);
  }

  .control-note span {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: clamp(0.6rem, 1.2vw, 0.72rem);
    font-weight: 700;
  }

  @media (hover: hover) {
    .sound-toggle:hover,
    .move-button:hover,
    .start-button:hover {
      transform: translateY(2px) rotate(-1deg);
      box-shadow: 0 3px 0 var(--paper-shadow);
    }

    .fire-button:hover {
      transform: translateY(3px) scale(1.02);
      box-shadow:
        0 5px 0 var(--coral-dark),
        0 8px 0 color-mix(in oklch, var(--ink) 25%, var(--cream));
    }
  }

  .move-button:active,
  .fire-button:active,
  .start-button:active {
    transform: translateY(6px) scale(0.98);
    box-shadow: 0 2px 0 color-mix(in oklch, var(--ink) 24%, var(--cream));
  }
}

@layer game {
  #game-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
  }

  .start-curtain {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 32px;
    overflow: hidden;
    text-align: center;
    background:
      radial-gradient(circle at 50% 36%, color-mix(in oklch, var(--paper) 55%, transparent) 0 120px, transparent 121px),
      color-mix(in oklch, var(--sky) 82%, transparent);
    backdrop-filter: blur(4px);
    transition: opacity 360ms var(--ease-out), visibility 360ms linear;
  }

  .start-curtain.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .curtain-cloud {
    position: relative;
    width: 210px;
    height: 106px;
    margin-bottom: 3px;
    border: 4px solid var(--ink);
    border-radius: 54% 46% 48% 52% / 60% 62% 38% 40%;
    background: var(--paper);
    box-shadow: 0 7px 0 color-mix(in oklch, var(--sky-deep) 22%, transparent);
  }

  .curtain-cloud::before,
  .curtain-cloud::after {
    position: absolute;
    z-index: -1;
    border: 4px solid var(--ink);
    border-radius: 50%;
    background: var(--paper);
    content: "";
  }

  .curtain-cloud::before {
    top: -43px;
    left: 34px;
    width: 92px;
    height: 92px;
  }

  .curtain-cloud::after {
    top: -22px;
    right: 25px;
    width: 74px;
    height: 74px;
  }

  .curtain-balloon {
    position: absolute;
    z-index: 2;
    top: -58px;
    left: 74px;
    width: 66px;
    height: 57px;
    border: 4px solid var(--ink);
    border-radius: 11px;
    background: linear-gradient(to bottom, transparent 26%, var(--ink) 26% 33%, transparent 33%), var(--cream);
    rotate: 4deg;
  }

  .curtain-balloon::before,
  .curtain-balloon::after {
    position: absolute;
    top: 31px;
    width: 5px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink);
    content: "";
  }

  .curtain-balloon::before {
    left: 17px;
  }

  .curtain-balloon::after {
    right: 17px;
  }

  .curtain-balloon i {
    position: absolute;
    right: 20px;
    bottom: 7px;
    left: 20px;
    height: 8px;
    border-bottom: 3px solid var(--ink);
    border-radius: 50%;
  }

  .curtain-balloon b {
    position: absolute;
    right: -22px;
    bottom: -12px;
    display: grid;
    width: 42px;
    height: 27px;
    place-items: center;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--coral);
    color: var(--paper);
    font-size: 0.72rem;
    font-style: normal;
    rotate: -7deg;
  }

  .curtain-balloon b::after {
    content: "+30";
  }

  .curtain-spark {
    position: absolute;
    z-index: 3;
    color: var(--coral);
    font-size: 1.8rem;
    text-shadow: 2px 2px 0 var(--ink);
  }

  .curtain-spark--one {
    top: -35px;
    left: -28px;
  }

  .curtain-spark--two {
    right: -34px;
    bottom: 18px;
    color: var(--sun);
    rotate: 13deg;
  }

  .start-eyebrow {
    margin-top: 8px;
    color: var(--ink-soft);
    font-size: clamp(0.74rem, 1.7vw, 0.9rem);
    font-weight: 950;
    letter-spacing: 0.16em;
  }

  .start-curtain h1 {
    margin-top: 5px;
    font-size: clamp(2.3rem, 7vw, 5.3rem);
    font-weight: 950;
    line-height: 1.02;
    letter-spacing: -0.08em;
    text-shadow: 0 4px 0 color-mix(in oklch, var(--paper) 72%, transparent);
  }

  .start-curtain h1 span {
    display: inline-block;
    margin-right: 0.12em;
    color: var(--coral-dark);
    rotate: -3deg;
  }

  .start-copy {
    margin-top: 9px;
    color: var(--ink-soft);
    font-size: clamp(0.9rem, 2vw, 1.07rem);
    font-weight: 750;
    line-height: 1.48;
  }

  .start-copy strong {
    color: var(--coral-dark);
    font-size: 1.17em;
    letter-spacing: 0.08em;
  }

  .start-rules {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 11px;
  }

  .start-rules span {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 2px solid color-mix(in oklch, var(--ink) 72%, transparent);
    border-radius: 999px;
    background: color-mix(in oklch, var(--paper) 72%, transparent);
    font-size: 0.7rem;
    font-weight: 900;
  }

  .start-rules i {
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border-radius: 50%;
    color: var(--paper);
    background: var(--coral);
    font-style: normal;
    font-size: 0.78rem;
  }

  .start-rules span:last-child i {
    background: var(--leaf);
  }

  .start-button {
    display: flex;
    min-width: 164px;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-top: 18px;
    border-radius: 999px 880px 999px 840px;
    color: var(--paper);
    background: var(--coral);
    box-shadow:
      0 7px 0 var(--coral-dark),
      0 11px 0 color-mix(in oklch, var(--ink) 24%, transparent);
    font-size: 1.15rem;
    font-weight: 950;
  }

  .start-button span {
    font-size: 0.9rem;
  }

  .game-announcer {
    position: absolute;
    z-index: 3;
    right: 20px;
    bottom: 14px;
    max-width: min(70%, 390px);
    padding: 7px 13px;
    border: 2px solid color-mix(in oklch, var(--ink) 60%, transparent);
    border-radius: 999px;
    color: var(--ink);
    background: color-mix(in oklch, var(--paper) 85%, transparent);
    font-size: clamp(0.67rem, 1.3vw, 0.78rem);
    font-weight: 850;
    pointer-events: none;
  }

  .repair-curtain {
    position: absolute;
    z-index: 6;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 28px;
    color: var(--ink);
    background:
      radial-gradient(circle at 50% 48%, color-mix(in oklch, var(--paper) 88%, transparent) 0 170px, transparent 171px),
      color-mix(in oklch, var(--sky) 85%, transparent);
    backdrop-filter: blur(6px);
    text-align: center;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms var(--ease-out), visibility 280ms linear;
  }

  .repair-curtain.is-showing {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .repair-curtain__tool {
    color: var(--sun-dark);
    font-size: 1.6rem;
    text-shadow: 2px 2px 0 var(--ink);
  }

  .repair-curtain > p:first-of-type {
    margin-top: 5px;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0.16em;
  }

  .repair-curtain h2 {
    margin: 4px 0 11px;
    font-size: clamp(2rem, 5.6vw, 4rem);
    line-height: 1;
    letter-spacing: -0.07em;
  }

  .repair-battery {
    position: relative;
    width: 74px;
    height: 100px;
    border: 5px solid var(--ink);
    border-radius: 18px 15px 20px 16px;
    background: var(--paper);
    box-shadow: 0 7px 0 var(--paper-shadow);
    rotate: -3deg;
  }

  .repair-battery::before {
    position: absolute;
    top: -13px;
    left: 23px;
    width: 23px;
    height: 12px;
    border: 4px solid var(--ink);
    border-radius: 5px 5px 0 0;
    background: var(--sun);
    content: "";
  }

  .repair-battery i {
    position: absolute;
    right: 7px;
    bottom: 7px;
    left: 7px;
    height: 68%;
    border-radius: 10px 8px 12px 9px;
    background: var(--leaf);
  }

  .repair-battery b {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--paper);
    font-size: 2.4rem;
    line-height: 1;
  }

  .repair-copy {
    max-width: 330px;
    margin-top: 15px;
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 750;
  }

  .repair-copy strong {
    color: var(--coral-dark);
    font-size: 1.18em;
  }

  .repair-button {
    margin-top: 15px;
  }

  .damage-vignette {
    position: absolute;
    z-index: 5;
    inset: 0;
    border: 0 solid color-mix(in oklch, var(--coral) 52%, transparent);
    opacity: 0;
    pointer-events: none;
  }

  .damage-vignette.is-showing {
    animation: damage-wash 620ms var(--ease-out) both;
  }

  .combo-toast {
    position: absolute;
    z-index: 3;
    top: 22%;
    left: 7%;
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 9px 16px 10px;
    border: 3px solid var(--ink);
    border-radius: 28px 20px 25px 22px;
    background: var(--sun);
    box-shadow: 4px 5px 0 var(--paper-shadow);
    opacity: 0;
    pointer-events: none;
    rotate: -7deg;
  }

  .combo-toast span,
  .combo-toast i {
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 950;
  }

  .combo-toast strong {
    color: var(--coral-dark);
    font-size: 1.8rem;
    line-height: 1;
  }

  .level-ribbon {
    position: absolute;
    z-index: 3;
    top: 20%;
    left: 50%;
    display: grid;
    min-width: 210px;
    justify-items: center;
    padding: 10px 28px 13px;
    border: 4px solid var(--ink);
    background: var(--coral);
    box-shadow: 0 7px 0 var(--coral-dark);
    color: var(--paper);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -30px) rotate(-2deg);
    clip-path: polygon(0 8%, 12% 0, 88% 0, 100% 8%, 93% 50%, 100% 92%, 88% 100%, 12% 100%, 0 92%, 7% 50%);
  }

  .level-ribbon small {
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.15em;
  }

  .level-ribbon strong {
    font-size: 1.55rem;
  }
}

@layer motion {
  .curtain-balloon {
    animation: curtain-float 2.8s ease-in-out infinite alternate;
  }

  .curtain-spark--one {
    animation: tiny-turn 2.2s ease-in-out infinite alternate;
  }

  .curtain-spark--two {
    animation: tiny-turn 1.8s 300ms ease-in-out infinite alternate-reverse;
  }

  .combo-toast.is-showing {
    animation: combo-pop 1.15s var(--ease-out) both;
  }

  .level-ribbon.is-showing {
    animation: level-arrive 1.6s var(--ease-out) both;
  }

  @keyframes curtain-float {
    from { transform: translateY(-3px) rotate(-2deg); }
    to { transform: translateY(7px) rotate(2deg); }
  }

  @keyframes tiny-turn {
    from { transform: rotate(-8deg) scale(0.92); }
    to { transform: rotate(10deg) scale(1.08); }
  }

  @keyframes combo-pop {
    0% { opacity: 0; transform: translateY(18px) scale(0.72); }
    18%, 72% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-18px) scale(0.9); }
  }

  @keyframes level-arrive {
    0% { opacity: 0; transform: translate(-50%, -30px) scale(0.86) rotate(-2deg); }
    18%, 72% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(1deg); }
    100% { opacity: 0; transform: translate(-50%, -12px) scale(0.96) rotate(-1deg); }
  }

  @keyframes damage-wash {
    0% { border-width: 25px; opacity: 0; }
    24% { border-width: 14px; opacity: 0.78; }
    100% { border-width: 0; opacity: 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 1ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 1ms !important;
    }
  }
}

@layer responsive {
  @media (max-width: 980px) and (min-width: 761px) {
    .game-hud {
      grid-template-columns: 1fr auto;
    }

    .mission-card {
      grid-row: 2;
      grid-column: 1 / -1;
      width: 100%;
      min-width: 0;
    }
  }

  @media (max-width: 760px) {
    .game-shell {
      width: min(100% - 18px, 620px);
      grid-template-rows: auto minmax(440px, 1fr) auto;
      gap: 10px;
      padding-block: max(9px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-bottom));
    }

    .game-hud {
      grid-template-columns: 1fr auto;
      gap: 8px;
    }

    .hud-actions {
      grid-row: 2;
      grid-column: 1 / -1;
      display: grid;
      width: 100%;
      grid-template-columns: auto minmax(112px, 1fr) auto auto;
      gap: 7px;
    }

    .brand-mark {
      font-size: 0.94rem;
    }

    .brand-mark__plane {
      width: 36px;
      height: 31px;
    }

    .mission-card {
      grid-row: 3;
      grid-column: 1 / -1;
      width: 100%;
      min-width: 0;
      padding-block: 6px;
    }

    .weather-badge {
      min-height: 46px;
      padding-inline: 8px;
    }

    .weather-badge strong {
      max-width: 4.1em;
      font-size: 0.64rem;
    }

    .health-meter {
      min-width: 0;
      min-height: 46px;
      padding-inline: 8px;
    }

    .health-meter__body {
      min-width: 54px;
    }

    .health-meter__heart {
      font-size: 1.15rem;
    }

    .health-meter > strong {
      min-width: 1.9em;
      font-size: 0.82rem;
    }

    .score-bubble {
      min-width: 80px;
      padding-inline: 10px;
    }

    .sound-toggle {
      width: 46px;
      height: 46px;
    }

    .playfield {
      min-height: 440px;
      border-radius: 25px 20px 28px 23px;
    }

    .controls {
      grid-template-columns: auto 1fr auto;
      gap: 14px;
    }

    .control-note {
      display: none;
    }

    .fire-button {
      min-height: 74px;
    }

    .game-announcer {
      right: 10px;
      bottom: 9px;
      max-width: calc(100% - 20px);
      text-align: center;
    }
  }

  @media (max-height: 760px) and (min-width: 761px) {
    .game-shell {
      grid-template-rows: auto minmax(400px, 1fr) auto;
      gap: 9px;
      padding-block: 9px;
    }

    .playfield {
      min-height: 400px;
    }

    .move-button {
      width: 60px;
    }

    .fire-button {
      min-height: 64px;
    }

    .curtain-cloud {
      scale: 0.78;
      margin-block: -10px -7px;
    }

    .start-button {
      min-height: 52px;
      margin-top: 12px;
    }
  }

  @media (max-width: 420px) {
    .brand-mark > span:last-child {
      max-width: 5.4em;
      line-height: 1.05;
    }

    .hud-actions {
      gap: 7px;
    }

    .score-bubble {
      min-width: 66px;
      gap: 5px;
      padding-inline: 8px;
    }

    .score-bubble strong {
      font-size: 1.35rem;
    }

    .curtain-cloud {
      scale: 0.84;
      margin-block: -7px -2px;
    }

    .weather-badge span {
      width: 24px;
      height: 24px;
      font-size: 0.92rem;
    }

    .weather-badge strong {
      display: none;
    }

    .health-meter__heart {
      display: none;
    }

    .health-meter__body > span:first-child {
      font-size: 0.56rem;
    }

    .start-curtain {
      padding: 22px 16px;
    }

    .move-button {
      width: 62px;
    }

    .controls {
      gap: 9px;
    }
  }
}
