/* Editor de encuestas: controles compactos y pista como centro visual. */
:root {
    --canvas: #edf3f8;
    --surface: #ffffff;
    --ink: #17354f;
    --muted: #536b80;
    --line: #d5e2ec;
    --accent: #087f8c;
}
body { background: var(--canvas); color: var(--ink); font-family: 'Segoe UI', Arial, sans-serif; }
input, textarea, button { font-family: inherit; }
input, textarea { user-select: text; -webkit-user-select: text; }
.app-layout { height: 100dvh; padding: 20px; gap: 20px; }
.sidebar-controls { width: 370px; min-width: 340px; padding: 24px 20px; gap: 18px; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 28px #17354f08; scrollbar-width: thin; scrollbar-color: #b9ccd9 transparent; }
.header-title { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.header-title h1 { font-family: 'Bahnschrift', 'Arial Narrow', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.8px; }
.header-title span { text-transform: none; letter-spacing: .1px; font-size: .8rem; font-weight: 500; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.section-label { font-size: .7rem; color: var(--muted); letter-spacing: 1.2px; }
.survey-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.survey-btn { min-height: 68px; padding: 12px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); transition: background .15s, border-color .15s; }
.survey-btn:hover { background: #eef7fa; border-color: var(--accent); transform: none; }
.survey-btn.active { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 -3px 0 #37c4c2; }
.survey-logo { max-height: 42px; max-width: 100%; }
.survey-meta-card { background: #f2f7fb; border: 1px solid var(--line); padding: 14px; border-radius: 12px; }
.meta-avatar { background: var(--accent); font-family: 'Bahnschrift', sans-serif; border-radius: 10px; }
.meta-info-title .sub { color: var(--accent); }
.meta-info-title input { font-family: inherit; font-size: 1rem; color: var(--ink); }
.meta-details-row { border-color: var(--line); gap: 6px; }
.meta-item input { width: 100%; min-width: 0; }
.lane-control-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.lane-card-top { gap: 6px; }
.candidate-name-input { min-width: 0; width: 100%; font-size: .84rem; padding: 5px 3px; }
.percent-input-wrapper { width: 76px; flex-shrink: 0; border: 1px solid var(--line); background: #f2f7fb; padding: 5px 6px; }
.percent-number-input { font-size: .9rem; font-variant-numeric: tabular-nums; }
.draw-text-card .candidate-name-input, .draw-text-card textarea { background: #f2f7fb; border: 1px solid var(--line); padding: 8px 10px; font-weight: 500; }
.draw-text-field { gap: 6px; }
.toggle-mode-btn { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #f2f7fb; box-shadow: none; }
.toggle-mode-btn:hover { background: #e4eff5; color: var(--ink); border-color: #a5c1d2; }
#exportBtn { background: var(--accent); border-color: var(--accent); color: white; }
#exportBtn:hover { background: #066773; }
#exportBtn:disabled { opacity: .6; cursor: wait; }
.track-display-area { min-width: 0; flex-direction: column; background: #e2ecf4; border: 1px solid #c9dce9; border-radius: 20px; padding: 20px; gap: 16px; box-shadow: none; }
.preview-heading { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); }
.preview-heading h2 { font-family: 'Bahnschrift', 'Arial Narrow', sans-serif; font-size: 1rem; font-weight: 600; }
.preview-heading span { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.container { width: min(100%, calc(100dvh - 160px)); height: auto; flex: 0 0 auto; max-height: none; border-radius: 12px; box-shadow: 0 14px 40px #17354f16; }
.preview-help { font-size: .75rem; color: var(--muted); text-align: center; line-height: 1.5; }
:where(button, input, textarea):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.percent-input-wrapper:focus-within { border-color: var(--accent); }
@media (max-width: 900px) {
    .app-layout { height: auto; min-height: 100dvh; flex-direction: column; padding: 12px; gap: 12px; }
    .sidebar-controls { width: 100%; min-width: 0; height: auto; overflow: visible; order: 2; }
    .track-display-area { width: 100%; height: auto; flex: none; padding: 14px; order: 1; }
    .container { width: min(100%, 640px); }
    .survey-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    .sidebar-controls { padding: 18px 14px; }
    .survey-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .preview-heading { align-items: flex-start; }
    .preview-heading span { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Las dimensiones dependen de la pista, no del viewport. */
.container { container-type: inline-size; }
.percent-badge { opacity: 1; font-size: 1.15cqw; }
.circle-1 { font-size: 1.6cqw; }
.circle-2 { font-size: 1.8cqw; }
.circle-3 { font-size: 2.1cqw; }
.circle-4 { font-size: 2.4cqw; }
.circle-5 { font-size: 2.8cqw; }
.lane-circle.img-mode { transform: translate(-50%, calc(-50% - 11.23046875cqw)); }
.lane-circle.img-mode:hover { transform: translate(-50%, calc(-50% - 11.23046875cqw)) scale(1.1); }
.lane-circle.img-mode.is-dragging { transform: translate(-50%, calc(-50% - 11.23046875cqw)) scale(1.18); }

#saveChangesBtn { background: #17354f; border-color: #17354f; color: #ffffff; }
#saveChangesBtn:hover { background: #254d6b; }
.save-note { font-size: .75rem; line-height: 1.5; color: var(--muted); margin-top: -10px; }

.visual-mode-buttons { display: flex; gap: 10px; }
.visual-mode-btn { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #f2f7fb; font-size: 28px; cursor: pointer; }
.visual-mode-btn:hover { background: #e4eff5; border-color: var(--accent); }
.visual-mode-btn[aria-pressed="true"] { background: #d5eeef; border: 2px solid var(--accent); }
.lane-circle.runner-mode { transform: translate(-50%, -90%); }
.lane-circle.runner-mode:hover { transform: translate(-50%, -90%) scale(1.1); }
.lane-circle.runner-mode.is-dragging { transform: translate(-50%, -90%) scale(1.18); }
.circle-1.runner-mode { width: 28.8%; height: 28.8%; }

.circle-2.runner-mode { width: 34.56%; height: 34.56%; }
.circle-3.runner-mode { width: 37.44%; height: 37.44%; }
.circle-4.runner-mode { width: 40.32%; height: 40.32%; }

.preview-heading .preview-export-btn { width: auto; flex-shrink: 0; padding: 10px 14px; font-size: .8rem; }
.preview-heading > div { min-width: 0; }
.preview-heading > div > span { display: block; margin-top: 4px; text-align: left; }

/* Acción de descarga sobre la vista previa. */
.preview-heading #exportBtn {
    min-height: 46px;
    gap: 9px;
    padding: 11px 18px;
    background: #087f8c;
    border: 1px solid #066d78;
    border-radius: 12px;
    color: #ffffff;
    font-size: .875rem;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(8, 127, 140, .15);
    transition: background .15s ease, box-shadow .15s ease;
}
.preview-heading #exportBtn > span { color: inherit; font-size: inherit; font-weight: inherit; text-align: center; }
.preview-heading #exportBtn .export-icon { display: block; flex-shrink: 0; }
.preview-heading #exportBtn:hover:not(:disabled) { background: #066773; box-shadow: 0 4px 12px rgba(8, 127, 140, .22); }
.preview-heading #exportBtn:active:not(:disabled) { background: #055661; box-shadow: none; }
.preview-heading #exportBtn:disabled { opacity: .65; cursor: wait; box-shadow: none; }
.preview-heading #exportBtn:focus-visible { outline: 3px solid #087f8c; outline-offset: 4px; }
