:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dde8;
  --panel: #ffffff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #e11d48;
  --red-dark: #be123c;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 32rem),
    linear-gradient(135deg, #f9fafb 0%, var(--bg) 100%);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 32px 0;
}

.creator-view,
.choice-view {
  width: 100%;
}

.brand {
  width: max-content;
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  max-width: 760px;
  margin: 0 0 24px;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1;
  letter-spacing: 0;
}

.choice-subtitle {
  max-width: 620px;
  margin: -8px 0 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.option-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.option-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.option-form textarea {
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.option-form textarea:focus,
.result-actions input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  border-color: var(--blue);
}

.option-form button,
.result-actions button,
.result-actions a {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: white;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.option-form button {
  grid-column: 1 / -1;
  width: max-content;
}

.result-box {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.result-box > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.result-actions input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 4vw, 42px);
  perspective: 1200px;
}

.choice-card {
  position: relative;
  min-height: clamp(260px, 42vw, 420px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  transform-style: preserve-3d;
  transition: transform 520ms ease, opacity 240ms ease, filter 240ms ease;
  cursor: pointer;
}

.choice-card:focus-visible {
  outline: 4px solid rgba(17, 24, 39, 0.2);
  outline-offset: 6px;
}

.choice-card.is-flipped {
  transform: rotateY(180deg);
}

.choice-card.is-locked:not(.is-flipped) {
  opacity: 0.34;
  filter: grayscale(0.55);
  cursor: not-allowed;
}

.choice-card[disabled] {
  cursor: default;
}

.card-back,
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  backface-visibility: hidden;
  box-shadow: var(--shadow);
}

.card-back {
  color: white;
  font-size: clamp(88px, 18vw, 180px);
  font-weight: 900;
}

.card-a .card-back {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}

.card-b .card-back {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}

.card-face {
  padding: clamp(18px, 4vw, 36px);
  overflow: auto;
  background: white;
  color: var(--ink);
  transform: rotateY(180deg);
  font-size: clamp(20px, 3.3vw, 36px);
  line-height: 1.25;
  text-align: center;
  white-space: pre-wrap;
}

.status {
  min-height: 26px;
  margin-top: 20px;
  color: var(--muted);
  font-weight: 700;
}

.status.is-error {
  color: var(--red-dark);
}

.new-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 760px) {
  .app-shell {
    align-items: start;
  }

  h1 {
    font-size: 42px;
  }

  .option-form,
  .cards,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 230px;
  }

  .option-form button {
    width: 100%;
  }
}
