:root {
  --sky-top: #8fd6ff;
  --sky-mid: #bdeaff;
  --sky-low: #eaf7ff;
  --grass: #7ec850;
  --ink: #20305a;
  --ink-soft: #4a5a82;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-stroke: rgba(255, 255, 255, 0.9);
  --gold-1: #ffd35a;
  --gold-2: #ffae28;
  --orange: #ff8a1f;
  --shadow: 0 18px 50px -18px rgba(24, 40, 80, 0.55);
  --frame-navy-1: #243463;
  --frame-navy-2: #16203f;
}

@font-face {
  font-family: "Liberation Sans";
  src: url("./fonts/LiberationSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", ui-rounded, system-ui,
    -apple-system, "Helvetica Neue", sans-serif;
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    var(--sky-mid) 38%,
    var(--sky-low) 70%,
    #f3fbef 100%
  );
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sun {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 240, 190, 0.9) 0%,
    rgba(255, 224, 150, 0.35) 45%,
    transparent 70%
  );
  filter: blur(4px);
}
.cloud {
  position: absolute;
  background: #fff;
  border-radius: 100px;
  opacity: 0.85;
  filter: blur(0.3px);
  box-shadow: 0 18px 40px -22px rgba(60, 90, 140, 0.5);
  animation: drift linear infinite;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before {
  width: 55%;
  height: 150%;
  top: -55%;
  left: 12%;
}
.cloud::after {
  width: 40%;
  height: 130%;
  top: -40%;
  right: 14%;
}
.cloud.c1 {
  width: 160px;
  height: 46px;
  top: 12%;
  animation-duration: 70s;
}
.cloud.c2 {
  width: 110px;
  height: 34px;
  top: 26%;
  opacity: 0.7;
  animation-duration: 95s;
  animation-delay: -30s;
}
.cloud.c3 {
  width: 220px;
  height: 60px;
  top: 6%;
  opacity: 0.65;
  animation-duration: 120s;
  animation-delay: -60s;
}
@keyframes drift {
  from {
    transform: translateX(-280px);
  }
  to {
    transform: translateX(110vw);
  }
}
.ground {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 90px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, var(--grass), #5fae3c);
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.25),
    inset 0 14px 24px -10px rgba(0, 0, 0, 0.15);
}
.ground::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 14px;
  background: radial-gradient(
      10px 12px at 16px 12px,
      #6fbd45 60%,
      transparent 62%
    )
    repeat-x;
  background-size: 34px 14px;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 6vh, 72px) 20px 130px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.window-frame {
  width: 824px;
  max-width: calc(100vw - 28px);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--frame-navy-1), var(--frame-navy-2));
  padding: 12px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 46px -6px rgba(255, 174, 40, 0.45);
  animation: glow 5s ease-in-out infinite;
}
@keyframes glow {
  50% {
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06) inset,
      0 0 62px -2px rgba(255, 174, 40, 0.62);
  }
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  color: #cdd7f2;
}
.dots {
  display: flex;
  gap: 7px;
}
.dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.dots i:nth-child(1) {
  background: #ff5f57;
}
.dots i:nth-child(2) {
  background: #febc2e;
}
.dots i:nth-child(3) {
  background: #28c840;
}
.titlebar .tb-title {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.4px;
  opacity: 0.92;
}
.titlebar .tb-meta {
  margin-left: auto;
}
.viewport-select {
  min-width: 104px;
  height: 26px;
  padding: 0 26px 0 10px;
  color: #dce7ff;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #dce7ff 50%),
    linear-gradient(135deg, #dce7ff 50%, transparent 50%);
  background-position: calc(100% - 14px) 10px, calc(100% - 9px) 10px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.viewport-select:focus-visible {
  outline: 2px solid rgba(112, 166, 255, 0.85);
  outline-offset: 2px;
}

.canvas-wrap {
  position: relative;
  width: 800px;
  height: 600px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #05070f;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 60px -10px rgba(0, 0, 0, 0.8);
}
#halcyon-canvas {
  display: block;
  width: 800px;
  height: 600px;
  background: #05070f;

  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#halcyon-canvas:focus {
  outline: none;
}

.fs-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 30;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: #eaf1ff;
  background: rgba(8, 14, 30, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  cursor: pointer;
  opacity: 0.4;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  touch-action: manipulation;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.fs-btn:hover,
.fs-btn:focus-visible {
  opacity: 1;
  background: rgba(8, 14, 30, 0.72);
  outline: none;
}
body.fs {
  overflow: hidden;
}
body.fs .sky,
body.fs .ground,
body.fs .titlebar,
body.fs .modes,
body.fs .about,
body.fs .controls,
body.fs footer {
  display: none;
}
body.fs .shell {
  min-height: 0;
  padding: 0;
}
body.fs .window-frame {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  animation: none;
}
body.fs .canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border-radius: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
body.fs #halcyon-canvas {
  width: min(100vw, 133.333vh);
  height: min(75vw, 100vh);
  width: min(100vw, 133.333dvh);
  height: min(75vw, 100dvh);
}
body.fs.halcyon-game #halcyon-canvas {

  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
}
body.halcyon-game.vp-fixed:not(.fs) .window-frame {
  width: calc(var(--game-pane-width, 800px) + 24px);
}
body.halcyon-game.vp-fixed:not(.fs) .canvas-wrap {
  width: var(--game-pane-width, 800px);
  height: var(--game-pane-height, 600px);
  max-width: none;
}
body.halcyon-game.vp-fixed:not(.fs) #halcyon-canvas,
body.fs.halcyon-game.vp-fixed #halcyon-canvas {
  width: var(--game-pane-width, 100dvw);
  height: var(--game-pane-height, 100dvh);
}
.orientation-gate {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: #f4f7ff;
  background: rgba(5, 7, 15, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.orientation-gate strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}
.orientation-gate span {
  display: block;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.82;
}
@media (orientation: portrait) and (pointer: coarse) {
  body.fs.halcyon-game .orientation-gate {
    display: flex;
  }
  body.fs.halcyon-game #halcyon-canvas {
    filter: brightness(0.35);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  color: #eaf1ff;
  background: radial-gradient(
    120% 100% at 50% 18%,
    #1b2b55 0%,
    #0a1124 60%,
    #05070f 100%
  );
  transition: opacity 0.5s ease;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.mush {
  font-size: 56px;
  animation: bob 1.3s ease-in-out infinite;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.4));
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-12px) rotate(4deg);
  }
}
.overlay .ld-title {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.4px;
}
.overlay .ld-sub {
  font-size: 13px;
  opacity: 0.7;
  max-width: 420px;
  line-height: 1.5;
}
.bar {
  width: 200px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-1), var(--orange));
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(360%);
  }
}
.overlay.error .mush {
  animation: none;
}
.overlay.error .ld-title {
  color: #ffb3b0;
}
.overlay code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.server-picker {
  width: min(360px, calc(100% - 40px));
  display: grid;
  gap: 14px;
}
.server-picker form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.server-picker input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(32, 48, 90, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  outline: none;
}
.server-picker input:focus {
  border-color: rgba(255, 174, 40, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 211, 90, 0.25);
}
.recent-servers {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.recent-servers.visible {
  display: flex;
}
.server-recent-item {
  display: inline-flex;
  align-items: center;
  max-width: 150px;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff5cf;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.06)),
    rgba(12, 22, 48, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 22px -18px rgba(0, 0, 0, 0.7);
  font-weight: 700;
}
.server-recent-item:focus-within,
.server-recent-item:hover {
  border-color: rgba(255, 211, 90, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 211, 90, 0.24), rgba(255, 174, 40, 0.1)),
    rgba(12, 22, 48, 0.64);
}
.server-picker .server-recent-open,
.server-picker .server-recent-remove {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
}
.server-picker .server-recent-open {
  min-width: 0;
  padding: 7px 4px 7px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-picker .server-recent-remove {
  width: 28px;
  padding: 0 10px 0 4px;
  color: rgba(255, 245, 207, 0.72);
  font-size: 17px;
  line-height: 1;
}
.server-picker .server-recent-open:focus,
.server-picker .server-recent-remove:focus {
  outline: none;
}
.server-picker .server-recent-remove:hover,
.server-picker .server-recent-remove:focus {
  color: #fff5cf;
}
.server-picker button {
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #2b2108;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 18px -12px rgba(63, 42, 0, 0.8);
}
.server-picker button:disabled {
  opacity: 0.58;
  cursor: default;
}
.server-picker .hint {
  color: rgba(234, 241, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.modes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  padding: 11px 18px;
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px -12px rgba(24, 40, 80, 0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.mode:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -12px rgba(24, 40, 80, 0.7);
}
.mode.primary {
  color: #5a2d00;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border-color: rgba(255, 255, 255, 0.6);
}
.mode .k {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.65;
}

.controls {
  margin-top: 30px;
  width: 100%;
  max-width: 824px;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.controls h2 {
  margin: 0 0 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--ink-soft);
}
.keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 18px;
}
.keyrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
kbd {
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  min-width: 26px;
  text-align: center;
  padding: 5px 8px;
  color: var(--ink);
  background: #fff;
  border-radius: 8px;
  border: 1px solid #c9d4ea;
  box-shadow: 0 2px 0 #b7c4df, 0 3px 5px -2px rgba(24, 40, 80, 0.4);
}
.keyrow .grp {
  display: inline-flex;
  gap: 4px;
}

.about {
  margin-top: 26px;
  width: 100%;
  max-width: 824px;
  text-align: center;
}
.about .lede {
  margin: 0 auto 16px;
  max-width: 690px;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink);
}
.about .lede strong {
  color: var(--frame-navy-1);
}
.feature-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  justify-content: center;
}
.feature-chips li {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  padding: 7px 13px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 16px -12px rgba(24, 40, 80, 0.55);
}

.controls-lead {
  margin: -2px 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.controls-lead b {
  color: var(--ink);
}
.controls-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.controls-note b {
  color: var(--ink);
}

footer {
  margin-top: 34px;
  width: 100%;
  max-width: 824px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
footer .tagline {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
@media (max-width: 520px) {
  .hero h1 {
    -webkit-text-stroke-width: 2px;
  }
  .server-picker form {
    grid-template-columns: 1fr;
  }
  .server-picker button {
    min-height: 44px;
  }
}

.transition {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  color: #eaf1ff;
  background: radial-gradient(
    120% 100% at 50% 18%,
    #1b2b55 0%,
    #0a1124 60%,
    #05070f 100%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}
.transition.show {
  opacity: 1;
}
.transition[hidden] {
  display: none;
}
.transition .mush {
  font-size: 46px;
}
.transition-label {
  display: inline-flex;
  align-items: baseline;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: rgba(234, 241, 255, 0.85);
}
.transition-label .ell {
  display: inline-flex;
}
.transition-label .ell i {
  font-style: normal;
  opacity: 0;
  animation: ell 1.4s infinite;
}
.transition-label .ell i:nth-child(2) {
  animation-delay: 0.2s;
}
.transition-label .ell i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ell {
  0%,
  80%,
  100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}
.transition-media {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}
@media (prefers-reduced-motion: reduce) {
  .transition-label .ell i {
    animation: none;
    opacity: 1;
  }
}
