/* Keep It In: the game's 16-bit castle (moonlit navy flagstones, stone, forged gold, mint, sky blue)
   around the shared editorial header and footer. Every colour is from the game's Art.kt ramps.
   Hard pixel edges and hard offset shadows only: no glows, no blur, no rounded corners. */
.kii {
  --k:#07050f;
  --f0:#060a1c;
  --f1:#0c1230;
  --f2:#141c40;
  --s0:#1b2346;
  --s1:#2e3a66;
  --s2:#465680;
  --s3:#6578a0;
  --gold0:#8c3414;
  --gold1:#d8701c;
  --gold2:#ffc22e;
  --gold3:#fff6b4;
  --amber:#e88a1c;
  --mint:#7cf2c0;
  --sky:#9cecff;
  --blue:#44bcf0;
  --deep:#10245e;
  --soft:#d4def0;
  --dim:#8c9cc0;
  --white:#f4ffff;
  --ink:var(--white);
  --ink-dim:var(--soft);
  --ink-mute:var(--dim);
  --rule:var(--s1);
  --accent:var(--gold2);
  /* One art pixel in CSS pixels. Whole numbers only, so the art stays square. */
  --px:3;
  --u:calc(var(--px) * 1px);
  --drop:var(--f2);
  /* A chunky stepped frame: light on the top-left, dark on the bottom-right, corners notched. */
  --frame:0 -4px 0 var(--s2),-4px 0 0 var(--s2),0 4px 0 var(--s0),4px 0 0 var(--s0);
  background:var(--f0);
  color:var(--soft)
}

.kii ::selection {
  background:var(--gold2);
  color:var(--k)
}

.kii :focus-visible {
  outline:4px solid var(--gold3);
  outline-offset:4px
}

.icon-sprite {
  position:absolute;
  width:0;
  height:0;
  overflow:hidden
}

.icon {
  width:32px;
  height:32px;
  flex:none;
  fill:currentColor;
  shape-rendering:crispEdges
}

.kii a {
  text-decoration-thickness:2px
}

.wrap {
  max-width:1400px;
  margin:auto;
  padding:0 var(--gutter)
}

.kii h2 {
  font:900 clamp(32px,4vw,56px)/1.02 var(--display);
  letter-spacing:-.04em;
  margin:0;
  max-width:16ch;
  text-wrap:balance;
  color:var(--white);
  text-shadow:3px 3px 0 var(--k)
}

.kii h3 {
  font:900 20px/1.25 var(--display);
  letter-spacing:-.03em;
  margin:0 0 6px;
  color:var(--sky)
}

.lead {
  font-size:clamp(17px,1.4vw,20px);
  line-height:1.6;
  color:var(--soft);
  margin:20px 0 0;
  max-width:46ch
}

/* A course of castle brick along the top of each section. */
.hero,.how,.powers,.built,.versions {
  position:relative
}

.how::before,.powers::before,.built::before,.versions::before {
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:24px;
  background:url(/keepitin/wall.png) 0 0/120px 24px repeat-x;
  image-rendering:pixelated
}

/* Dark sections: the night courtyard. Lighter ones: the flagstones. */
.hero,.powers,.versions {
  background:var(--f0);
  color:var(--white)
}

.how,.built {
  background:var(--f2);
  --drop:var(--k)
}

/* Panels: the shared pixel frame with a hard shadow. */
.features li,.facts li,.power-list li,.scoring,.hero-app,.version-list details {
  background:var(--f1);
  box-shadow:var(--frame),10px 10px 0 var(--drop)
}

/* Buttons: forged gold, bevelled, 52px. */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:52px;
  padding:14px 22px;
  font-size:16px;
  font-weight:700;
  text-decoration:none;
  border:0
}

.btn .icon {
  width:16px;
  height:16px
}

.btn-gold,.demo-play {
  background:var(--gold2);
  color:var(--k);
  box-shadow:inset 3px 3px 0 var(--gold3),inset -3px -3px 0 var(--gold1),5px 5px 0 var(--drop)
}

.kii .btn-gold:hover,.demo-play:hover {
  background:var(--gold3);
  color:var(--k)
}

.btn-gold:active,.demo-play:active,.demo-toggle:active {
  transform:translate(4px,4px);
  box-shadow:inset 3px 3px 0 var(--gold1)
}

/* Hero */
.hero {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:clamp(32px,5vw,80px);
  align-items:center;
  padding:clamp(28px,2.8vw,40px) var(--gutter) clamp(64px,8vw,120px);
  overflow:hidden
}

/* The title logo is the game's own sprite (81 by 14 art pixels). Whole-number scales only, set per width below. */
.hero h1 {
  margin:0 0 28px
}

.kii .hero-logo {
  --logo:8;
  display:block;
  width:calc(81px * var(--logo));
  height:calc(14px * var(--logo));
  max-width:none;
  image-rendering:pixelated
}

@media(max-width:1299px) {
  .kii .hero-logo {
    --logo:6
  }
}

@media(max-width:1099px) {
  .kii .hero-logo {
    --logo:5
  }
}

@media(max-width:1000px) {
  .kii .hero-logo {
    --logo:6
  }
}

@media(max-width:599px) {
  .kii .hero-logo {
    --logo:5
  }
}

@media(max-width:449px) {
  .kii .hero-logo {
    --logo:4
  }
}

@media(max-width:363px) {
  .kii .hero-logo {
    --logo:3
  }
}

.hero-lede {
  font-size:clamp(18px,1.6vw,22px);
  line-height:1.55;
  color:var(--soft);
  max-width:34ch;
  margin:0 0 36px
}

.hero-app {
  display:flex;
  align-items:center;
  gap:18px;
  padding:14px;
  max-width:440px;
  margin:0 4px 32px
}

.app-icon {
  width:96px;
  height:96px;
  flex:none;
  outline:4px solid var(--k);
  display:block
}

.app-icon img {
  display:block;
  width:96px;
  height:96px;
  image-rendering:pixelated
}

.app-name {
  margin:0 0 2px;
  font:900 20px/1.2 var(--display);
  letter-spacing:-.03em;
  color:var(--white)
}

.app-soon {
  display:flex;
  align-items:center;
  gap:8px;
  margin:0;
  font-size:15px;
  font-weight:600;
  color:var(--gold2)
}

.app-soon .icon {
  width:16px;
  height:16px
}

.hero-actions {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:28px
}

.hero-spec {
  font:400 12px/1.6 var(--mono);
  color:var(--dim);
  margin:0
}

.hero-watch {
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:calc(var(--u) * 22) calc(var(--u) * 4) 0 0
}

.demo-bar {
  width:min(100%,calc(var(--u) * 148));
  margin-top:calc(var(--u) * 22 + 12px);
  padding-top:12px;
  border-top:4px solid var(--s1);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:8px
}

/* Buttons first, then the caption and the controls line, each on its own row. */
.demo-bar .hero-caption,.play-hint {
  flex:0 0 100%
}

.demo-play {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:8px 16px;
  border:0;
  font:700 14px/1 var(--sans);
  cursor:pointer
}

.demo-play[hidden] {
  display:none
}

/* The controls line keeps its row until you play, so starting a game doesn't move the page. */
.play-hint {
  visibility:hidden
}

.is-playing .play-hint {
  visibility:visible
}

.demo-play .icon,.demo-toggle .icon {
  width:16px;
  height:16px
}

.is-playing .demo-play,.demo-toggle {
  background:var(--s1);
  color:var(--white);
  box-shadow:inset 3px 3px 0 var(--s2),inset -3px -3px 0 var(--s0),5px 5px 0 var(--drop)
}

.is-playing .demo-play:hover,.demo-toggle:hover {
  background:var(--s2);
  color:var(--white)
}

.play-hint {
  margin:0;
  font:400 12px/1.6 var(--mono);
  color:var(--soft)
}

/* Play mode: the screen takes keys, so show when it has them; drags steer instead of scrolling. */
.is-playing .watch-screen {
  touch-action:none;
  cursor:grab
}

.is-playing .watch-screen:focus {
  outline:0
}

/* Keyboard focus lights a stepped ring on the bezel itself, clear of the crown and band. */
.is-playing .watch:has(.watch-screen:focus-visible)::after {
  background:url(/keepitin/watch-focus.png) 0 0/100% 100% no-repeat,url(/keepitin/watch-bezel.png) 0 0/100% 100% no-repeat
}

.hero-caption {
  margin:0;
  min-width:0;
  font:400 12px/1.6 var(--mono);
  color:var(--dim);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  transition:opacity .2s steps(2,end)
}

.hero-caption.is-out {
  opacity:0
}

@media(prefers-reduced-motion:reduce) {
  .hero-caption {
    transition:none
  }

  .btn-gold:active,.demo-play:active,.demo-toggle:active {
    transform:none
  }
}

.demo-toggle {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:8px 14px;
  border:0;
  font:700 13px/1 var(--sans);
  flex:none;
  cursor:pointer
}

.demo-toggle[hidden] {
  display:none
}

.demo-toggle[aria-disabled=true],.demo-toggle[aria-disabled=true]:hover {
  background:var(--s0);
  color:var(--dim);
  box-shadow:none;
  cursor:default
}

.demo-toggle[aria-disabled=true]:active {
  transform:none
}

/* Watch device, sized in art pixels: a 128 px screen in a 10 px bezel, so the watch shares the game's grid. */
.watch {
  position:relative;
  width:calc(var(--u) * 148);
  height:calc(var(--u) * 148);
  padding:calc(var(--u) * 10);
  isolation:isolate
}

/* The bezel sits over the screen and cuts its round, stepped edge. */
.watch::after {
  content:"";
  position:absolute;
  inset:0;
  background:url(/keepitin/watch-bezel.png) 0 0/100% 100% no-repeat;
  image-rendering:pixelated;
  pointer-events:none
}

.kii .watch-screen {
  display:block;
  width:calc(var(--u) * 128);
  height:calc(var(--u) * 128);
  max-width:none;
  background:#000;
  image-rendering:pixelated;
  /* Trims the frame's square corners. The edge of this cut is hidden under the bezel. */
  clip-path:circle(calc(var(--u) * 69))
}

.kii .watch-still {
  position:absolute;
  inset:calc(var(--u) * 10)
}

.watch-band {
  position:absolute;
  left:calc(var(--u) * 36);
  top:calc(var(--u) * -22);
  width:calc(var(--u) * 76);
  height:calc(var(--u) * 192);
  z-index:-1;
  background:url(/keepitin/watch-band.png) 0 0/100% 100% no-repeat;
  image-rendering:pixelated
}

.watch-crown {
  position:absolute;
  right:calc(var(--u) * -4);
  top:calc(var(--u) * 65);
  width:calc(var(--u) * 6);
  height:calc(var(--u) * 18);
  background:var(--s0);
  border:var(--u) solid var(--k);
  overflow:hidden
}

/* Crown ridges; the demo rolls them as the paddle moves. */
.watch-crown i {
  position:absolute;
  left:0;
  right:0;
  top:0;
  bottom:-12px;
  background:repeating-linear-gradient(var(--s3) 0 3px,var(--s0) 3px 6px);
  will-change:transform
}

/* How it plays */
.how {
  padding:clamp(88px,9vw,136px) 0 clamp(64px,8vw,112px)
}

.how-head {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:clamp(24px,5vw,80px);
  align-items:end
}

.how-head .lead {
  margin:0
}

.features {
  list-style:none;
  margin:56px 0 0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:28px
}

.features li {
  padding:22px
}

.tile {
  display:grid;
  place-items:center;
  width:64px;
  height:64px;
  background:var(--f0);
  color:var(--sky);
  outline:4px solid var(--k);
  margin:4px 0 20px 4px
}

.tile .icon {
  width:48px;
  height:48px
}

.features p {
  margin:0;
  font-size:16px;
  line-height:1.55;
  color:var(--soft);
  max-width:34ch
}

.scoring {
  display:flex;
  flex-wrap:wrap;
  gap:8px 0;
  margin:32px 0 0;
  padding:16px 22px;
  font:400 13px/1.6 var(--mono);
  color:var(--dim)
}

.scoring span {
  padding-right:28px;
  margin-right:28px;
  border-right:4px solid var(--s1)
}

.scoring span:last-child {
  border-right:0;
  margin-right:0;
  padding-right:0
}

.scoring b {
  font-weight:700;
  color:var(--gold2);
  margin-left:6px;
  font-variant-numeric:tabular-nums
}

/* Power-ups */
.powers {
  padding:clamp(88px,9vw,136px) 0 clamp(72px,9vw,128px);
  overflow:hidden
}

.split {
  display:grid;
  grid-template-columns:minmax(0,5fr) minmax(0,6fr);
  gap:clamp(40px,7vw,112px);
  align-items:center
}

.shot {
  margin:0;
  padding-top:calc(var(--u) * 22);
  display:flex;
  flex-direction:column;
  align-items:center
}

.shot figcaption {
  margin-top:calc(var(--u) * 22 + 12px);
  font:400 12px/1.6 var(--mono);
  color:var(--dim);
  text-align:center
}

.power-list {
  list-style:none;
  margin:40px 0 0;
  padding:0;
  display:grid;
  gap:28px
}

.power-list li {
  display:grid;
  grid-template-columns:96px minmax(0,1fr);
  gap:24px;
  align-items:center;
  padding:20px
}

/* The game's own sprites, at whole-number scales. */
.power-icon {
  display:block;
  justify-self:center
}

.power-life .power-icon {
  width:81px;
  height:72px
}

.power-grow .power-icon {
  width:91px;
  height:49px
}

.power-slow .power-icon {
  width:81px;
  height:81px
}

.kii .power-slow h3 {
  color:#9cecff
}

.kii .power-life h3 {
  color:var(--mint)
}

.kii .power-grow h3 {
  color:var(--gold2)
}

.power-list p {
  margin:0;
  font-size:16px;
  line-height:1.55;
  color:var(--soft);
  max-width:44ch
}

/* Built for the watch */
.built {
  padding:clamp(88px,9vw,136px) 0 clamp(64px,8vw,112px)
}

.facts {
  list-style:none;
  margin:56px 0 0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:28px
}

.facts li {
  padding:22px
}

.facts strong {
  display:block;
  font:900 clamp(34px,3.6vw,52px)/1 var(--display);
  letter-spacing:-.04em;
  margin-bottom:12px;
  font-variant-numeric:tabular-nums;
  color:var(--gold2);
  text-shadow:3px 3px 0 var(--gold0)
}

.facts span {
  display:block;
  font-size:16px;
  line-height:1.5;
  color:var(--soft)
}

/* Between a phone and the desktop layout a 3x watch would be too wide for its column. */
@media(min-width:1001px) and (max-width:1199px) {
  .shot {
    --px:2;
    --u:calc(var(--px) * 1px)
  }
}

/* The 3x watch needs about 460 px, so below this the copy stacks instead of being squeezed. */
@media(max-width:1299px) {
  .hero {
    grid-template-columns:minmax(0,1fr)
  }

  .hero-watch {
    order:-1
  }
}

@media(max-width:1000px) {
  .how-head,.split {
    grid-template-columns:minmax(0,1fr)
  }

  .features,.facts {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }
}

/* A phone: the art drops to 2x, still square and still crisp. */
@media(max-width:499px) {
  .kii {
    --px:2
  }
}

@media(max-width:499px) {
  .demo-play {
    padding:8px 12px
  }

  .demo-toggle {
    padding:8px 10px
  }
}

@media(max-width:600px) {
  .features {
    grid-template-columns:minmax(0,1fr)
  }

  .hero-actions .btn {
    flex:1 1 100%
  }

  .scoring {
    flex-direction:column
  }

  .scoring span {
    border-right:0;
    padding-right:0;
    margin-right:0
  }

  .power-list li {
    grid-template-columns:72px minmax(0,1fr);
    gap:18px;
    padding:16px
  }

  .power-life .power-icon {
    width:63px;
    height:56px
  }

  .power-grow .power-icon {
    width:65px;
    height:35px
  }

  .power-slow .power-icon {
    width:63px;
    height:63px
  }
}

@media(max-width:380px) {
  .facts {
    grid-template-columns:minmax(0,1fr)
  }
}

/* The 2x watch is 304 px wide with its crown: on the narrowest phones it borrows from the gutter. */
@media(max-width:344px) {
  .hero-watch,.shot {
    margin-inline:-12px
  }
}

/* Version history: dark like the watch, closes the alternation before the footer. */
.versions {
  padding:clamp(88px,9vw,136px) 0 clamp(64px,8vw,112px)
}

.version-list {
  margin-top:48px;
  display:grid;
  gap:20px
}

.version-list details {
  padding:0 20px
}

.version-list summary {
  display:grid;
  grid-template-columns:3.5em minmax(0,1fr) auto 1ch;
  align-items:baseline;
  gap:16px;
  min-height:44px;
  padding:18px 0;
  cursor:pointer;
  list-style:none
}

.version-list summary::-webkit-details-marker {
  display:none
}

.version-list summary::after {
  content:"+";
  font:700 18px/1 var(--mono);
  color:var(--gold2);
  width:1ch
}

.version-list details[open] summary::after {
  content:"\2212"
}

.version-list summary:hover .v-title {
  color:var(--gold2)
}

.v-num {
  font:600 15px/1.3 var(--mono);
  color:var(--gold2);
  font-variant-numeric:tabular-nums
}

.v-title {
  font:900 clamp(18px,1.8vw,22px)/1.25 var(--display);
  letter-spacing:-.03em;
  min-width:0;
  color:var(--white)
}

.v-date {
  font:400 12px/1.6 var(--mono);
  color:var(--dim);
  white-space:nowrap
}

.version-list ul {
  margin:0;
  padding:0 0 22px calc(3.5em + 16px);
  list-style:none;
  max-width:calc(60ch + 3.5em + 16px)
}

.version-list li {
  position:relative;
  padding-left:18px;
  margin:0 0 8px;
  font-size:16px;
  line-height:1.55;
  color:var(--soft)
}

.version-list li::before {
  content:"";
  position:absolute;
  left:0;
  top:.55em;
  width:8px;
  height:8px;
  background:var(--gold2)
}

@media(max-width:600px) {
  .version-list details {
    padding:0 14px
  }

  .version-list summary {
    grid-template-columns:2.4em minmax(0,1fr) auto 1ch;
    gap:8px
  }

  .v-title {
    font-size:16px
  }

  .v-date {
    font-size:11px
  }

  .version-list ul {
    padding-left:0
  }
}
