:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --paper-deep: #e8e1d5;
  --surface: rgba(252, 250, 246, 0.88);
  --surface-solid: #faf8f3;
  --ink: #18232a;
  --ink-soft: #626970;
  --line: rgba(24, 35, 42, 0.14);
  --line-strong: rgba(24, 35, 42, 0.28);
  --self: #247f98;
  --self-bright: #39a6bd;
  --other: #a74472;
  --other-bright: #d36092;
  --focus: #a94e19;
  --error: #9d2d35;
  --error-fill: rgba(157, 45, 53, 0.08);
  --shadow: rgba(51, 44, 37, 0.12);
  --door-line: rgba(56, 94, 104, 0.3);
  --serif: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: proof-dissolve-out 260ms ease both;
}

::view-transition-new(root) {
  animation: proof-dissolve-in 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes proof-dissolve-out {
  to {
    opacity: 0;
    transform: scale(0.99);
  }
}

@keyframes proof-dissolve-in {
  from {
    opacity: 0;
    transform: scale(1.012);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #090d12;
  --paper-deep: #101722;
  --surface: rgba(17, 24, 33, 0.9);
  --surface-solid: #111820;
  --ink: #f2efe8;
  --ink-soft: #a7afb7;
  --line: rgba(226, 235, 240, 0.13);
  --line-strong: rgba(226, 235, 240, 0.29);
  --self: #58c6dc;
  --self-bright: #8ae7f2;
  --other: #ee76a9;
  --other-bright: #ffafd0;
  --focus: #f6b35f;
  --error: #ff98a0;
  --error-fill: rgba(255, 152, 160, 0.09);
  --shadow: rgba(0, 0, 0, 0.34);
  --door-line: rgba(184, 224, 229, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #090d12;
    --paper-deep: #101722;
    --surface: rgba(17, 24, 33, 0.9);
    --surface-solid: #111820;
    --ink: #f2efe8;
    --ink-soft: #a7afb7;
    --line: rgba(226, 235, 240, 0.13);
    --line-strong: rgba(226, 235, 240, 0.29);
    --self: #58c6dc;
    --self-bright: #8ae7f2;
    --other: #ee76a9;
    --other-bright: #ffafd0;
    --focus: #f6b35f;
    --error: #ff98a0;
    --error-fill: rgba(255, 152, 160, 0.09);
    --shadow: rgba(0, 0, 0, 0.34);
    --door-line: rgba(184, 224, 229, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 88%, color-mix(in srgb, var(--self) 13%, transparent), transparent 30rem),
    radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--other) 13%, transparent), transparent 32rem),
    linear-gradient(145deg, var(--paper), var(--paper-deep));
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  content: "";
  opacity: 0.045;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.proof-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 52px);
  place-items: center;
}

.proof-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 960px);
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: clamp(26px, 4vw, 42px);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--ink) 3%, transparent), transparent 42%),
    var(--surface);
  box-shadow: 0 30px 90px var(--shadow);
  backdrop-filter: blur(22px);
}

.proof-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 20px);
  text-align: center;
}

.proof-mark {
  flex: 0 0 auto;
  width: clamp(50px, 6vw, 68px);
  height: auto;
  filter: drop-shadow(0 9px 16px color-mix(in srgb, var(--self) 18%, transparent));
}

.proof-mark__paper {
  fill: var(--surface-solid);
}

.proof-mark__self {
  stroke: var(--self);
}

.proof-mark__other {
  stroke: var(--other);
}

.proof-mark__hub {
  fill: var(--surface-solid);
  stroke: var(--ink);
  stroke-opacity: 0.16;
}

h1 {
  margin: 0;
  background: linear-gradient(10deg, var(--self), var(--other));
  background-clip: text;
  color: var(--self);
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.95;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.proof-error {
  max-width: 66ch;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
  border-radius: 13px;
  margin: 20px auto 0;
  background: var(--error-fill);
  color: var(--error);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

form {
  margin-top: clamp(24px, 3vw, 34px);
}

.proof-error + form {
  margin-top: 18px;
}

.proof-questions {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.proof-question {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 0;
  background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
}

.proof-question legend {
  padding: 0 4px 9px;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1.25;
  text-transform: uppercase;
}

.proof-options {
  display: grid;
  gap: 7px;
}

.proof-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.proof-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.proof-option span {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  font-size: 0.9rem;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.proof-option span::after {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  margin-left: auto;
  content: "";
  transform: rotate(45deg);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.proof-option:hover span {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.proof-option input:checked + span {
  border-color: color-mix(in srgb, var(--self) 64%, var(--other));
  background: color-mix(in srgb, var(--self) 9%, transparent);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--self) 55%, var(--other));
}

.proof-option input:checked + span::after {
  border-color: color-mix(in srgb, var(--self) 55%, var(--other));
  background: color-mix(in srgb, var(--self) 58%, var(--other));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--self) 9%, transparent);
}

.proof-option input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.proof-threshold {
  --proof-gate-rise: 44px;
  --proof-gate-inner-offset: 9px;
  position: relative;
  width: min(100%, 300px);
  padding-top: var(--proof-gate-rise);
  margin: 18px auto 0;
}

.proof-threshold::before,
.proof-threshold::after {
  position: absolute;
  z-index: -1;
  right: auto;
  left: 50%;
  width: 100%;
  height: var(--proof-gate-rise);
  border: 1px solid var(--door-line);
  border-bottom: 0;
  border-radius: 180px 180px 0 0;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.proof-threshold::before {
  top: 0;
  box-shadow: 0 -10px 35px color-mix(in srgb, var(--self) 8%, transparent);
}

.proof-threshold::after {
  top: var(--proof-gate-inner-offset);
  width: calc(100% - 20px);
  height: calc(var(--proof-gate-rise) - var(--proof-gate-inner-offset));
  border-color: color-mix(in srgb, var(--other) 20%, var(--door-line));
}

.proof-threshold__star {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid color-mix(in srgb, var(--self) 55%, var(--other));
  background: var(--surface-solid);
  box-shadow:
    -35px 19px 0 -3px var(--self),
    35px 19px 0 -3px var(--other);
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
}

.proof-submit {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  margin: 0 auto;
  background:
    linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box,
    linear-gradient(15deg, var(--self), var(--other)) border-box;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  box-shadow:
    0 12px 28px color-mix(in srgb, var(--other) 10%, transparent),
    0 0 22px color-mix(in srgb, var(--self) 7%, transparent);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.proof-submit svg {
  width: 10px;
  fill: color-mix(in srgb, var(--self) 55%, var(--other));
  transition: transform 220ms ease;
}

.proof-submit:hover {
  box-shadow:
    0 15px 32px color-mix(in srgb, var(--other) 15%, transparent),
    0 0 30px color-mix(in srgb, var(--self) 12%, transparent);
  transform: translateY(-2px);
}

.proof-submit:hover svg:first-child {
  transform: translateX(-2px) rotate(-12deg);
}

.proof-submit:hover svg:last-child {
  transform: translateX(2px) rotate(12deg);
}

.proof-submit:active {
  transform: translateY(0);
}

.proof-submit:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-solid) 68%, transparent);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.theme-switch {
  position: fixed;
  z-index: 30;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  box-shadow: 0 10px 28px var(--shadow);
  backdrop-filter: blur(14px);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  transform: rotate(8deg);
}

.theme-icon {
  grid-area: 1 / 1;
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  transition: opacity 180ms ease, transform 250ms ease;
}

.theme-icon--sun,
:root[data-theme="dark"] .theme-icon--moon {
  opacity: 0;
  transform: scale(0.6) rotate(-30deg);
}

:root[data-theme="dark"] .theme-icon--sun {
  opacity: 1;
  transform: scale(1) rotate(0);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon--moon {
    opacity: 0;
    transform: scale(0.6) rotate(-30deg);
  }

  :root:not([data-theme]) .theme-icon--sun {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@media (max-width: 850px) {
  .icon-button {
    width: 38px;
    height: 38px;
  }

  .theme-icon {
    width: 16px;
  }
}

@media (max-width: 720px) {
  .proof-shell {
    padding: 8px;
    place-items: center;
  }

  .proof-card {
    padding: 16px 10px 14px;
    border-radius: 24px;
  }

  .proof-header {
    justify-content: flex-start;
    gap: 8px;
    padding-right: 46px;
    text-align: left;
  }

  .proof-mark {
    width: 40px;
  }

  h1 {
    font-size: clamp(1.75rem, 8vw, 2.4rem);
  }

  form {
    margin-top: 14px;
  }

  .proof-questions {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .proof-question {
    padding: 10px;
    border-radius: 14px;
  }

  .proof-question legend {
    padding: 0 2px 6px;
  }

  .proof-options {
    gap: 5px;
  }

  .proof-option span {
    min-height: 44px;
    gap: 7px;
    padding: 7px 8px;
    font-size: 0.82rem;
  }

  .proof-threshold {
    --proof-gate-rise: 34px;
    --proof-gate-inner-offset: 7px;
    width: min(100%, 320px);
    margin: 8px auto 0;
  }

  .proof-submit {
    min-height: 48px;
    gap: 14px;
    padding: 8px 20px;
    font-size: 1.08rem;
  }

  .theme-switch {
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
  }
}

@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .proof-shell {
    padding: 4px;
  }

  .proof-card {
    padding: 8px;
    border-radius: 18px;
  }

  .proof-header {
    justify-content: flex-start;
    gap: 6px;
    padding-right: 42px;
    text-align: left;
  }

  .proof-mark {
    width: 32px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .proof-error {
    padding: 7px 9px;
    margin-top: 7px;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  form,
  .proof-error + form {
    margin-top: 6px;
  }

  .proof-questions {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .proof-question {
    padding: 6px;
    border-radius: 11px;
  }

  .proof-question legend {
    padding: 0 2px 4px;
    font-size: 0.52rem;
  }

  .proof-options {
    gap: 3px;
  }

  .proof-option span {
    min-height: 44px;
    gap: 4px;
    padding: 5px 6px;
    border-radius: 8px;
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .proof-option span::after {
    width: 5px;
    height: 5px;
  }

  .proof-threshold {
    --proof-gate-rise: 16px;
    --proof-gate-inner-offset: 4px;
    margin: 4px auto 0;
  }

  .proof-threshold__star {
    top: 8px;
  }

  .proof-submit {
    min-height: 44px;
    gap: 10px;
    padding: 5px 16px;
    font-size: 1rem;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .theme-switch {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .proof-card--error {
    padding: 8px;
  }

  .proof-card--error .proof-header {
    gap: 6px;
  }

  .proof-card--error .proof-mark {
    width: 32px;
  }

  .proof-card--error h1 {
    font-size: 1.5rem;
  }

  .proof-card--error .proof-error {
    padding: 5px 8px;
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .proof-card--error .proof-error + form {
    margin-top: 6px;
  }

  .proof-card--error .proof-questions {
    gap: 4px;
  }

  .proof-card--error .proof-question {
    padding: 5px;
  }

  .proof-card--error .proof-question legend {
    padding-bottom: 3px;
    font-size: 0.52rem;
  }

  .proof-card--error .proof-options {
    gap: 3px;
  }

  .proof-card--error .proof-option span {
    min-height: 44px;
    gap: 4px;
    padding: 4px 5px;
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .proof-card--error .proof-threshold {
    --proof-gate-rise: 14px;
    --proof-gate-inner-offset: 4px;
    margin: 4px auto 0;
  }

  .proof-card--error .proof-threshold__star {
    top: 5px;
  }

  .proof-card--error .proof-submit {
    min-height: 44px;
    padding: 4px 14px;
    font-size: 1rem;
  }
}

@media (forced-colors: active) {
  .proof-card,
  .proof-question,
  .proof-option span,
  .proof-submit,
  .icon-button {
    border-color: CanvasText;
    background: Canvas;
  }

  .proof-option input:checked + span,
  .proof-option input:checked + span::after {
    border-color: Highlight;
  }

  .proof-option input:checked + span::after {
    background: Highlight;
  }

  .proof-threshold::before,
  .proof-threshold::after,
  .proof-threshold__star {
    border-color: CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.01ms !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
