@import url("https://fonts.googleapis.com/css2?family=Familjen+Grotesk:wght@500;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
  color-scheme: only light;
  --bg-0: #020202;
  --bg-1: #0c0c0c;
  --bg-2: #121212;
  --fg: #f2f2f2;
  --muted: #c7c7c7;
  --shadow: rgba(0, 0, 0, 0.55);
  --game-bg: #efefe9;
  --game-card: #fafaf6;
  --game-border: #d4d4cd;
  --game-ink: #171717;
  --game-correct: #33a864;
  --game-present: #f0b133;
  --game-absent: #3f3f3f;
  --key-bg: #e2e2db;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Familjen Grotesk", "Arial Black", sans-serif;
  background: radial-gradient(80% 90% at 50% 35%, var(--bg-2) 0%, var(--bg-1) 40%, var(--bg-0) 100%);
  color: var(--fg);
  letter-spacing: 0.01em;
}

.scene {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7vh 6vw;
  overflow: hidden;
}

.scene[hidden] {
  display: none;
}

.scene.intro {
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(24px, 4vh, 40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scene.intermission {
  align-items: center;
  justify-content: center;
}

.scene.intermission .text-wrap {
  text-align: center;
}

.scene.outro {
  flex-direction: column;
  gap: clamp(22px, 4vh, 36px);
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
}

.scene.outro .text-wrap {
  width: min(820px, 92vw);
}

.scene.warp .text-wrap {
  width: min(820px, 92vw);
}

.scene.warp {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
  background: #000000;
}

.warp-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 0;
}

.scene.final {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
  background: #000000;
}

.scene.final .text-wrap {
  width: min(820px, 92vw);
}

.scene.mk {
  padding: 0;
  background: #000000;
}

.mk-frame {
  border: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #000000;
}

.scene.mk-info {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
  background: #000000;
}

.scene.mk-info .text-wrap {
  width: min(860px, 92vw);
}

.scene.post-mk {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
  background: #000000;
}

.scene.post-mk .text-wrap {
  width: min(820px, 92vw);
}

.scene.win {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 10vh;
  background: #ffffff;
  color: #0b0b0b;
}

.scene.win .text-wrap {
  width: min(820px, 92vw);
}

.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.scene.win .text-wrap,
.scene.win .win-choices,
.scene.win .start-btn {
  position: relative;
  z-index: 1;
}

.win-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 16px 24px;
  margin-top: clamp(18px, 4vh, 30px);
}

.win-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1rem;
}

.win-choice input {
  width: 22px;
  height: 22px;
  accent-color: #000000;
}

.choice-row {
  display: flex;
  gap: 18px;
  margin-top: clamp(18px, 4vh, 30px);
}

.choice-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #dcdcdc 100%);
  color: #0b0b0b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.choice-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

.choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.scene.win .start-btn {
  background: linear-gradient(135deg, #0b0b0b 0%, #2a2a2a 100%);
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.lock-image {
  width: min(240px, 60vw);
  margin-top: clamp(18px, 4vh, 32px);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}

.warp-canvas.fade-out {
  opacity: 0;
  transition: opacity 1.8s ease;
}

#warp-text.fade-out {
  opacity: 0;
  transition: opacity 2.2s ease;
}

#warp-text.pre-warp.wobble-1 {
  animation: warp-shake-1 0.16s steps(2, end) infinite;
}

#warp-text.pre-warp.wobble-2 {
  animation: warp-shake-2 0.12s steps(2, end) infinite;
}

#warp-text.pre-warp.wobble-3 {
  animation: warp-shake-3 0.08s steps(2, end) infinite;
}

#warp-text.pre-warp.wobble-2 .line {
  filter: blur(0.4px);
}

#warp-text.pre-warp.wobble-3 .line {
  filter: blur(0.9px);
  text-shadow: 0 18px 40px rgba(120, 200, 255, 0.45);
}

#warp-text.warping {
  animation: warp-shake-warp 0.2s steps(2, end) infinite;
}

#warp-text.warping .line {
  animation: warp-flicker 0.6s steps(2, end) infinite;
}

.warp-alert {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.6rem, 3vw + 1rem, 3rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    0 0 30px rgba(120, 200, 255, 0.35);
  opacity: 0;
  z-index: 2;
  transition: opacity 0.6s ease;
  pointer-events: none;
  text-align: center;
}

.warp-alert.visible {
  opacity: 1;
}

.outro-start {
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #dcdcdc 100%);
  color: #0b0b0b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.outro-start.visible {
  opacity: 1;
  transform: translateY(0);
}

.outro-start[hidden] {
  display: none;
}

.scene.intro.fade-out {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.text-wrap {
  width: min(900px, 92vw);
  text-align: left;
  z-index: 1;
}

.line {
  margin: 0 0 clamp(14px, 2.2vh, 22px);
  font-size: clamp(1.35rem, 2.2vw + 1rem, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  text-shadow: 0 12px 30px var(--shadow);
}

.line.visible {
  animation: line-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.line.instant {
  opacity: 1;
  transform: none;
  filter: none;
  animation: none;
}

.spacer {
  height: clamp(18px, 3vh, 30px);
}

.start-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #dcdcdc 100%);
  color: #0b0b0b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.start-btn.visible {
  opacity: 1;
  transform: translateY(0);
  animation: button-in 0.9s ease forwards;
  pointer-events: auto;
}

.start-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

.start-btn:disabled {
  cursor: default;
}

.grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.35;
}

.game {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
}

.game[hidden] {
  display: none;
}

.game-card {
  width: min(840px, 96vw);
  background: var(--game-card);
  color: var(--game-ink);
  border-radius: clamp(18px, 3vw, 26px);
  padding: clamp(24px, 5vw, 36px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vh, 24px);
}

.game-header {
  text-align: center;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw + 1rem, 2.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-header p {
  margin: 8px 0 0;
  color: #5f5f5f;
  font-size: 1rem;
}

.board {
  display: grid;
  gap: clamp(10px, 2vh, 16px);
  justify-items: center;
  --cols: 5;
  --cell-size: clamp(46px, 9vw, 64px);
  --cell-gap: clamp(8px, 1.6vw, 12px);
  overflow-x: auto;
  padding-bottom: 6px;
}

.row {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--cell-gap);
  width: max-content;
}

.cell {
  width: var(--cell-size);
  aspect-ratio: 1 / 1;
  border-radius: clamp(8px, 2vw, 12px);
  border: 2px solid var(--game-border);
  background: #ffffff;
  color: var(--game-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  font-weight: 800;
  text-transform: uppercase;
}

.board.long {
  --cell-size: clamp(32px, 5.6vw, 46px);
  --cell-gap: clamp(6px, 1.2vw, 10px);
}

.board.xl {
  --cell-size: clamp(26px, 4.6vw, 40px);
  --cell-gap: clamp(5px, 1vw, 8px);
}

.board.xl .cell {
  font-size: clamp(1rem, 2.2vw, 1.6rem);
}

.cell.filled {
  border-color: #8f8f88;
  animation: pop 0.12s ease;
}

.cell.correct {
  background: var(--game-correct);
  border-color: var(--game-correct);
  color: #ffffff;
}

.cell.present {
  background: var(--game-present);
  border-color: var(--game-present);
  color: #ffffff;
}

.cell.absent {
  background: var(--game-absent);
  border-color: var(--game-absent);
  color: #ffffff;
}

.cell.reveal {
  animation: flip 0.6s ease;
}

.keyboard {
  display: grid;
  gap: clamp(8px, 2vh, 12px);
}

.key-row {
  display: flex;
  gap: clamp(6px, 1.6vw, 10px);
  justify-content: center;
}

.key {
  border: none;
  border-radius: 10px;
  background: var(--key-bg);
  color: #1d1d1d;
  font-weight: 700;
  padding: 12px 10px;
  min-width: clamp(28px, 6vw, 42px);
  text-transform: uppercase;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, color 0.2s ease;
}

.key.large {
  min-width: clamp(54px, 11vw, 78px);
  padding: 12px 14px;
}

.key:active {
  transform: translateY(1px);
}

.key.correct {
  background: var(--game-correct);
  color: #ffffff;
}

.key.present {
  background: var(--game-present);
  color: #ffffff;
}

.key.absent {
  background: var(--game-absent);
  color: #ffffff;
}

.message {
  min-height: 1.4em;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.captcha {
  width: min(380px, 92vw);
}

.captcha[hidden] {
  display: none;
}

.fkrc-container {
  font-family: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
  position: relative;
}

.fkrc-m-p {
  margin: 0;
  padding: 0;
}

.fkrc-block {
  display: block;
}

.fkrc-line-normal {
  line-height: normal;
}

.fkrc-checkbox-window {
  height: 74px;
  width: 300px;
  background-color: #f9f9f9;
  border-radius: 3px;
  border: 1px solid #d3d3d3;
}

.fkrc-checkbox-container {
  width: 28px;
  height: 28px;
}

.fkrc-checkbox {
  position: relative;
  background-color: #fff;
  border-radius: 2px;
  height: 100%;
  width: 100%;
  border: 2px solid #c1c1c1;
  margin: 21px 0 0 12px;
  outline: none;
  font-family: Arial, Helvetica, sans-serif;
  transition:
    width 500ms,
    height 500ms,
    border-radius 500ms,
    margin-top 500ms,
    margin-left 500ms,
    opacity 700ms;
}

.fkrc-checkbox:hover {
  border: 2px solid #b2b2b2;
}

.fkrc-im-not-a-robot {
  position: relative;
  left: 52px;
  bottom: 2px;
  font-size: 15px;
  color: #282727;
}

.fkrc-captcha-logo {
  position: relative;
  left: 246px;
  bottom: 40px;
  width: 33px;
  height: 33px;
  vertical-align: baseline;
}

.fkrc-checkbox-desc {
  color: #555555;
  position: relative;
  font-size: 10px;
  text-align: center;
  bottom: 41px;
  left: 112px;
}

.fkrc-spinner {
  visibility: hidden;
  position: relative;
  height: 35px;
  width: 35px;
  bottom: 90px;
  left: 9px;
  opacity: 0;
  transition: opacity 400ms;
}

.fkrc-verifywin-window {
  opacity: 0;
  position: absolute;
  visibility: hidden;
  margin: auto;
  width: min(380px, 92vw);
  background-color: #fff;
  border: 1px solid #cecece;
  box-shadow: 5px 6px 7px -3px rgba(0, 0, 0, 0.12);
  transition: opacity 400ms;
  z-index: 2;
}

.fkrc-verifywin-window-arrow {
  opacity: 0;
  position: absolute;
  visibility: hidden;
  transition: opacity 200ms;
  width: 10px;
  height: 23px;
}

.fkrc-verifywin-container {
  padding: 8px;
}

.fkrc-verifywin-header {
  background-color: #5a89e1;
  padding: 16px 16px 24px 16px;
  color: #fff;
}

.fkrc-verifywin-header-text-small {
  font-size: 14px;
  line-height: normal;
}

.fkrc-verifywin-header-text-medium {
  font-size: 16px;
}

.fkrc-verifywin-header-text-big {
  font-size: 24px;
  font-weight: 700;
}

.fkrc-verifywin-main {
  padding: 5px;
}

.fkrc-verifywin-footer {
  border-top: 1px solid #cecece;
  padding: 10px 7px;
  color: #737373;
  display: grid;
  grid-template-columns: auto 102px;
  font-size: 13px;
  gap: 8px;
  align-items: center;
}

.fkrc-verifywin-footer-left {
  padding: 5px;
}

.fkrc-verifywin-verify-button {
  text-transform: uppercase;
  background-color: #5a89e2;
  color: #fff;
  text-align: center;
  width: 100%;
  padding: 12px 0;
  text-decoration: none;
  font-weight: 600;
  height: min-content;
  border-radius: 3px;
  font-size: 14px;
  border: none;
  outline: none;
  cursor: pointer;
}

.fkrc-verifywin-verify-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.captcha-item {
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  background: #f1f1f1;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  padding: 0;
}

.captcha-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.captcha-item.selected {
  outline: 4px solid #3b78ff;
  outline-offset: -4px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9) inset,
    0 0 0 3px rgba(59, 120, 255, 0.6);
}

.captcha-item.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(59, 120, 255, 0.18);
  box-shadow: inset 0 0 0 2px rgba(59, 120, 255, 0.75);
}

.captcha-message {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-weight: 600;
  color: #2a6b41;
}

.captcha-message.error {
  color: #a23131;
}

.captcha.solved .captcha-item {
  pointer-events: none;
  opacity: 0.75;
}

.captcha.solved .fkrc-verifywin-verify-button {
  opacity: 0.6;
  cursor: default;
}

.debug-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.debug-toggle {
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  pointer-events: auto;
}

.debug-body {
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 140px;
  pointer-events: auto;
}

.debug-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.debug-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

@keyframes line-in {
  0% {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes button-in {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

@keyframes warp-shake-1 {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  20% {
    transform: translate(-1px, 1px) skew(-0.4deg);
  }
  40% {
    transform: translate(1px, -1px) skew(0.4deg);
  }
  60% {
    transform: translate(-1px, -2px) skew(0.3deg);
  }
  80% {
    transform: translate(1px, 2px) skew(-0.4deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes warp-shake-2 {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  20% {
    transform: translate(-3px, 2px) skew(-0.9deg);
  }
  40% {
    transform: translate(3px, -2px) skew(0.9deg);
  }
  60% {
    transform: translate(-3px, -3px) skew(0.8deg);
  }
  80% {
    transform: translate(3px, 3px) skew(-0.9deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes warp-shake-3 {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  20% {
    transform: translate(-5px, 4px) skew(-1.6deg);
  }
  40% {
    transform: translate(5px, -4px) skew(1.4deg);
  }
  60% {
    transform: translate(-4px, -6px) skew(1.2deg);
  }
  80% {
    transform: translate(4px, 6px) skew(-1.4deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes warp-shake-warp {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  25% {
    transform: translate(-1px, 1px) skew(-0.4deg);
  }
  50% {
    transform: translate(1px, -1px) skew(0.4deg);
  }
  75% {
    transform: translate(-1px, -2px) skew(0.3deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes warp-flicker {
  0%,
  100% {
    opacity: 1;
    text-shadow: 0 12px 30px var(--shadow);
  }
  50% {
    opacity: 0.85;
    text-shadow: 0 18px 40px rgba(120, 200, 255, 0.35);
  }
}

@media (max-width: 560px) {
  .scene {
    align-items: flex-start;
    padding-top: 12vh;
  }

  .scene.intro {
    gap: 20px;
  }

  .scene.outro {
    padding-top: 12vh;
  }

  .scene.warp {
    padding-top: 12vh;
  }

  .scene.final {
    padding-top: 12vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .line {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .line.visible,
  .start-btn.visible,
  .cell.filled,
  .cell.reveal {
    animation: none;
  }
}
