:root {
  --bg: #0a0e27;
  --panel: rgba(0, 0, 0, 0.22);
  --ink: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --cyan: #64c8ff;
  --magenta: #ff64d8;
  --yellow: #ffff00;
  --green: #00ff88;
  --white: #ffffff;
  --amber: #ffaa00;
  --letter: 0.08em;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "VT323", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  letter-spacing: var(--letter);
}

#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 16px;
  max-width: 980px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand__title {
  font-size: 34px;
  line-height: 1;
  color: var(--white);
}

.brand__subtitle {
  margin-top: 4px;
  font-size: 18px;
  color: var(--muted);
}

.hud {
  display: flex;
  gap: 14px;
}

.hud__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  min-width: 160px;
}

#hudAvatar {
  width: 32px;
  height: 32px;
  display: block;
  image-rendering: pixelated;
  border-radius: 8px;
  overflow: hidden;
}

.hud__name {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.82);
  text-transform: uppercase;
  letter-spacing: var(--letter);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud__item {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  min-width: 120px;
}

.hud__label {
  font-size: 14px;
  color: var(--muted);
}

.hud__value {
  font-size: 24px;
  margin-top: 2px;
  color: var(--white);
}

.screen {
  display: grid;
  place-items: center;
}

.hidden {
  display: none !important;
}

.panel {
  width: min(720px, 100%);
  padding: 18px 16px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
}

.panel__headline {
  font-size: 34px;
  color: var(--white);
}

.panel__sub {
  margin-top: 6px;
  font-size: 20px;
  color: var(--muted);
}

.reg {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.reg__row {
  flex: 1 1 340px;
}

.reg__label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
  text-transform: uppercase;
}

.reg__label--sub {
  margin-top: 10px;
}

.reg__input {
  margin-top: 8px;
  width: 100%;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  letter-spacing: var(--letter);
  padding: 12px 12px;
  border-radius: 10px;
  outline: none;
  text-transform: none;
}

.reg__input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.reg__input:focus {
  border-color: rgba(255, 255, 255, 0.34);
}

.reg__register {
  margin-top: 10px;
  width: 100%;
}

.reg__file {
  margin-top: 8px;
  width: 100%;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.12);
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  letter-spacing: var(--letter);
  padding: 10px 12px;
  border-radius: 10px;
}

.reg__random {
  margin-top: 10px;
  width: 100%;
}

.reg__avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}

#avatarCanvas {
  width: 96px;
  height: 96px;
  display: block;
  image-rendering: pixelated;
}

.panel__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.panel__row .btn {
  flex: 1 1 160px;
}

.panel__hint {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
}

.btn,
.choice {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.12);
  color: var(--white);
  font-family: inherit;
  letter-spacing: var(--letter);
  text-transform: uppercase;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:hover,
.choice:hover {
  border-color: rgba(255, 255, 255, 0.34);
}

.btn:disabled,
.choice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
}

.stage {
  width: 100%;
  display: grid;
  place-items: center;
  gap: 6px;
}

.crt {
  width: min(520px, 92vw);
  aspect-ratio: 1 / 1;
  padding: 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.crt__glass {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  transform: perspective(800px) rotateX(6deg) scale(0.985);
}

#gridCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.sharecard {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}

#shareCanvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: auto;
}

.readout {
  width: min(520px, 92vw);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.68);
  text-transform: uppercase;
}

.statusline {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.78);
  min-height: 22px;
}

.choices {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

.choice {
  width: 100%;
  text-align: left;
  font-size: 20px;
  padding: 14px 14px;
}

.choice.correct {
  border-color: rgba(0, 255, 136, 0.7);
}

.choice.wrong {
  border-color: rgba(255, 100, 216, 0.6);
}

.sharebox {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.88);
}

@media (min-width: 720px) {
  .choices {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .hud {
    gap: 10px;
    flex-wrap: wrap;
  }
  .hud__user {
    min-width: 100%;
  }
  .hud__item {
    min-width: 108px;
  }
  .brand__title {
    font-size: 30px;
  }
  .crt {
    width: min(460px, 88vw);
    padding: 10px;
  }
}
