:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg2: #0b1f35;
  --card: rgba(10, 21, 38, 0.82);
  --line: rgba(148, 197, 255, 0.18);
  --text: #edf5ff;
  --muted: #a9bfd8;
  --accent: #68d6ff;
  --accent2: #8dffcb;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
}

@font-face {
  font-family: "DSEG14";
  src: url("/assets/fonts/DSEG14Classic-Regular.woff2") format("woff2");
  font-display: swap;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(104, 214, 255, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(141, 255, 203, 0.14), transparent 28%),
    linear-gradient(160deg, var(--bg), var(--bg2));
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.card {
  width: min(680px, 100%);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.center-card {
  text-align: center;
}

.center-card .lede {
  margin-top: 14px;
}

.eyebrow {
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: calc(0.78rem + 10pt);
  color: var(--accent2);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.3rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  max-width: 11ch;
}

.lede {
  margin: 20px 0 0;
  max-width: 52ch;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
}

.panel {
  margin-top: 28px;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid rgba(104, 214, 255, 0.18);
  background: rgba(6, 14, 26, 0.72);
}

.passphrase-form {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

.codeword-heading h1 {
  max-width: none;
}

.codeword-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.codeword-option {
  min-height: 64px;
  padding: 14px 12px;
  border: 2px solid rgba(104, 214, 255, 0.24);
  border-radius: 16px;
  color: var(--text);
  background: rgba(6, 14, 26, 0.72);
  cursor: pointer;
  font: 400 clamp(0.82rem, 2.8vw, 1.16rem)/1 "DSEG14", monospace;
  letter-spacing: 0.04em;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.codeword-option:hover,
.codeword-option:focus-visible,
.codeword-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(104, 214, 255, 0.3);
}

.codeword-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.codeword-option.answer-correct {
  border-color: #58ef91;
  box-shadow: 0 0 24px rgba(88, 239, 145, 0.9), inset 0 0 18px rgba(88, 239, 145, 0.2);
}

.codeword-option.answer-incorrect {
  border-color: #ff5757;
  box-shadow: 0 0 24px rgba(255, 87, 87, 0.9), inset 0 0 18px rgba(255, 87, 87, 0.2);
}

.codeword-option:disabled {
  cursor: wait;
}

.passphrase-form .codeword-submit {
  justify-self: center;
  min-width: 180px;
}

.text-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(104, 214, 255, 0.24);
  border-radius: 16px;
  background: rgba(6, 14, 26, 0.72);
  color: var(--text);
  font: inherit;
}

.text-input::placeholder {
  color: rgba(169, 191, 216, 0.76);
}

.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.form-button {
  justify-self: start;
  cursor: pointer;
}

.back-button {
  cursor: pointer;
  font: inherit;
}

.label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.value {
  display: block;
  font-size: 1rem;
  word-break: break-all;
  color: var(--text);
}

.note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.qr-shell {
  margin-top: 20px;
  display: grid;
  place-items: center;
}

.center-stack {
  gap: 10px;
}

.qr-image {
  width: min(280px, 100%);
  aspect-ratio: 1;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.uuid-text {
  display: block;
  max-width: 100%;
  font-size: 1rem;
  word-break: break-all;
  color: var(--text);
}

.chance-line {
  margin: 18px 0 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}

.chance-count {
  font-size: 1.22em;
}

.refresh-chances {
  margin-left: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(104, 214, 255, 0.24);
  border-radius: 999px;
  background: rgba(6, 14, 26, 0.72);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.refresh-chances:hover {
  border-color: rgba(104, 214, 255, 0.42);
}

.refresh-chances:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.refresh-chances:disabled {
  cursor: wait;
  opacity: 0.7;
}

.note a,
.note code {
  color: var(--text);
}

.actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid rgba(104, 214, 255, 0.24);
  background: rgba(6, 14, 26, 0.72);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: rgba(104, 214, 255, 0.42);
}

.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.scan-card {
  width: min(760px, 100%);
}

.scan-frame {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 3 / 4;
  margin: 24px auto 0;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(104, 214, 255, 0.24);
  background: #02070f;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(transparent 0, transparent calc(50% - 2px), rgba(104, 214, 255, 0.85) calc(50% - 2px), rgba(104, 214, 255, 0.85) calc(50% + 2px), transparent calc(50% + 2px)),
    radial-gradient(circle at center, transparent 0 42%, rgba(104, 214, 255, 0.08) 42% 43%, transparent 43%);
}

@media (max-width: 640px) {
  .shell {
    padding: 16px;
  }

  .codeword-options {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 28px 22px;
    border-radius: 22px;
  }
}
