:root {
  --v2-chip-bg: rgba(255, 226, 143, 0.24);
  --v2-chip-selected: rgba(255, 219, 95, 0.34);
  --v2-chip-shadow: 0 8px 16px rgba(48, 22, 5, 0.1);
}

.v2-layout {
  display: grid;
  gap: 18px;
}

.v2-card {
  border: 1px solid rgba(76, 37, 10, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), rgba(111, 61, 17, 0.08));
  box-shadow:
    inset 0 1px 0 rgba(255, 237, 168, 0.5),
    inset 0 -1px 0 rgba(72, 36, 10, 0.22),
    inset 0 0 22px rgba(74, 36, 10, 0.08);
  padding: 22px;
}

.v2-card-header {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(74, 36, 10, 0.22);
  box-shadow: 0 1px 0 rgba(255, 233, 163, 0.36);
}

.v2-card-header h2,
.v2-card-header h3 {
  margin: 0;
}

.v2-card-header p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 750;
  line-height: 1.45;
}

.v2-required-badge {
  width: fit-content;
  padding: 6px 9px;
  border: 1px solid rgba(75, 36, 9, 0.2);
  border-radius: 8px;
  background: rgba(255, 223, 137, 0.34);
  color: rgba(42, 22, 8, 0.86);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.v2-choice-grid.v2-choice-grid-small {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.v2-choice-grid.v2-choice-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v2-choice {
  appearance: none;
  display: grid;
  gap: 8px;
  min-height: 92px;
  width: 100%;
  padding: 13px;
  border: 1px solid rgba(76, 37, 10, 0.34);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(180deg, var(--v2-chip-bg), rgba(88, 43, 12, 0.1));
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 174, 0.45),
    inset 0 -1px 0 rgba(72, 35, 9, 0.18),
    0 7px 12px rgba(48, 22, 5, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.v2-choice:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(200, 149, 47, 0.58);
}

.v2-choice.is-selected {
  border-color: rgba(165, 111, 29, 0.78);
  background: linear-gradient(180deg, var(--v2-chip-selected), rgba(108, 133, 58, 0.16));
  box-shadow:
    inset 0 0 0 2px rgba(255, 221, 104, 0.24),
    inset 0 0 26px rgba(96, 49, 13, 0.13),
    var(--v2-chip-shadow);
}

.v2-choice strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.12;
}

.v2-choice span {
  color: rgba(42, 22, 8, 0.84);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.v2-character-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v2-character-card {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  min-height: 130px;
}

.v2-character-card .character-image-wrap {
  aspect-ratio: 2 / 3;
  height: 108px;
}

.v2-form-grid {
  display: grid;
  gap: 18px;
}

.v2-inline-field {
  display: grid;
  gap: 8px;
}

.v2-inline-field textarea,
.v2-inline-field input {
  width: 100%;
  border: 1px solid rgba(67, 32, 8, 0.26);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 234, 166, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 245, 197, 0.55);
  padding: 12px 13px;
  resize: vertical;
}

.v2-inline-field span {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

.v2-spaced-field {
  margin-top: 16px;
}

.v2-hidden {
  display: none !important;
}

.v2-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(74, 36, 10, 0.22);
  border-radius: 8px;
  background: rgba(255, 234, 166, 0.24);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.5;
  white-space: pre-wrap;
}

.v2-result {
  display: grid;
  gap: 14px;
}

.v2-story-output {
  max-height: 460px;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(74, 36, 10, 0.22);
  border-radius: 8px;
  background: rgba(255, 239, 181, 0.48);
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
}

.v2-raw-output {
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(36, 18, 4, 0.08);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.v2-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.v2-status-line {
  color: var(--ink-soft);
  font-weight: 850;
}

@media (max-width: 760px) {
  .v2-choice-grid,
  .v2-choice-grid.v2-choice-grid-small,
  .v2-choice-grid.v2-choice-grid-wide,
  .v2-character-choice {
    grid-template-columns: 1fr;
  }

  .v2-character-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}
