*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  color: #111;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR",
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

canvas#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Same square as the top-down WebGL board: min(viewport) centered. */
#qrsvg {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  transform: translate(-50%, -50%);
  z-index: 2;
  display: block;
  background: #fff;
  shape-rendering: crispEdges;
  pointer-events: none;
}
#qrsvg.off {
  display: none;
}

#still {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(92vw, 92vh);
  max-height: min(92vw, 92vh);
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  z-index: 4;
  transition: opacity 1.25s ease;
  pointer-events: none;
}
body.fallback-mode #still {
  display: block;
}
#still.shown {
  opacity: 1;
}
#still-alt {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  text-align: center;
  color: #444;
  font-size: 14px;
  display: none;
}
#still-alt.on {
  display: block;
}

#skip {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 8;
  border: 0;
  background: rgba(20, 22, 26, 0.55);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#skip:active {
  transform: scale(0.98);
}
body.frozen #skip,
body.done #skip,
body.fallback-mode #skip {
  display: none;
}

#tap {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #111;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
}
#tap.on {
  display: flex;
}
#tap span {
  background: rgba(255, 255, 255, 0.9);
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.card {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  background: #16181c;
  color: #f6f6f4;
  border-radius: 18px;
  padding: 16px 16px 14px;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  pointer-events: none;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.card.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
body.frozen .card {
  display: none;
}

.card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.card .blurb {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
}

.langs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.langs button {
  flex: 1;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 12px;
  padding: 7px 0;
  border-radius: 999px;
  cursor: pointer;
}
.langs button[aria-pressed="true"] {
  background: #fff;
  color: #111;
  font-weight: 650;
}

.cta {
  width: 100%;
  border: 0;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 13px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.cta:active {
  transform: scale(0.99);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 8px);
  z-index: 15;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.fallback-mode #view {
  display: none;
}
