:root {
  --teal: #246b70;
  --leaf: #477a54;
  --paper: #fff9df;
  --coral: #e96f57;
  --gold: #f2c14e;
  --ink: #173f45;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #246b70;
}
.kite-day {
  color: var(--ink);
  background: linear-gradient(#75ced2 0 46%, #477a54 46%);
  touch-action: manipulation;
}
.kite-day .game-shell {
  height: 100dvh;
  min-height: 0;
  padding: max(7px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: 50px auto minmax(180px, 1fr) auto;
  gap: 6px;
  max-width: 760px;
  background: transparent;
}
.kite-day header {
  padding: 0;
  min-height: 50px;
}
.kite-day .brand {
  color: white;
}
.kite-day .brand small {
  color: #fff0a8;
}
.kite-day .round-button {
  width: 46px;
  height: 46px;
  min-height: 46px;
  background: #fffdf0;
  color: var(--teal);
  border-color: white;
}
.kite-day .mission-card {
  margin: 0;
  min-height: 72px;
  padding: 7px 12px;
  background: #fffdf2f7;
  border: 2px solid var(--teal);
  color: var(--ink);
}
.kite-day .mission-card > div:first-child {
  display: flex;
  justify-content: space-between;
}
.kite-day .mission-card p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.15;
}
.kite-day .progress-track {
  height: 7px;
  margin: 4px 0 0;
}
.kite-day .progress-track i {
  background: linear-gradient(90deg, var(--gold), var(--coral));
}
#stage {
  position: relative;
  min-height: 0;
  height: auto;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 22px;
  background: linear-gradient(#78d0d5 0 70%, #7eaa62 70%);
  box-shadow: 0 8px 18px #173f4566;
  isolation: isolate;
}
#stage canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}
.scene-caption {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 999px;
  background: #246b70dd;
  color: white;
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.12em;
}
#loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-weight: 900;
}
#pennants {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}
.pennant {
  position: absolute;
  top: 10%;
  padding: 4px 7px;
  border-radius: 9px;
  background: #fff9dfee;
  border: 2px solid currentColor;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 3px 8px #173f4544;
}
.pennant:nth-child(1) {
  left: 7%;
  color: #bd493f;
}
.pennant:nth-child(2) {
  right: 7%;
  color: #2f668d;
}
.machine-board {
  margin: 0;
  padding: 7px 8px;
  border: 2px solid var(--teal);
  border-radius: 17px;
  background: #fffdf2f7;
  color: var(--ink);
  display: grid;
  gap: 5px;
}
#targets {
  position: static;
  inset: auto;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.target-chip {
  padding: 3px 7px;
  border-radius: 8px;
  background: #e8f3ee;
  border: 1px solid #76a99b;
  font-size: 10px;
  font-weight: 900;
}
#controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.clutch {
  min-height: 50px;
  padding: 4px;
  border: 2px solid #337c79;
  border-radius: 12px;
  background: #dcefe4;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 3px 0 #245c5a;
  line-height: 1.05;
}
.clutch span {
  display: block;
  font-size: 17px;
  line-height: 20px;
}
.clutch.hinted {
  animation: signal 0.7s ease-in-out infinite alternate;
}
.clutch.changed {
  background: #fff0a8;
}
.board-actions {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.kite-day #hint,
.kite-day #undo,
.kite-day #test-wind,
.kite-day #restart {
  min-height: 44px;
  padding: 6px 8px;
}
.kite-day #hint,
.kite-day #undo {
  min-width: 63px;
}
.kite-day #test-wind {
  flex: 1;
  max-width: 190px;
  margin: 0;
  background: linear-gradient(135deg, var(--coral), #bd493f);
  color: white;
}
.kite-day #restart {
  min-width: 44px;
}
.kite-day .intro-card {
  border-color: var(--teal);
  background: #fffdf2;
}
.kite-day .primary {
  background: linear-gradient(135deg, #358b88, var(--teal));
  color: white;
}
.kite-day .eyebrow {
  color: #2b7591;
}
.kite-day button:focus-visible,
.kite-day a:focus-visible {
  outline: 4px solid #ffe36e;
  outline-offset: 2px;
}
body.stage-complete #stage {
  box-shadow:
    0 0 0 4px #ffe36e,
    0 0 30px #fff39b;
}
@keyframes signal {
  to {
    box-shadow:
      0 3px 0 #245c5a,
      0 0 17px 6px #ffe36e;
    filter: brightness(1.1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .clutch {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 360px) {
  .kite-day .brand small {
    display: none;
  }
  .kite-day .mission-card p {
    font-size: 11px;
  }
  .target-chip {
    font-size: 9px;
    padding: 3px 4px;
  }
  .kite-day #hint,
  .kite-day #undo {
    min-width: 56px;
    font-size: 10px;
  }
  .kite-day #test-wind {
    font-size: 10px;
  }
  .machine-board {
    padding: 5px;
    gap: 4px;
  }
  .clutch {
    font-size: 9px;
  }
}
@media (max-height: 620px) and (orientation: portrait) {
  .kite-day .game-shell {
    grid-template-rows: 46px 68px minmax(160px, 1fr) auto;
    gap: 4px;
  }
  .kite-day header {
    min-height: 46px;
  }
  .kite-day .round-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .kite-day .mission-card {
    min-height: 0;
    padding: 4px 10px;
  }
  .machine-board {
    padding: 4px 6px;
  }
  .clutch {
    min-height: 46px;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .kite-day .game-shell {
    max-width: 940px;
    grid-template-columns: 180px minmax(0, 1fr) 270px;
    grid-template-rows: 48px minmax(240px, 1fr);
    gap: 6px;
  }
  .kite-day header {
    grid-column: 1/4;
  }
  .kite-day .mission-card {
    grid-column: 1;
    grid-row: 2;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
  }
  .kite-day .mission-card > div:first-child {
    display: block;
  }
  .kite-day .mission-card p {
    font-size: 12px;
    margin: 8px 0;
  }
  .kite-day #stage {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    width: auto;
  }
  .kite-day .machine-board {
    grid-column: 3;
    grid-row: 2;
    width: auto;
    align-content: center;
  }
  .kite-day #controls {
    grid-template-columns: 1fr;
  }
  .clutch {
    min-height: 44px;
  }
  .board-actions {
    flex-wrap: wrap;
  }
  .kite-day #test-wind {
    order: -1;
    flex-basis: 100%;
    max-width: none;
  }
}
