:root {
  --vino: #68162f;
  --vino2: #851f43;
  --paper: #fff;
  --ink: #252228;
  --muted: #6d6870;
  --line: #ddd7da;
  --bg: #f5f2f3;
  --ok: #236b4b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Arial, Helvetica, sans-serif; line-height: 1.45; }
.masthead { height: 102px; background: #fff; border-bottom: 4px solid var(--vino); display: flex; align-items: center; justify-content: center; }
.masthead img { width: min(430px, 70vw); max-height: 72px; object-fit: contain; }
.container { width: min(1080px, calc(100% - 28px)); margin: 34px auto 80px; }
.narrow { max-width: 680px; margin-top: 10vh; }
.hero { background: linear-gradient(135deg, var(--vino), #3d0c1c); color: #fff; border-radius: 18px; padding: 34px 38px; box-shadow: 0 14px 36px #4a102326; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.65rem); line-height: 1.08; margin: .25rem 0 1rem; }
.hero p { max-width: 760px; margin: 0; color: #f4e9ed; }
.hero .visitor-badge { max-width: none; margin-top: 18px; padding: 10px 13px; border: 1px solid #ffffff45; border-radius: 9px; background: #ffffff12; font-size: .84rem; overflow-wrap: anywhere; }
.visitor-badge code { color: #fff; font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 26px 30px; margin: 22px 0; box-shadow: 0 5px 18px #4f26300d; }
.card h2 { color: var(--vino); margin: 0 0 20px; font-size: 1.3rem; }
.hint { color: var(--muted); }
.step-error { margin: -4px 0 16px; padding: 11px 14px; border: 1px solid #d9a4b4; border-radius: 9px; background: #fff0f4; color: #7a1735; font-weight: 700; }
.control-row.missing-answer, .open.missing-answer, .stage-options.missing-answer { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; background: #68162f10; box-shadow: inset 4px 0 0 #9b3657; }
.likert-table tr.missing-answer td { background: #68162f10; }
.likert-table tr.missing-answer .question-text { box-shadow: inset 4px 0 0 #9b3657; }
.missing-answer select, .missing-answer input, .missing-answer textarea { border-color: #b54c6d; }
.wizard-progress { margin: 22px 0 12px; padding: 16px 20px; border-radius: 13px; background: #fff; border: 1px solid var(--line); box-shadow: 0 5px 18px #4f26300d; }
.wizard-progress div { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.wizard-progress strong { color: var(--vino); }
.wizard-progress span { color: var(--muted); text-align: right; }
.wizard-progress progress { display: block; width: 100%; height: 10px; border: 0; border-radius: 20px; overflow: hidden; background: #e8e1e4; }
.wizard-progress progress::-webkit-progress-bar { background: #e8e1e4; }
.wizard-progress progress::-webkit-progress-value { background: var(--vino); }
.wizard-progress progress::-moz-progress-bar { background: var(--vino); }

input, select, textarea { width: 100%; border: 1px solid #bdb5b9; border-radius: 9px; padding: 11px 12px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid #68162f22; border-color: var(--vino); }
textarea { resize: vertical; }

.stage-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.stage-card { cursor: pointer; }
.stage-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stage-card span { min-height: 68px; display: flex; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 14px 18px; font-weight: 700; background: #fff; transition: .15s ease; }
.stage-card input:checked + span { color: #fff; border-color: var(--vino); background: var(--vino); box-shadow: 0 5px 15px #68162f30; }
.stage-card input:focus-visible + span { outline: 3px solid #b65c7d; outline-offset: 2px; }

.control-list { display: grid; }
.control-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 42%); align-items: center; gap: 28px; padding: 16px 0; border-top: 1px solid #eee9eb; font-weight: 700; }
.control-row:first-child { border-top: 0; }
.control-row > span:first-child small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.textarea-row { align-items: start; }

.range-control { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: center; gap: 14px; }
input[type="range"] { --value: 50%; appearance: none; height: 44px; border: 0; padding: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 9px; border-radius: 10px; background: linear-gradient(to right, var(--vino) var(--value), #ddd5d8 var(--value)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 30px; height: 30px; margin-top: -10px; border: 3px solid #fff; border-radius: 50%; background: var(--vino); box-shadow: 0 2px 7px #0005; }
input[type="range"]::-moz-range-track { height: 9px; border-radius: 10px; background: #ddd5d8; }
input[type="range"]::-moz-range-progress { height: 9px; border-radius: 10px; background: var(--vino); }
input[type="range"]::-moz-range-thumb { width: 25px; height: 25px; border: 3px solid #fff; border-radius: 50%; background: var(--vino); box-shadow: 0 2px 7px #0005; }
.range-control output { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--vino); color: #fff; font-size: 1.1rem; font-weight: 700; }

.scale-help { position: sticky; top: 8px; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: center; gap: 28px; background: #fff8da; border: 1px solid #e0cf8b; border-radius: 10px; padding: 10px 42px; margin: 20px 0; box-shadow: 0 5px 12px #00000012; }
.scale-description { min-width: 0; }
.scale-description strong { display: block; color: var(--vino); }
.scale-description span { display: block; margin-top: 2px; color: #564c36; font-size: .78rem; line-height: 1.3; }
.scale-position { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.scale-position span { display: grid; place-items: center; width: 42px; height: 36px; border-radius: 8px; background: var(--vino); color: #fff; font-weight: 700; }
.table-scroll { width: 100%; overflow-x: auto; }
.likert-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.question-column { width: auto; }
.answer-column { width: 250px; }
.likert-table th { padding: 10px 12px; background: #f3edef; color: var(--vino); text-align: left; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.likert-table th:last-child { text-align: right; }
.likert-table td { padding: 15px 12px; border-top: 1px solid #e8e2e5; vertical-align: middle; }
.question-text { overflow-wrap: anywhere; hyphens: auto; }
.question-text strong { color: var(--vino); }
.answer-cell { width: 250px; text-align: right; white-space: nowrap; }
.likert { display: inline-flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.likert label { display: block; cursor: pointer; }
.likert input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.likert span { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #bfb6ba; border-radius: 50%; font-weight: 700; background: #fff; }
.likert input:checked + span { background: var(--vino); border-color: var(--vino); color: #fff; }
.likert input:focus-visible + span { outline: 3px solid #b65c7d; outline-offset: 2px; }
.open { display: grid; gap: 8px; margin: 22px 0; }

.submit-bar { background: #fff; border-top: 4px solid var(--vino); padding: 22px 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; position: sticky; bottom: 0; box-shadow: 0 -8px 28px #3a18231f; }
.submit-bar p { margin: 0; color: var(--muted); }
button, .button-link { border: 0; border-radius: 10px; background: var(--vino); color: #fff; padding: 13px 22px; font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; }
button:hover, .button-link:hover { background: var(--vino2); }
.wizard-nav { position: sticky; bottom: 0; z-index: 6; display: grid; grid-template-columns: minmax(120px, auto) 1fr minmax(120px, auto); align-items: center; gap: 14px; padding: 18px 22px; border-top: 4px solid var(--vino); background: #fff; box-shadow: 0 -8px 28px #3a18231f; }
.wizard-nav > span { text-align: center; color: var(--muted); font-weight: 700; }
.wizard-nav #submit-survey { grid-column: 3; }
.secondary-button { background: #eee8ea; color: var(--vino); }
.secondary-button:hover { background: #e1d6da; }
button:disabled { opacity: .45; cursor: not-allowed; }
.alert { margin: 20px 0; background: #ffe8e8; color: #7e1616; border: 1px solid #e4a9a9; border-radius: 10px; padding: 14px 18px; }
.success { text-align: center; padding: 52px; }
.checkmark { margin: auto; width: 70px; height: 70px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2rem; }
.receipt { color: var(--muted); margin-bottom: 28px; }
code { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .container { width: min(100% - 18px, 1080px); }
  .card { padding: 21px 12px; }
  .hero { padding: 28px 22px; }
  .stage-options { grid-template-columns: 1fr; }
  .control-row { grid-template-columns: 1fr; gap: 11px; }
  .answer-column, .answer-cell { width: 178px; }
  .likert-table th, .likert-table td { padding-left: 8px; padding-right: 8px; }
  .likert { gap: 5px; }
  .likert span { width: 30px; height: 42px; border-radius: 9px; }
  .scale-help { grid-template-columns: minmax(0, 1fr) 178px; gap: 8px; padding: 8px 20px; }
  .scale-description span { display: none; }
  .scale-position { gap: 5px; }
  .scale-position span { width: 30px; height: 34px; }
  .submit-bar { position: static; flex-direction: column; align-items: stretch; }
  .submit-bar button { width: 100%; }
  .wizard-progress div { display: block; }
  .wizard-progress span { display: block; text-align: left; margin-top: 2px; }
  .wizard-nav { grid-template-columns: 1fr auto 1fr; padding: 14px 10px; gap: 8px; }
  .wizard-nav button { padding-left: 12px; padding-right: 12px; }
}
