main {
  --w: min(40vw, calc((100svh - 155px) * 0.672), 490px);
  grid-template-areas: '. hud .' 'head tank chain' '. actions .';
  gap: 10px clamp(20px, 4vw, 72px);
}
h1 em {
  display: block;
  margin: -14px 0 0 20%;
  font: bold italic 34px/1 system-ui;
  text-transform: uppercase;
  letter-spacing: -2px;
  color: #ffda56;
  paint-order: stroke;
  -webkit-text-stroke: 7px #062843;
  text-shadow: 0 5px #062843;
  transform: rotate(2deg);
}
.hud {
  grid-area: hud;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  text-shadow: 0 2px #034069;
}
#crowns {
  display: flex;
  align-items: center;
  gap: 3px;
}
#crowns canvas {
  width: 27px;
}
#tank {
  background: linear-gradient(155deg, #0a859cd9, #08517ee8 55%, #052c59f5);
}
#game {
  border-radius: inherit;
}
.actions {
  grid-area: actions;
  text-align: center;
}
#turn,
.daily,
#log {
  padding: 10px 18px;
  font-size: 15px;
}
#turn {
  width: 100%;
  height: 44px;
  margin: 4px 0 8px;
}
#turn.live,
dialog .primary {
  background: #ffdb58;
  color: #062843;
  border-color: #fff0aa;
}
#turn.aiming {
  background: #7efce0;
  color: #062843;
}
#turn.spent {
  color: #afc8da;
}
#tip {
  font-size: 14px;
  line-height: 18px;
  min-height: 18px;
  text-shadow: 0 1px 3px #001c39;
}
.daily {
  margin-top: 23px;
}
aside {
  width: 175px;
  text-align: center;
}
.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#face {
  width: 94px;
}
.identity h2,
.guide h2 {
  font-size: 12px;
  margin: 0 0 5px;
}
#species {
  font-size: 28px;
  text-shadow: 0 2px #042b49;
}
#growth {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 7px;
}
#growth i {
  width: 26px;
  height: 8px;
  background: #053452;
  border: 1px solid #7cdbf3;
  border-radius: 10px;
}
#growth i.on {
  background: #ffe26b;
  border-color: white;
}
.guide {
  margin: 30px 0 20px;
}
.guide p {
  font-size: 14px;
  line-height: 1.5;
  color: #d8faff;
}
#food canvas {
  width: 39px;
}
dialog {
  width: min(390px, 94vw);
  max-height: 93svh;
  padding: 23px;
}
dialog h2 {
  margin-bottom: 8px;
}
dialog button {
  margin-top: 10px;
}
dialog button.choice {
  display: flex;
  text-align: left;
  align-items: center;
  gap: 14px;
  border-radius: 16px;
  padding: 14px;
}
.choice b {
  font-size: 26px;
  color: #ffdc6c;
  min-width: 32px;
  text-align: center;
}
.choice:hover {
  border-color: #ffdc6c;
}
.choice small {
  display: block;
  line-height: 1.35;
  font-weight: 600;
  margin-top: 4px;
}
#copy p {
  margin: 10px 0;
}
#copy .record {
  font-size: 32px;
  color: #ffdc6c;
}
#copy .entry {
  display: flex;
  justify-content: space-between;
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid #ffffff25;
}
#copy .entry b {
  color: #ffdc6c;
}
#copy input {
  width: 100%;
}
@media (max-width: 850px), (max-aspect-ratio: 11/10) {
  main {
    --w: min(
      calc(100vw - 18px),
      calc((100svh - 195px - env(safe-area-inset-bottom)) * 0.672),
      490px
    );
    grid-template-columns: max(242px, var(--w));
    grid-template-areas: 'head' 'hud' 'tank' 'actions';
    gap: 7px;
  }
  h1 em {
    font-size: clamp(12px, 3vw, 17px);
    margin-top: -4px;
    letter-spacing: 0;
    -webkit-text-stroke: 3px #062843;
    text-shadow: 0 2px #062843;
  }
  header .daily,
  aside {
    display: none;
  }
  .hud {
    font-size: 14px;
  }
  #crowns canvas {
    width: 22px;
  }
  #tip {
    font-size: 12px;
  }
  #turn {
    height: 40px;
    padding: 4px;
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  main {
    --w: min(40vw, calc((100svh - 22px) * 0.672));
    grid-template-columns: 125px var(--w) 144px;
    grid-template-areas: 'head tank hud' 'head tank chain' 'head tank actions';
    grid-template-rows: auto 1fr auto;
    gap: 5px 14px;
  }
  header .daily,
  .guide,
  #log {
    display: none;
  }
  aside {
    display: block;
    width: auto;
  }
  .identity h2 {
    display: block;
  }
  #face {
    width: 52px;
  }
  #species {
    font-size: 18px;
  }
  .hud {
    flex-wrap: wrap;
    font-size: 13px;
    justify-content: space-around;
  }
  #crowns {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }
  #crowns canvas {
    width: 21px;
  }
  #turn {
    height: auto;
    padding: 7px;
    font-size: 13px;
  }
  #tip {
    font-size: 12px;
  }
  h1 em {
    font-size: 17px;
    margin-top: -7px;
    -webkit-text-stroke: 4px #062843;
  }
}
#scrub:not([hidden]) {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
}
#scrub button {
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
#bend {
  background: #86ffdb;
  color: #05354c;
}
#timeline {
  position: relative;
  min-width: 0;
  flex: 1;
}
#timeline i {
  position: absolute;
  pointer-events: none;
  top: 1px;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #ffdb58;
}
#scrub input {
  width: 100%;
  margin: 0;
  display: block;
  height: 38px;
  accent-color: #8affe1;
  touch-action: none;
}
@media (max-height: 560px) and (orientation: landscape) {
  #scrub:not([hidden]) {
    height: auto;
    flex-wrap: wrap;
    justify-content: center;
  }
  #timeline {
    order: -1;
    flex-basis: 100%;
  }
  #scrub button {
    padding: 0 9px;
  }
}
@media (max-width: 850px), (max-aspect-ratio: 11/10) {
  header {
    min-width: 0;
    gap: 5px;
  }
  .stats {
    flex: 1;
    min-width: 0;
    justify-content: space-evenly;
    gap: 4px;
  }
  .stats strong,
  #best {
    font-size: clamp(13px, 4vw, 18px);
    letter-spacing: -0.6px;
    overflow-wrap: anywhere;
  }
}
@media (max-width: 355px) and (orientation: portrait),
  (max-height: 610px) and (orientation: portrait) {
  .stats > div + div {
    display: none;
  }
  h1 {
    width: 25%;
  }
  h1 em {
    font-size: 10px;
  }
}
dialog .trail {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  border-radius: 14px;
  padding: 8px 12px;
  margin: 6px 0;
}
.trail i {
  width: 18px;
  height: 18px;
  border-radius: 100%;
  box-shadow: 0 0 12px #ffffff70;
}
.trail small {
  display: block;
}
.trail:disabled {
  opacity: 0.64;
  cursor: default;
}
.prize {
  color: #ffe178;
  font-weight: 800;
}
dialog:has(.trail) #buttons {
  position: sticky;
  bottom: 0;
}
.hud small {
  display: block;
  font-size: 12px;
  color: #d7faff;
}
.goal {
  text-align: center;
}
#crowns {
  justify-content: center;
}
.supply {
  text-align: right;
}
#mobileMode,
.hud #growTip {
  display: none;
}
@media (max-width: 850px), (max-aspect-ratio: 11/10) {
  .hud #growTip {
    display: block;
  }
  #mobileMode {
    display: block;
    padding: 4px 10px;
    margin-top: 2px;
    font-size: 12px;
  }
  .hud small {
    font-size: 11px;
  }
  main {
    --w: min(
      calc(100vw - 18px),
      calc((100svh - 211px - env(safe-area-inset-bottom)) * 0.672),
      490px
    );
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  main {
    --w: min(40vw, calc((100svh - 22px) * 0.672));
  }
  .goal {
    order: 3;
    flex-basis: 100%;
  }
  #mobileMode,
  .hud #growTip {
    display: none;
  }
}
