:root {
  color-scheme: dark;
  --page: #101114;
  --panel: #17191d;
  --panel-raised: #1e2025;
  --ink: #f7f4ee;
  --muted: #9a9ca4;
  --line: #2c2f36;
  --accent: #b8ff5a;
  --accent-ink: #101409;
  --danger: #ff786f;
  --card-width: 1080px;
  --card-height: 1350px;
  --radius-lg: 28px;
  --radius-md: 18px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% -8%, rgba(184, 255, 90, 0.08), transparent 25rem),
    var(--page);
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(184, 255, 90, 0.5);
  outline-offset: 3px;
}

.site-header {
  width: min(100% - 40px, 1460px);
  min-height: 94px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark,
.footer-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  letter-spacing: -0.08em;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px 14px 14px 5px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.export-size {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.export-size > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(184, 255, 90, 0.65);
}

.workspace {
  width: min(100% - 40px, 1460px);
  margin: 0 auto;
  padding: 38px 0 64px;
  display: grid;
  grid-template-columns: minmax(340px, 0.84fr) minmax(480px, 1.16fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
}

.editor-panel {
  position: sticky;
  top: 24px;
}

.panel-heading {
  max-width: 560px;
  margin-bottom: 30px;
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow {
  font-size: 0.76rem;
}

.panel-heading h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(2.35rem, 5vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.panel-heading > p:last-child {
  max-width: 48ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.field-group,
.truth-field {
  display: grid;
  gap: 9px;
}

.field-group > label,
.field-group > span,
.truth-field > span,
.truths-fieldset legend {
  color: #d8d8dc;
  font-size: 0.9rem;
  font-weight: 700;
}

.input-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  transition: border-color 150ms ease, background-color 150ms ease;
}

input[type="text"] {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
}

textarea {
  min-height: 84px;
  padding: 13px 15px;
  border-radius: 14px;
  line-height: 1.45;
  resize: vertical;
}

input[type="text"]:hover,
textarea:hover,
input[type="text"]:focus,
textarea:focus {
  border-color: #555963;
  background: var(--panel-raised);
}

.button {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 19px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, background-color 150ms ease;
}

.button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.button svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.field-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.field-status.is-error {
  color: var(--danger);
}

.truths-fieldset {
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 15px;
}

.truths-fieldset legend {
  margin-bottom: 12px;
}

.truth-field > span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.truth-field b {
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.lie-field b {
  color: #ff8d84;
}

.lie-field textarea {
  border-color: rgba(255, 141, 132, 0.35);
}

.truth-field small {
  margin-left: auto;
  color: #70737b;
  font-size: 0.72rem;
  font-weight: 500;
}

.overrides {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overrides summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 0.92rem;
  font-weight: 700;
}

.overrides summary::-webkit-details-marker {
  display: none;
}

.overrides summary::after {
  content: "+";
  margin-left: auto;
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 400;
}

.overrides[open] summary::after {
  content: "−";
}

.overrides summary small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.override-content {
  padding: 4px 0 22px;
  display: grid;
  gap: 17px;
}

.file-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.file-field > span:first-child,
.file-field small {
  grid-column: 1;
}

.file-field small {
  color: var(--muted);
  font-size: 0.76rem;
}

.file-button {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel-raised);
  cursor: pointer;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.field-group output {
  float: right;
  color: var(--muted);
  font-weight: 500;
}

.preview-panel {
  min-width: 0;
}

.preview-heading,
.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.preview-heading {
  margin-bottom: 16px;
}

.preview-heading .eyebrow {
  margin-bottom: 4px;
}

.preview-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.icon-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #d7d7da;
  background: var(--panel);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.icon-button:hover {
  border-color: #4a4d55;
  background: var(--panel-raised);
}

.card-stage {
  position: relative;
  width: min(100%, 670px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid #30333a;
  border-radius: var(--radius-lg);
  background: #0b0c0e;
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.35);
}

.card-scaler {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--card-width);
  height: var(--card-height);
  transform-origin: top left;
}

.profile-card {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  overflow: hidden;
  color: #f8f8f4;
  background: #1a1c20;
  isolation: isolate;
}

.card-grain {
  position: absolute;
  inset: 0;
  z-index: 8;
  opacity: 0.06;
  pointer-events: none;
  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='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.portrait-area {
  position: relative;
  height: 630px;
  margin: 34px 34px 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 66px;
  background:
    radial-gradient(circle at 50% 28%, rgba(184, 255, 90, 0.28), transparent 35%),
    linear-gradient(145deg, #35383d, #16181b);
}

.portrait-backdrop,
.portrait-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.portrait-backdrop {
  z-index: 0;
  object-fit: cover;
  opacity: 0.42;
  filter: blur(34px) saturate(0.75);
  transform: scale(1.18);
}

.portrait-image {
  z-index: 2;
  object-fit: contain;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.48));
}

.portrait-glow {
  position: absolute;
  z-index: 1;
  inset: 22% 20% 5%;
  border-radius: 50%;
  background: rgba(184, 255, 90, 0.18);
  filter: blur(70px);
}

.portrait-shade {
  position: absolute;
  z-index: 3;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 8, 0.02) 45%, rgba(8, 9, 11, 0.55) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.2));
}

.portrait-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portrait-fallback[hidden],
.portrait-image[hidden],
.portrait-backdrop[hidden] {
  display: none;
}

.portrait-fallback svg {
  position: relative;
  width: 170px;
  height: 210px;
  fill: rgba(255, 255, 255, 0.03);
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 5;
}

.fallback-ring {
  position: absolute;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(184, 255, 90, 0.2);
  border-radius: 50%;
}

.ocean-badge {
  position: absolute;
  z-index: 4;
  top: 34px;
  left: 38px;
  padding: 14px 21px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(12, 13, 15, 0.42);
  backdrop-filter: blur(18px);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-content {
  height: 686px;
  padding: 42px 64px 40px;
  display: flex;
  flex-direction: column;
}

.identity {
  padding-bottom: 29px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.card-kicker {
  margin-bottom: 13px;
  font-size: 18px;
}

.identity h3 {
  margin: 0;
  overflow: hidden;
  font-size: 86px;
  line-height: 0.95;
  letter-spacing: -0.065em;
  white-space: nowrap;
}

.identity > p:last-child {
  margin: 16px 0 0;
  overflow: hidden;
  color: #b9bbc0;
  font-size: 31px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-facts {
  flex: 1;
  padding: 28px 0 18px;
  display: grid;
  align-content: center;
  gap: 23px;
}

.card-fact {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 22px;
  align-items: start;
}

.card-fact-number {
  padding-top: 5px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.card-fact-text {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #eeeeeb;
  font-size: 31px;
  line-height: 1.25;
  letter-spacing: -0.018em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #777a82;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px 13px 13px 5px;
  font-size: 15px;
}

.preview-actions {
  width: min(100%, 670px);
  margin-top: 18px;
}

.preview-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.button-download {
  min-width: 176px;
  color: #111;
  background: #f3f1ea;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100vw - 44px));
  padding: 13px 17px;
  border: 1px solid #383b43;
  border-radius: 14px;
  color: var(--ink);
  background: rgba(25, 27, 31, 0.96);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
  font-size: 0.88rem;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast[aria-hidden="false"] {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    width: min(100% - 32px, 720px);
  }

  .editor-panel {
    position: static;
  }

  .panel-heading h1 {
    max-width: 12ch;
  }

  .card-stage,
  .preview-actions {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .site-header {
    width: calc(100% - 28px);
    min-height: 76px;
  }

  .brand small,
  .export-size {
    display: none;
  }

  .workspace {
    width: calc(100% - 28px);
    padding-top: 28px;
    gap: 38px;
  }

  .panel-heading h1 {
    font-size: 3rem;
  }

  .input-action-row {
    grid-template-columns: 1fr;
  }

  .button-primary {
    width: 100%;
  }

  .preview-heading,
  .preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-heading {
    gap: 13px;
  }

  .icon-button {
    align-self: flex-start;
  }

  .preview-actions {
    gap: 13px;
  }

  .button-download {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
