.trw-app,
.trw-hub,
.trw-supporting-content,
.trw-directory {
  --trw-ink: #0f172a;
  --trw-muted: #55637a;
  --trw-line: #e2e8f0;
  --trw-surface: #ffffff;
  --trw-soft: #f8fafc;
  --trw-primary: #2563eb;
  --trw-primary-dark: #1d4ed8;
  --trw-navy: #12294c;
  --trw-navy-deep: #091a33;
  --trw-pointer-red: #dc2626;
  --trw-radius: 22px;
  --trw-control-radius: 12px;
  --trw-control-height: 42px;
  --trw-wheel-max: 560px;
  --trw-shadow: 0 22px 60px rgba(15, 23, 42, .09), 0 3px 12px rgba(15, 23, 42, .05);
  --trw-glow-a: rgba(37, 99, 235, .08);
  --trw-glow-b: rgba(124, 58, 237, .07);
}

.trw-profile--professional { --trw-primary: #2563eb; --trw-primary-dark: #1d4ed8; --trw-profile-a: #2563eb; --trw-profile-b: #7c3aed; }
.trw-profile--celebration { --trw-primary: #db2777; --trw-primary-dark: #be185d; --trw-profile-a: #f97316; --trw-profile-b: #db2777; --trw-glow-a:rgba(249,115,22,.10); --trw-glow-b:rgba(219,39,119,.08); }
.trw-profile--classroom { --trw-primary: #0891b2; --trw-primary-dark: #0e7490; --trw-profile-a: #0891b2; --trw-profile-b: #16a34a; --trw-glow-a:rgba(8,145,178,.09); --trw-glow-b:rgba(22,163,74,.07); }
.trw-profile--decision { --trw-primary: #4f46e5; --trw-primary-dark: #4338ca; --trw-profile-a: #4f46e5; --trw-profile-b: #2563eb; --trw-glow-a:rgba(79,70,229,.09); --trw-glow-b:rgba(37,99,235,.07); }
.trw-profile--party { --trw-primary: #9333ea; --trw-primary-dark: #7e22ce; --trw-profile-a: #9333ea; --trw-profile-b: #e11d48; --trw-glow-a:rgba(147,51,234,.10); --trw-glow-b:rgba(225,29,72,.08); }
.trw-profile--everyday { --trw-primary: #0f766e; --trw-primary-dark: #115e59; --trw-profile-a: #0f766e; --trw-profile-b: #ca8a04; --trw-glow-a:rgba(15,118,110,.09); --trw-glow-b:rgba(202,138,4,.07); }

.trw-app,
.trw-app * { box-sizing: border-box; }

.trw-app {
  position: relative;
  width: min(1180px, calc(100% - 24px));
  max-width: 100%;
  margin: 20px auto 40px;
  padding: clamp(16px, 2.6vw, 32px);
  overflow: hidden;
  color: var(--trw-ink);
  background:
    radial-gradient(circle at 0 0, var(--trw-glow-a), transparent 32%),
    radial-gradient(circle at 100% 0, var(--trw-glow-b), transparent 30%),
    var(--trw-surface);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--trw-radius);
  box-shadow: var(--trw-shadow);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  isolation: isolate;
}

.trw-app::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--trw-profile-a, #2563eb), var(--trw-profile-b, #7c3aed));
}

.trw-app__intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.trw-eyebrow,
.trw-editor__label {
  display: block;
  margin-bottom: 5px;
  color: var(--trw-primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.trw-app__title {
  margin: 0 !important;
  color: var(--trw-ink);
  font-size: clamp(25px, 3.4vw, 38px) !important;
  font-weight: 850 !important;
  line-height: 1.12 !important;
  letter-spacing: -.032em;
}

.trw-app__lead { max-width: 720px; }
.trw-app__lead p {
  margin: 8px 0 0;
  color: #475569;
  font-size: clamp(15px, 1.6vw, 17px);
}

.trw-icon-button,
.trw-secondary,
.trw-text-button,
.trw-spin,
.trw-editor__toggle {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.trw-icon-button {
  display: grid;
  flex: 0 0 auto;
  width: var(--trw-control-height);
  height: var(--trw-control-height);
  place-items: center;
  color: #334155;
  background: #fff;
  border: 1px solid var(--trw-line);
  border-radius: var(--trw-control-radius);
  font-size: 20px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.trw-icon-button:hover { transform: translateY(-1px); border-color: #93c5fd; box-shadow: 0 8px 18px rgba(37, 99, 235, .1); }

.trw-app__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: clamp(18px, 2.6vw, 34px);
  align-items: start;
}

.trw-stage { min-width: 0; text-align: center; }

/* ---------- Wheel ---------- */

.trw-wheel-wrap {
  position: relative;
  width: min(100%, var(--trw-wheel-max));
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
}

.trw-wheel {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 16px 30px rgba(9, 26, 51, .16);
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
}

.trw-wheel:focus-visible { box-shadow: 0 0 0 5px rgba(37, 99, 235, .32), 0 16px 30px rgba(9, 26, 51, .16); }

.trw-pointer {
  position: absolute;
  z-index: 4;
  top: -8%;
  left: 50%;
  width: 10%;
  height: 12%;
  min-width: 26px;
  pointer-events: none;
  transform: translateX(-50%);
  transform-origin: 50% 14%;
}

.trw-pointer svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(9, 26, 51, .32)); }

@keyframes trw-pointer-hit-a {
  0% { transform: translateX(-50%) rotate(0); }
  35% { transform: translateX(-50%) rotate(5.5deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

@keyframes trw-pointer-hit-b {
  0% { transform: translateX(-50%) rotate(0); }
  35% { transform: translateX(-50%) rotate(5.5deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

.trw-pointer.is-hit-a { animation: trw-pointer-hit-a .17s ease-out; }
.trw-pointer.is-hit-b { animation: trw-pointer-hit-b .17s ease-out; }

/* ---------- Centre control ---------- */

.trw-spin--center {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: flex;
  width: clamp(58px, 20%, 108px);
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 6px;
  color: var(--trw-navy);
  background: radial-gradient(circle at 50% 22%, #ffffff, #f1f5f9);
  border: 2px solid var(--trw-navy);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(9, 26, 51, .22);
  transform: translate(-50%, -50%);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.trw-spin--center:hover { background: radial-gradient(circle at 50% 22%, #ffffff, #e8f0ff); transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 14px 30px rgba(9, 26, 51, .28); }
.trw-spin--center:active { transform: translate(-50%, -50%) scale(.97); box-shadow: 0 6px 16px rgba(9, 26, 51, .24); }
.trw-app.is-spinning .trw-spin--center { transform: translate(-50%, -50%) scale(.98); }

.trw-spin:focus-visible,
.trw-secondary:focus-visible,
.trw-text-button:focus-visible,
.trw-icon-button:focus-visible,
.trw-editor__toggle:focus-visible { outline: 3px solid rgba(37, 99, 235, .5); outline-offset: 3px; }
.trw-spin:disabled { cursor: wait; opacity: .78; }

.trw-spin__label { font-size: clamp(13px, 1.6vw, 17px); font-weight: 850; letter-spacing: .02em; line-height: 1.1; text-transform: uppercase; }
.trw-spin__hint { margin-top: 2px; color: var(--trw-muted); font-size: 10px; letter-spacing: .01em; line-height: 1; }

/* ---------- Result ---------- */

.trw-result {
  position: relative;
  min-height: 84px;
  margin: 18px auto 12px;
  padding: 14px 18px;
  overflow: visible;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid var(--trw-line);
  border-radius: 16px;
}

.trw-result__label { display: block; color: var(--trw-muted); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.trw-result__value { display: block; margin-top: 3px; overflow-wrap: anywhere; color: var(--trw-ink); font-size: clamp(21px, 3vw, 30px); font-weight: 800; line-height: 1.2; }
.trw-result.is-waiting .trw-result__value { color: var(--trw-muted); font-size: 17px; font-weight: 650; }
.trw-result.is-winner { animation: trw-result-pop .42s cubic-bezier(.2, .9, .2, 1); border-color: var(--trw-primary); box-shadow: 0 12px 30px var(--trw-glow-a); }

@keyframes trw-result-pop {
  0% { transform: scale(.96); opacity: .55; }
  75% { transform: scale(1.015); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Button system ---------- */

.trw-stage__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.trw-secondary {
  display: inline-flex;
  min-height: var(--trw-control-height);
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #334155;
  background: #fff;
  border: 1px solid var(--trw-line);
  border-radius: var(--trw-control-radius);
  font-size: 14px;
  font-weight: 700;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.trw-secondary:hover,
.trw-secondary.is-active { color: var(--trw-primary-dark); background: #eff6ff; border-color: #93c5fd; }
.trw-secondary:disabled { cursor: wait; opacity: .5; }

.trw-text-button {
  display: inline-flex;
  min-height: 34px;
  padding: 0 8px;
  align-items: center;
  color: var(--trw-primary-dark);
  background: transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
}
.trw-text-button:hover { background: #eff6ff; }

/* ---------- Choices editor ---------- */

.trw-editor {
  min-width: 0;
  padding: 16px;
  background: rgba(248, 250, 252, .85);
  border: 1px solid var(--trw-line);
  border-radius: 18px;
}

.trw-editor__toggle {
  display: none;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--trw-ink);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: var(--trw-control-radius);
  font-size: 15px;
  font-weight: 750;
}

.trw-editor__toggle-chevron { color: var(--trw-primary-dark); font-size: 13px; transition: transform .18s ease; }
.trw-editor.is-open .trw-editor__toggle-chevron { transform: rotate(180deg); }

.trw-editor__header,
.trw-editor__footer,
.trw-history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trw-editor__header { margin-bottom: 10px; }
.trw-editor__label { display: inline; margin: 0 8px 0 0; color: #334155; }
.trw-count { color: var(--trw-muted); font-size: 12px; font-weight: 700; }
.trw-editor__tools { display: flex; gap: 6px; }

.trw-items {
  display: block;
  width: 100%;
  min-height: 268px;
  max-height: 460px;
  padding: 13px 14px;
  resize: vertical;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: var(--trw-control-radius);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
  font: 500 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.trw-items:focus { border-color: #60a5fa; outline: 3px solid rgba(37, 99, 235, .16); }

.trw-editor__footer { margin-top: 8px; color: var(--trw-muted); font-size: 12px; }

.trw-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--trw-line);
}

.trw-history__header strong { font-size: 13px; }
.trw-history ol { max-height: 195px; margin: 8px 0 0 !important; padding: 0 !important; overflow: auto; list-style: none !important; }
.trw-history li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid #edf2f7; font-size: 13px; }
.trw-history li span { overflow-wrap: anywhere; font-weight: 650; }
.trw-history li small { flex: 0 0 auto; color: var(--trw-muted); }

.trw-privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  color: var(--trw-muted);
  font-size: 12.5px;
  text-align: center;
}

.trw-confetti {
  position: absolute;
  z-index: 20;
  top: 28px;
  left: 50%;
  width: 7px;
  height: 12px;
  pointer-events: none;
  animation: trw-confetti 850ms cubic-bezier(.15, .8, .25, 1) forwards;
}

@keyframes trw-confetti {
  from { opacity: 1; transform: translate(-50%, 0) rotate(0); }
  to { opacity: 0; transform: translate(calc(-50% + var(--trw-x)), var(--trw-y)) rotate(var(--trw-r)); }
}

/* ---------- Supporting content ---------- */

.trw-supporting-content { width: min(960px, calc(100% - 32px)); margin: 0 auto 48px; color: #334155; }
.trw-copy { font-size: 17px; line-height: 1.75; }
.trw-copy h2 { margin-top: 38px; color: var(--trw-ink); font-size: clamp(24px, 3vw, 32px); letter-spacing: -.025em; }

.trw-faq { margin-top: 40px; }
.trw-faq h2,
.trw-related h2 { margin-bottom: 16px; color: var(--trw-ink); font-size: clamp(24px, 3vw, 30px); letter-spacing: -.025em; }
.trw-faq details { margin-bottom: 10px; background: #fff; border: 1px solid var(--trw-line); border-radius: 13px; }
.trw-faq summary { padding: 15px 18px; color: var(--trw-ink); cursor: pointer; font-weight: 750; }
.trw-faq summary:focus-visible { outline: 3px solid rgba(37, 99, 235, .5); outline-offset: 2px; }
.trw-faq details > div { padding: 0 18px 16px; color: #475569; }
.trw-faq details > div p:last-child { margin-bottom: 0; }

.trw-related { margin-top: 40px; }
.trw-related__grid,
.trw-directory__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.trw-directory__grid { grid-template-columns: repeat(var(--trw-directory-columns, 3), minmax(0, 1fr)); }
.trw-related a,
.trw-directory a { display: grid; min-width: 0; padding: 17px; color: var(--trw-ink); background: #fff; border: 1px solid var(--trw-line); border-radius: 14px; text-decoration: none !important; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.trw-related a:hover,
.trw-directory a:hover { transform: translateY(-2px); border-color: #93c5fd; box-shadow: 0 12px 24px rgba(37, 99, 235, .09); }
.trw-related a:focus-visible,
.trw-directory a:focus-visible { outline: 3px solid rgba(37, 99, 235, .5); outline-offset: 3px; }
.trw-related a > span,
.trw-directory a > span { color: var(--trw-primary); font-size: 22px; }
.trw-related a strong,
.trw-directory a strong { margin-top: 8px; font-size: 15px; }
.trw-related a small,
.trw-directory a small { margin-top: 5px; color: var(--trw-muted); line-height: 1.45; }

.trw-directory { width: min(1100px, calc(100% - 32px)); margin: 28px auto; }

body.trw-hide-legacy-wheel #wheel-container { display: none !important; }

.trw-toast {
  position: fixed;
  z-index: 999999;
  right: 20px;
  bottom: 20px;
  padding: 11px 16px;
  color: #fff;
  background: #0f172a;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.trw-toast.is-visible { opacity: 1; transform: translateY(0); }

.trw-app:fullscreen {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  border-radius: 0;
}
.trw-app:fullscreen .trw-wheel-wrap { width: min(100%, 60vh); }

.trw-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Tablet: stack before either column becomes cramped ---------- */

@media (max-width: 1180px) {
  .trw-app { --trw-wheel-max: 500px; }
}

@media (max-width: 900px) {
  .trw-app {
    --trw-wheel-max: 440px;
    width: min(100% - 16px, 760px);
    margin-top: 12px;
    padding: 16px 14px 18px;
    border-radius: 18px;
  }
  .trw-app__workspace { grid-template-columns: 1fr; gap: 18px; }
  .trw-stage { order: 0; }
  .trw-editor { order: 1; padding: 12px; }
  .trw-editor__toggle { display: flex; }
  .trw-editor__body { display: none; }
  .trw-editor.is-open .trw-editor__body { display: block; margin-top: 12px; }
  .trw-items { min-height: 150px; max-height: 260px; }
  .trw-related__grid,
  .trw-directory__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile ---------- */

@media (max-width: 560px) {
  .trw-app {
    --trw-wheel-max: 380px;
    --trw-control-height: 44px;
    margin-bottom: 28px;
    padding: 14px 12px 16px;
  }
  .trw-app__intro { margin-bottom: 14px; gap: 10px; }
  .trw-app__title { font-size: 26px !important; }
  .trw-app__lead p { font-size: 15px; }
  .trw-icon-button { width: 40px; height: 40px; font-size: 18px; }
  .trw-result { min-height: 72px; margin: 14px auto 10px; padding: 11px 14px; }
  .trw-result__value { font-size: 22px; }
  .trw-result.is-waiting .trw-result__value { font-size: 16px; }
  .trw-stage__actions { gap: 6px; }
  .trw-secondary { flex: 1 1 40%; padding: 0 10px; font-size: 13px; }
  .trw-editor__footer { align-items: flex-start; flex-direction: column; gap: 3px; }
  .trw-privacy-note { margin-top: 14px; text-align: center; }
  .trw-related__grid,
  .trw-directory__grid { grid-template-columns: 1fr; }
  .trw-copy { font-size: 16px; }
  .trw-copy h2 { margin-top: 28px; }
  .trw-faq,
  .trw-related { margin-top: 30px; }
}

@media (max-width: 380px) {
  .trw-app { --trw-wheel-max: 100%; }
  .trw-spin__hint { display: none; }
}

/* ---------- Landscape phones ---------- */

@media (max-height: 560px) and (orientation: landscape) {
  .trw-app { --trw-wheel-max: 62vh; }
  .trw-result { min-height: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  .trw-app *,
  .trw-app *::before,
  .trw-app *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Breadcrumbs and hubs ---------- */

.trw-breadcrumb {
  width: min(1180px, calc(100% - 24px));
  margin: 18px auto -8px;
  color: var(--trw-muted);
  font-size: 13px;
}

.trw-breadcrumb a { color: #475569; text-decoration: none; }
.trw-breadcrumb a:hover { color: #0f172a; text-decoration: underline; }
.trw-breadcrumb span { margin: 0 7px; }

.trw-hub {
  width: min(1180px, calc(100% - 24px));
  margin: 28px auto 52px;
  color: var(--trw-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.trw-hub__header {
  position: relative;
  padding: clamp(22px, 4.4vw, 50px);
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--trw-profile-a, #2563eb) 9%, white), color-mix(in srgb, var(--trw-profile-b, #7c3aed) 7%, white));
  border: 1px solid var(--trw-line);
  border-radius: var(--trw-radius);
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
  .trw-hub__header { background: #f8fafc; }
}

.trw-hub__header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--trw-profile-a, #2563eb), var(--trw-profile-b, #7c3aed));
}

.trw-hub__header h2 {
  max-width: 760px;
  margin: 4px 0 12px !important;
  color: var(--trw-ink);
  font-size: clamp(30px, 4.6vw, 54px) !important;
  line-height: 1.05 !important;
  letter-spacing: -.042em;
}

.trw-hub__lead { max-width: 760px; color: #475569; font-size: clamp(16px, 2vw, 20px); }
.trw-hub__lead p { margin: 0; }

.trw-hub__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.trw-hub-card {
  display: flex;
  min-height: 210px;
  padding: 22px;
  flex-direction: column;
  color: var(--trw-ink) !important;
  background: #fff;
  border: 1px solid var(--trw-line);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
  text-decoration: none !important;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.trw-hub-card:hover { transform: translateY(-3px); border-color: var(--trw-primary); box-shadow: 0 16px 34px rgba(15, 23, 42, .09); }
.trw-hub-card:focus-visible { outline: 3px solid rgba(37, 99, 235, .5); outline-offset: 3px; }
.trw-hub-card__icon { display: grid; width: 42px; height: 42px; margin-bottom: 18px; place-items: center; color: #fff; background: var(--trw-primary); border-radius: 13px; font-size: 23px; }
.trw-hub-card strong { font-size: 19px; line-height: 1.25; }
.trw-hub-card small { display: block; margin: 8px 0 20px; color: var(--trw-muted); font-size: 14px; line-height: 1.55; }
.trw-hub-card > span:last-child { margin-top: auto; color: var(--trw-primary-dark); font-size: 13px; font-weight: 800; }
.trw-hub__copy { max-width: 820px; margin: 36px auto 0; }

@media (max-width: 820px) {
  .trw-hub__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .trw-breadcrumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trw-hub__grid { grid-template-columns: 1fr; }
  .trw-hub-card { min-height: 0; padding: 18px; }
}
