:root {
  --bg: #f7f9ff;
  --surface: #edf2ff;
  --white: #ffffff;
  --ink: #050538;
  --ink60: rgba(5, 5, 56, 0.62);
  --ink35: rgba(5, 5, 56, 0.58);
  --border: #dde5f7;
  --g1: #060197;
  --g2: #0d6eff;
  --accent-y: #f5c518;
  --accent-p: #6b3fa0;
  --grad: linear-gradient(125deg, var(--g1) 0%, var(--g2) 100%);
  --sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gx: 24px;
  --sh3: 0 4px 14px rgba(0, 0, 0, 0.06);
}

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

html {
  color-scheme: only light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/26px var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Lock the public form to one viewport — no scroll */
body.page-form {
  height: 100dvh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.af {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.af-form {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* Soft collage accents — restrained, not loud */
.collage {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.collage .bar {
  position: absolute;
  border-radius: 3px;
  opacity: 0.55;
}

.bar-a {
  width: 10px;
  height: 72px;
  background: var(--accent-p);
  top: 12%;
  left: 3%;
  transform: rotate(-8deg);
}

.bar-b {
  width: 10px;
  height: 56px;
  background: var(--accent-y);
  top: 18%;
  left: 5.5%;
  transform: rotate(6deg);
}

.bar-c {
  width: 10px;
  height: 64px;
  background: var(--g2);
  bottom: 14%;
  right: 4%;
  transform: rotate(12deg);
}

.dotgrid {
  position: absolute;
  width: 88px;
  height: 88px;
  bottom: 10%;
  left: 4%;
  opacity: 0.22;
  background-image: radial-gradient(circle, var(--ink) 1.2px, transparent 1.3px);
  background-size: 10px 10px;
}

.tri {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0.4;
}

.tri-a {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid var(--accent-y);
  top: 22%;
  right: 6%;
  transform: rotate(18deg);
}

.tri-b {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid var(--g2);
  bottom: 22%;
  right: 8%;
  transform: rotate(-24deg);
}

.nav {
  position: relative;
  z-index: 2;
  height: 66px;
  display: flex;
  align-items: center;
  padding: 0 var(--gx);
  background: rgba(247, 249, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-slim {
  height: 52px;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
}

.nav img {
  height: 28px;
  width: auto;
  display: block;
}

.page {
  flex: 1;
  width: 100%;
  position: relative;
  z-index: 1;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: center;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gx);
  min-height: 0;
  height: 100%;
}

.art-panel {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  aspect-ratio: 4 / 5;
  max-height: min(58dvh, 420px);
  border: 3px solid #1a1a1a;
  border-radius: 18px;
  background: #111;
  box-shadow: var(--sh3);
  overflow: visible;
}

/* Artwork “spills” past the device frame */
.art-panel img {
  position: absolute;
  inset: -2% -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  object-position: center;
  clip-path: polygon(
    4% 3%,
    96% 2%,
    99% 18%,
    97% 42%,
    100% 68%,
    95% 92%,
    72% 100%,
    38% 97%,
    2% 94%,
    0% 62%,
    2% 28%
  );
  filter: saturate(1.05) contrast(1.02);
}

.art-panel::after {
  content: "";
  position: absolute;
  inset: 8% 10%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  pointer-events: none;
  z-index: 1;
}

.stage-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 480px;
}

.topic {
  font: 500 12px/16px var(--sans);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink35);
  margin: 0;
}

.stage-copy h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 600;
  text-wrap: balance;
}

.gt {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub {
  margin: 0;
  font-size: 15px;
  line-height: 23px;
  max-width: 40ch;
}

.muted {
  color: var(--ink60);
}

/* Form card sits slightly over the “frame” edge */
.form-card {
  margin-top: 6px;
  margin-left: -8px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--sh3);
  /* Soft torn / irregular edge — light touch */
  clip-path: polygon(
    0% 2%,
    2% 0%,
    98% 1%,
    100% 4%,
    99% 96%,
    97% 100%,
    3% 99%,
    0% 96%
  );
}

.form-card label {
  font: 500 14px/20px var(--sans);
  color: var(--ink);
}

.field {
  width: 100%;
  min-height: 96px;
  max-height: 140px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font: 400 15px/22px var(--sans);
  resize: none;
}

.field::placeholder {
  color: var(--ink35);
}

.field:focus {
  outline: 0;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--border), var(--sh3);
}

.field:focus-visible {
  box-shadow: 0 0 0 2px var(--ink35);
}

.field[aria-invalid="true"] {
  box-shadow: 0 0 0 2px #b42318;
}

.hint {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink60);
}

.err {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  color: #b42318;
}

.ok {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  color: #027a48;
  background: #ecfdf3;
  border-radius: 12px;
  padding: 10px 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  font: 500 14px/22px var(--sans);
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.15s;
}

.btn.p {
  background: var(--grad);
  color: var(--bg);
  height: 46px;
  padding: 10px 28px;
  width: 100%;
}

.btn.p:hover {
  transform: translateY(-1px);
}

.btn.p:focus-visible {
  outline: 2px solid var(--ink35);
  outline-offset: 2px;
}

.btn.o {
  background: var(--surface);
  color: var(--ink);
  height: 40px;
  padding: 8px 20px;
}

.foot {
  margin-top: auto;
  padding: 40px var(--gx);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.foot-slim {
  padding: 10px var(--gx) 14px;
  border-top: 0;
}

.foot img {
  height: 20px;
  width: auto;
}

.foot p {
  margin: 0;
  font-size: 12px;
  color: var(--ink60);
}

/* Mobile: drop art, keep compact single column, allow scroll if needed */
@media (max-width: 840px) {
  body.page-form {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .af-form {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 8px var(--gx) 20px;
    height: auto;
  }

  .art-panel {
    display: none;
  }

  .stage-copy {
    max-width: none;
  }

  .form-card {
    margin-left: 0;
  }

  .bar-a,
  .bar-b {
    display: none;
  }
}

/* Admin */
.admin-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px var(--gx) 80px;
}

.admin-shell h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 24px 0 32px;
}

.token-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin-top: 24px;
}

.token-input {
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/24px var(--sans);
  width: 100%;
}

.token-input:focus {
  outline: 0;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--border), var(--sh3);
}

.q-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  text-align: left;
}

.q-item p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.q-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink35);
}

.empty {
  color: var(--ink60);
  margin: 24px 0;
}

.chead {
  padding: 48px var(--gx) 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.form-wrap {
  width: 100%;
  max-width: 560px;
  margin: 8px auto 48px;
  padding: 0 var(--gx);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
