/* Page chrome for the game canvas. The canvas is the artifact: sky field,
 * one slim header, and a white-brick frame that stays quiet around it. */
@font-face {
  font-family: Jua;
  src: url("./assets/chrome.woff") format("woff");
  font-display: swap;
}
:root {
  --sky: #70b9ff;
  --navy: #1d3f8f;
  --navy-deep: #173478;
  --brick: #f4f8ff;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
html {
  height: 100%;
}
body {
  min-height: 100dvh;
  display: flex;
  background: linear-gradient(180deg, #5eaafc 0%, #79bcff 55%, #a8d7ff 100%) fixed;
  color: var(--navy);
  font-family: Jua, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  font-synthesis: none;
  line-height: 1.4;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  touch-action: manipulation;
  position: relative;
}
/* Two slow clouds drifting across the sky — the same white puffs the game
 * menu backdrop floats on. Decorative only: aria-hidden DOM is not needed
 * because these are pseudo-elements with pointer-events none. */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 130px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow:
    28px -16px 0 10px rgba(255, 255, 255, 0.75),
    -34px -10px 0 6px rgba(255, 255, 255, 0.75);
  pointer-events: none;
  z-index: 0;
}
body::before {
  top: 12%;
  left: -160px;
  animation: drift 130s linear infinite;
}
body::after {
  top: 34%;
  left: -220px;
  transform: scale(0.7);
  animation: drift 190s linear infinite;
  animation-delay: -60s;
  opacity: 0.7;
}
@keyframes drift {
  to {
    transform: translateX(130vw);
  }
}
body::after {
  animation-name: drift-small;
}
@keyframes drift-small {
  from {
    transform: scale(0.7) translateX(0);
  }
  to {
    transform: scale(0.7) translateX(150vw);
  }
}
::selection {
  background: var(--navy);
  color: #fff;
}
main {
  width: min(100%, 688px);
  margin: auto;
  position: relative;
  z-index: 1;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 8px;
}
.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-width: 0;
}
#round {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin: 0;
  padding: 3px 12px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--brick);
  color: var(--navy);
  font-size: 13px;
}
#round strong {
  font-size: 17px;
}
.utilities {
  display: flex;
  gap: 6px;
}
h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow:
    -2px -1px 0 var(--navy),
    2px -1px 0 var(--navy),
    -2px 1px 0 var(--navy),
    2px 1px 0 var(--navy),
    0 -2px 0 var(--navy),
    0 2px 0 var(--navy),
    -2px 0 0 var(--navy),
    2px 0 0 var(--navy);
}
button {
  font: inherit;
  font-size: 15px;
  color: var(--navy);
  background: var(--brick);
  border: 2px solid var(--navy);
  border-radius: 8px;
  min-height: 36px;
  padding: 4px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--navy);
}
button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--navy);
}
:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
#stage {
  position: relative;
  /* The frame mats the canvas in the game's white-brick road texture. */
  background-color: #f2f7fd;
  background-image:
    linear-gradient(335deg, #e0eaf5 23px, transparent 23px), linear-gradient(155deg, #e0eaf5 23px, transparent 23px),
    linear-gradient(335deg, #e0eaf5 23px, transparent 23px), linear-gradient(155deg, #e0eaf5 23px, transparent 23px);
  background-size: 58px 58px;
  background-position:
    0 2px,
    4px 35px,
    29px 31px,
    34px 6px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 5px 0 rgba(23, 52, 120, 0.4);
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  touch-action: none;
}
canvas:focus-visible {
  outline: 3px solid #205eb6;
  outline-offset: -3px;
}
#loading,
#error {
  position: absolute;
  margin: 0;
}
#loading {
  inset: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 17px;
  color: var(--navy);
}
.bloon {
  display: block;
  width: 24px;
  height: auto;
  animation: bob 1.1s ease-in-out infinite alternate;
}
@keyframes bob {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-6px);
  }
}
#error {
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}
#records {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  padding: 12px 18px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 5px 0 rgba(23, 52, 120, 0.4);
}
#records h2 {
  margin: 0 4px 0 0;
  font-size: 17px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}
#records .cells {
  display: flex;
  flex: 1;
  gap: 4px 18px;
  flex-wrap: wrap;
}
.record {
  display: flex;
  flex-direction: column;
  min-width: 128px;
}
.record .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.record .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.record .dot.earned[data-medal="bronze"] {
  background: #d9925f;
  border-color: #b97a4b;
}
.record .dot.earned[data-medal="silver"] {
  background: #c3cdd6;
  border-color: #9fadb8;
}
.record .dot.earned[data-medal="gold"] {
  background: #f4c542;
  border-color: #d9a925;
}
.record .value {
  font-size: 17px;
}
.cell-share {
  margin-top: auto;
  min-height: 24px;
  padding: 1px 8px;
  font-size: 12px;
  border-width: 2px;
  border-radius: 6px;
  box-shadow: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.5);
}
.cell-share:hover {
  color: #fff;
  border-color: #fff;
}
#share-status {
  flex-basis: 100%;
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
#share-status:empty {
  display: none;
}
/* Bottom info strip: one quiet guide link under a hairline. */
#guide {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(29, 63, 143, 0.25);
  text-align: center;
}
#guide a {
  display: inline-block;
  padding: 2px 8px;
  color: var(--navy);
  font-size: 13px;
  text-decoration: none;
}
#guide a:hover {
  text-decoration: underline;
}
#shared-view {
  position: absolute;
  inset: 10px;
  z-index: 4;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(112, 185, 255, 0.85);
}
#shared-view:not([hidden]) {
  display: flex;
}
.shared-card {
  width: min(86%, 320px);
  padding: 22px 24px 20px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  background: var(--brick);
  box-shadow: 0 5px 0 rgba(23, 52, 120, 0.4);
  text-align: center;
  color: var(--navy);
}
.shared-mode {
  margin: 0;
  font-size: 15px;
}
.shared-mode::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border: 2px solid rgba(23, 52, 120, 0.55);
  border-radius: 50%;
  vertical-align: -1px;
}
.shared-mode[data-mode="easy"]::before {
  background: #d9925f;
  border-color: #b97a4b;
}
.shared-mode[data-mode="medium"]::before {
  background: #c3cdd6;
  border-color: #9fadb8;
}
.shared-mode[data-mode="hard"]::before {
  background: #f4c542;
  border-color: #d9a925;
}
.shared-round {
  margin: 8px 0 0;
  font-size: 30px;
}
.shared-lives {
  margin: 2px 0 0;
  font-size: 14px;
}
.shared-invite {
  margin: 10px 0 0;
  font-size: 13px;
}
#shared-play {
  width: 100%;
  min-height: 44px;
  margin: 14px 0 0;
  padding: 6px 16px;
  font-size: 17px;
  color: #fff;
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 8px;
  box-shadow: 0 3px 0 rgba(23, 52, 120, 0.4);
}
#shared-play:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(23, 52, 120, 0.4);
}
noscript {
  display: block;
  width: min(100%, 688px);
  margin: 16px auto 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 15px;
}
#stage:fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--sky);
  box-shadow: none;
}
#stage:fullscreen canvas {
  width: min(100%, calc(100dvh * 4 / 3));
}
@media (pointer: coarse) {
  button {
    min-height: 44px;
  }
}
@media (max-width: 480px) {
  /* Narrow screens: the three records form one compact column row instead of
   * wrapping into a tall stack of full-width buttons. */
  #records {
    padding: 10px 12px;
    gap: 4px 10px;
  }
  #round {
    padding: 2px 10px;
    font-size: 12px;
  }
  #round strong {
    font-size: 15px;
  }
  .utilities button {
    white-space: nowrap;
  }
  .shared-card {
    padding: 16px 14px 14px;
  }
  .shared-round {
    font-size: 24px;
  }
  #records h2 {
    flex-basis: 100%;
    margin: 0;
  }
  #records .cells {
    gap: 4px 8px;
  }
  .record {
    flex: 1;
    min-width: 0;
  }
  .record .value {
    min-height: 1.35em;
    font-size: 12px;
  }
  .cell-share {
    width: 100%;
    min-height: 32px;
    padding: 1px 6px;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  main {
    width: min(100%, calc((100dvh - 92px) * 4 / 3));
  }
  header {
    margin-bottom: 4px;
  }
  h1 {
    font-size: 18px;
  }
  button {
    min-height: 32px;
    padding: 2px 10px;
    box-shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bloon {
    animation: none;
  }
  body::before,
  body::after {
    animation: none;
  }
  body::before {
    left: 70%;
  }
  body::after {
    left: 30%;
  }
}
