/* Optional post-trial feedback. Kept in its own sheet so untouched portal
   surfaces remain unchanged; all visual values bind to the portal system. */
.tfs-overlay[hidden],.tfs-screen[hidden],.tfs-status[hidden]{display:none}
.tfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.tfs-overlay{
  position:fixed;inset:0;z-index:360;display:flex;align-items:center;justify-content:center;
  padding:24px;background:rgba(var(--sh)/.46);opacity:0;transition:opacity var(--t)
}
.tfs-overlay.is-open{opacity:1}
.tfs-modal{
  width:min(600px,100%);max-height:calc(100dvh - 48px);overflow:hidden;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-2xl);
  box-shadow:var(--shadow-xl);transform:translateY(10px) scale(.99);transition:transform var(--t),width var(--t)
}
.tfs-modal.is-closing{width:min(460px,100%)}
.tfs-overlay.is-open .tfs-modal{transform:none}
#trial-feedback-form{margin:0}
.tfs-screen{width:100%;max-height:calc(100dvh - 48px);display:flex;flex-direction:column;min-height:0}
.tfs-hero{
  position:relative;flex:0 0 auto;display:flex;flex-direction:column;gap:10px;overflow:hidden;
  padding:28px 30px 26px;color:white;
  background:linear-gradient(135deg,var(--brand-700) 0%,var(--brand-600) 52%,var(--brand-500) 100%)
}
.tfs-hero::after{
  content:"";position:absolute;inset:0;pointer-events:none;
  background-image:radial-gradient(circle at 84% -30%,rgba(255,255,255,.16),transparent 58%)
}
.tfs-hero-eyebrow{
  position:relative;z-index:1;color:rgba(255,255,255,.82);font-size:11px;font-weight:700;
  letter-spacing:.13em;text-transform:uppercase
}
.tfs-hero-title,.tfs-hero-question{position:relative;z-index:1;margin:0;color:white;font-family:var(--font-serif);font-weight:600;letter-spacing:-.01em}
.tfs-hero-title:focus,.tfs-hero-question:focus,.tfs-closing h2:focus{outline:none}
.tfs-hero-title{font-size:24px;line-height:1.2}
.tfs-hero-question{padding-right:26px;font-size:20px;line-height:1.3}
.tfs-close{
  position:absolute;z-index:3;top:9px;right:9px;width:44px;height:44px;display:grid;place-items:center;
  padding:0;border:0;border-radius:50%;background:transparent;color:white;box-shadow:none;cursor:pointer
}
.tfs-close::before{content:"";position:absolute;inset:6.5px;border-radius:50%;background:rgba(255,255,255,.18);transition:background var(--t)}
.tfs-close:hover::before{background:rgba(255,255,255,.32)}
.tfs-close svg{position:relative;width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tfs-progress{position:relative;z-index:1;height:4px;margin-top:6px;overflow:hidden;border-radius:var(--radius-pill);background:rgba(255,255,255,.25)}
.tfs-progress-fill{display:block;height:100%;border-radius:inherit;background:white}
.tfs-letter-body,.tfs-question-body{min-height:0;overflow-y:auto;overscroll-behavior:contain}
.tfs-letter-body{display:flex;flex-direction:column;gap:14px;padding:26px 30px 24px}
.tfs-letter-body p{margin:0;color:var(--fg-muted);font-size:14px;line-height:1.6}
.tfs-letter-body .tfs-signature,.tfs-signature{
  margin:0;color:var(--brand-700);font-family:var(--font-hand);font-size:27px;font-weight:500;line-height:1
}
.tfs-question-body{display:flex;flex-direction:column;gap:18px;padding:24px 30px 26px}
.tfs-helper{margin:0;color:var(--fg-subtle);font-size:12.5px;font-weight:500;line-height:1.35}
.tfs-footer{
  flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:14px 30px;border-top:1px solid var(--border-subtle);background:var(--bg-soft)
}
.tfs-dots{display:flex;align-items:center;gap:6px}
.tfs-dot{width:7px;height:7px;border:1px solid var(--border-strong);border-radius:50%;background:var(--bg-sunk)}
.tfs-dot.is-done{border-color:var(--brand-300);background:var(--brand-300)}
.tfs-dot.is-active{width:8px;height:8px;border-color:var(--brand-600);background:var(--brand-600)}
.tfs-actions{display:flex;align-items:center;gap:10px}
.tfs-btn{
  min-height:44px;padding:10px 19px;border-radius:var(--radius-pill);font-family:inherit;font-size:13.5px;
  font-weight:700;white-space:nowrap;cursor:pointer;transition:background var(--t),color var(--t),border-color var(--t),transform var(--t)
}
.tfs-btn-ghost{border:1.5px solid var(--border);background:transparent;color:var(--fg-muted)}
.tfs-btn-ghost:hover{background:var(--bg-sunk);color:var(--fg)}
.tfs-btn-primary{border:1.5px solid var(--brand-700);background:var(--brand-700);color:white}
.tfs-btn-primary:hover{border-color:var(--brand-800);background:var(--brand-800);transform:translateY(-1px)}
.tfs-btn-primary:disabled{cursor:wait;opacity:.65;transform:none}
.tfs-close:focus-visible,.tfs-btn:focus-visible,.tfs-tool-chip:has(input:focus-visible),.tfs-check-row:not(.tfs-other-row):has(input:focus-visible),.tfs-other-choice:has(input:focus-visible),.tfs-score-option:has(input:focus-visible),.tfs-star:has(input:focus-visible){outline:3px solid var(--brand-300);outline-offset:2px}

/* Question 1 */
.tfs-star-column{position:relative;width:260px;display:flex;flex-direction:column;gap:9px;align-self:center}
.tfs-stars{display:flex;align-items:center;gap:5px}
.tfs-star{position:relative;width:48px;height:44px;display:grid;place-items:center;flex:0 0 auto;border-radius:var(--radius-sm);transition:background var(--t),transform var(--t)}
.tfs-star:hover{background:var(--brand-100);transform:translateY(-1px)}
.tfs-star svg{width:44px;height:44px;display:block;overflow:visible}
.tfs-star-outline,.tfs-star-fill{stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.tfs-star-outline{fill:none;stroke:var(--border-strong)}
.tfs-star-fill{fill:var(--brand-600);stroke:var(--brand-600);opacity:0;transition:opacity var(--t)}
.tfs-star[data-fill="half"] .tfs-star-fill{opacity:1;clip-path:inset(0 50% 0 0)}
.tfs-star[data-fill="full"] .tfs-star-fill{opacity:1}
.tfs-star-hit{position:absolute;top:0;bottom:0;width:50%;cursor:pointer}
.tfs-star-hit-left{left:0}.tfs-star-hit-right{right:0}
.tfs-star-input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.tfs-end-labels{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--fg-subtle);font-size:12px;line-height:1.35}

/* Question 2 */
.tfs-tools-body{gap:16px}
.tfs-tool-groups{display:flex;flex-direction:column;gap:14px}
.tfs-tool-group{display:flex;flex-direction:column;gap:8px}
.tfs-tool-group-title{margin:0;color:var(--fg-subtle);font-size:11px;font-weight:700;letter-spacing:.06em;line-height:1.2;text-transform:uppercase}
.tfs-tool-grid{display:grid;grid-template-columns:repeat(2,max-content);gap:8px 16px;justify-content:start}
.tfs-tool-chip{
  position:relative;display:inline-flex;align-items:center;gap:8px;min-height:34px;padding:7px 13px 7px 9px;
  border:1.5px solid var(--border);border-radius:var(--radius-pill);background:var(--surface);color:var(--fg-muted);
  font-size:13px;font-weight:600;line-height:1.25;cursor:pointer;transition:border var(--t),color var(--t),background var(--t)
}
.tfs-tool-chip:hover{border-color:var(--border-strong);color:var(--fg)}
.tfs-tool-chip input,.tfs-check-row>input[type="checkbox"],.tfs-other-choice>input,.tfs-score-option input{position:absolute;opacity:0;pointer-events:none}
.tfs-chip-check{
  width:16px;height:16px;display:grid;place-items:center;flex:0 0 auto;border:1.5px solid var(--border-strong);
  border-radius:5px;background:transparent
}
.tfs-chip-check svg{width:10px;height:10px;fill:none;stroke:transparent;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round}
.tfs-tool-chip:has(input:checked){border-color:var(--brand-300);background:var(--brand-50);color:var(--brand-800)}
.tfs-tool-chip:has(input:checked) .tfs-chip-check{border-color:var(--brand-600);background:var(--brand-600)}
.tfs-tool-chip:has(input:checked) .tfs-chip-check svg{stroke:white}

/* Question 3 */
.tfs-support-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px 22px;align-items:start}
.tfs-check-row,.tfs-other-choice{
  position:relative;display:flex;align-items:flex-start;gap:10px;color:var(--fg-muted);font-size:13.5px;
  font-weight:500;line-height:1.35;cursor:pointer
}
.tfs-check-row:has(input:checked),.tfs-other-row:has(input:checked){color:var(--fg)}
.tfs-row-check{
  width:18px;height:18px;display:grid;place-items:center;flex:0 0 auto;margin-top:1px;
  border:1.5px solid var(--border-strong);border-radius:5px;background:var(--surface)
}
.tfs-row-check svg{width:11px;height:11px;fill:none;stroke:transparent;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.tfs-check-row:has(input:checked) .tfs-row-check,.tfs-other-choice:has(input:checked) .tfs-row-check{border-color:var(--brand-600);background:var(--brand-600)}
.tfs-check-row:has(input:checked) .tfs-row-check svg,.tfs-other-choice:has(input:checked) .tfs-row-check svg{stroke:white}
.tfs-other-row{display:flex;align-items:flex-start;gap:7px;cursor:default}
.tfs-other-choice{flex:0 0 auto}
.tfs-other-input{
  min-width:70px;height:22px;flex:1;padding:0 2px;border:0;border-bottom:1.5px solid var(--border);
  border-radius:0;background:transparent;color:var(--fg);font:inherit;font-size:13px;outline:none
}
.tfs-other-input:focus{border-bottom-color:var(--brand-600);box-shadow:0 2px 0 var(--brand-100)}

/* Questions 4 and 5 */
.tfs-textarea{
  width:100%;min-height:150px;padding:12px 14px;resize:none;border:1.5px solid var(--border);
  border-radius:var(--radius-md);background:var(--bg-soft);color:var(--fg);font:inherit;font-size:14.5px;line-height:1.55;outline:none
}
.tfs-textarea::placeholder{color:var(--fg-subtle)}
.tfs-textarea:focus{border-color:var(--brand-400);box-shadow:0 0 0 3px var(--brand-100)}
.tfs-score-grid{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:4px}
.tfs-score-option{position:relative;display:block;cursor:pointer}
.tfs-score-option span{
  height:44px;display:grid;place-items:center;border:1.5px solid var(--border);border-radius:var(--radius-md);
  background:var(--surface);color:var(--fg-muted);font-family:var(--font-serif);font-size:14px;font-weight:600;
  transition:border var(--t),color var(--t),background var(--t)
}
.tfs-score-option:hover span{border-color:var(--border-strong);color:var(--fg)}
.tfs-score-option input:checked+span{border-color:var(--brand-700);background:var(--brand-700);color:white}
.tfs-score-ends{margin-top:-10px}
.tfs-emoji{font-size:16px;line-height:1}
.tfs-status{margin:0;color:var(--err-fg);font-size:12px;line-height:1.4;text-align:center}

/* Closing */
.tfs-closing{align-items:center;gap:16px;padding:44px 40px 40px;text-align:center}
.tfs-closing-mark{width:52px;height:52px;display:grid;place-items:center;border-radius:50%;background:var(--brand-100);color:var(--brand-700)}
.tfs-closing-mark svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.tfs-closing h2{margin:0;color:var(--fg);font-family:var(--font-serif);font-size:20px;font-weight:600;letter-spacing:-.01em;line-height:1.35}
.tfs-closing>p:not(.tfs-signature){margin:0;color:var(--fg-muted);font-size:13.5px;line-height:1.5}
.tfs-closing a{color:var(--brand-700);font-weight:600;text-underline-offset:2px}
.tfs-closing .tfs-signature{font-size:24px}

@media (max-width:700px){
  .tfs-overlay{align-items:center;padding:10px}
  .tfs-modal,.tfs-screen{max-height:calc(100dvh - 20px)}
  .tfs-modal{border-radius:var(--radius-xl)}
  .tfs-hero{gap:8px;padding:18px 18px 16px}
  .tfs-hero-eyebrow{font-size:10px}
  .tfs-hero-title{font-size:18px}
  .tfs-hero-question{padding-right:32px;font-size:18px;line-height:1.25}
  .tfs-close{top:3px;right:3px}
  .tfs-progress{margin-top:4px}
  .tfs-letter-body{gap:11px;padding:18px}
  .tfs-letter-body p{font-size:12.5px;line-height:1.5}
  .tfs-letter-body .tfs-signature{font-size:23px}
  .tfs-question-body{gap:14px;padding:18px}
  .tfs-footer{padding:12px 16px}
  .tfs-btn{min-height:44px;padding:9px 16px;font-size:12.5px}
  .tfs-star-column{width:260px}
  .tfs-stars{gap:5px}
  .tfs-star{width:48px;height:44px}
  .tfs-star svg{width:44px;height:44px}
  .tfs-end-labels{font-size:11px}
  .tfs-tool-grid{grid-template-columns:1fr;gap:7px}
  .tfs-tool-chip{width:100%;min-height:40px;font-size:12px}
  .tfs-support-grid{grid-template-columns:1fr;gap:12px}
  .tfs-check-row,.tfs-other-choice{font-size:12.5px}
  .tfs-textarea{min-height:120px;font-size:13.5px}
  .tfs-score-grid{display:flex;flex-wrap:wrap;gap:5px}
  .tfs-score-option{flex:0 0 calc((100% - 20px)/5)}
  .tfs-score-option:nth-child(n+6){flex-basis:calc((100% - 25px)/6)}
  .tfs-score-option span{height:40px;font-size:13px}
  .tfs-score-ends{margin-top:-4px}
  .tfs-closing{padding:32px 26px}
}

@media (max-width:420px){
  .tfs-hero-question{font-size:17px}
  .tfs-letter-body,.tfs-question-body{padding:16px}
  .tfs-footer{padding:10px 14px}
  .tfs-dots{gap:5px}
  .tfs-actions{gap:7px}
  .tfs-btn{padding-inline:14px}
  .tfs-closing{padding:28px 22px}
}

:root[data-theme="dark"] .tfs-tool-chip:has(input:checked){border-color:var(--brand-500);background:var(--bg-sunk);color:var(--fg)}
:root[data-theme="dark"] .tfs-chip-check,
:root[data-theme="dark"] .tfs-row-check{border-color:var(--fg-subtle);background:var(--bg-sunk)}
:root[data-theme="dark"] .tfs-tool-chip:has(input:checked) .tfs-chip-check,
:root[data-theme="dark"] .tfs-check-row:has(input:checked) .tfs-row-check,
:root[data-theme="dark"] .tfs-other-choice:has(input:checked) .tfs-row-check{border-color:var(--brand-500);background:var(--brand-500)}
:root[data-theme="dark"] .tfs-chip-check svg,
:root[data-theme="dark"] .tfs-row-check svg{stroke:transparent}
:root[data-theme="dark"] .tfs-tool-chip:has(input:checked) .tfs-chip-check svg,
:root[data-theme="dark"] .tfs-check-row:has(input:checked) .tfs-row-check svg,
:root[data-theme="dark"] .tfs-other-choice:has(input:checked) .tfs-row-check svg{stroke:var(--bg)}
:root[data-theme="dark"] .tfs-star:hover{background:var(--bg-sunk)}
:root[data-theme="dark"] .tfs-star-outline{stroke:var(--fg-subtle)}
:root[data-theme="dark"] .tfs-star-fill{fill:var(--brand-500);stroke:var(--brand-500)}
:root[data-theme="dark"] .tfs-score-option span{border-color:var(--fg-subtle);background:var(--bg-sunk)}
:root[data-theme="dark"] .tfs-score-option input:checked+span,
:root[data-theme="dark"] .tfs-btn-primary{border-color:var(--brand-500);background:var(--brand-500);color:var(--bg)}
:root[data-theme="dark"] .tfs-btn-primary:hover{border-color:var(--brand-400);background:var(--brand-400)}
:root[data-theme="dark"] .tfs-textarea:focus{border-color:var(--brand-500);box-shadow:0 0 0 3px var(--brand-600)}
:root[data-theme="dark"] .tfs-other-input:focus{border-bottom-color:var(--brand-500);box-shadow:0 2px 0 var(--brand-600)}
:root[data-theme="dark"] .tfs-signature,
:root[data-theme="dark"] .tfs-closing a{color:var(--brand-400)}

@media (prefers-reduced-motion:reduce){
  .tfs-overlay,.tfs-modal,.tfs-close::before,.tfs-btn,.tfs-star,.tfs-star-fill,.tfs-tool-chip,.tfs-score-option span{transition:none}
}
