/* ==========================================================================
   Ubuntu Pro for Devices Scope Checker
   Mobile-first stylesheet. Two breakpoints only:
     base      : phone            (< 768px)
     >= 768px  : tablet
     >= 1200px : desktop split view (questions + sticky scope sidebar)
   ========================================================================== */

:root {
  --accent: #e95420;
  --accent-dark: #c34113;
  --aubergine: #2c001e;
  --purple: #772953;

  --retained: #0e8420;
  --conditional: #c46d00;
  --project: #c34113;
  --off: #666;

  --text: #111;
  --muted: #5f5f5f;
  --border: #d9d9d9;
  --surface: #fff;
  --surface-alt: #f7f7f7;

  --header-h: 48px;
  --statusbar-h: 62px;
  --tap: 44px;
  --radius: 2px;
  --shadow: 0 2px 6px rgba(0, 0, 0, .16);

  font-family: Ubuntu, "Noto Sans TC", "Noto Sans JP", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  /* Keep content clear of the fixed status bar on phone/tablet. */
  padding-bottom: calc(var(--statusbar-h) + env(safe-area-inset-bottom, 0px));
}

button, select, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

/* Every interactive control meets the 44px touch target guideline. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--accent-dark); }

.btn-quiet {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: none;
  color: #fff;
}

.btn-quiet:hover { background: rgba(255, 255, 255, .12); }

:where(a, button, select, summary):focus-visible,
.option-chip input:focus-visible + span {
  outline: 3px solid rgba(233, 84, 32, .55);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- app bar */

.appbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--aubergine);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .32);
}

.appbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
  padding-right: 10px;
}

.brand {
  display: flex;
  align-items: center;
  align-self: stretch;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.nav { display: none; }

.lang {
  display: flex;
  margin-left: auto;
  border-left: 1px solid rgba(255, 255, 255, .22);
}

.lang button {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 12px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, .22);
  background: transparent;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lang button:hover { background: rgba(255, 255, 255, .1); }

.lang button[aria-pressed="true"] {
  background: #fff;
  color: var(--aubergine);
  font-weight: 500;
}

/* ------------------------------------------------------------------ shell */

.shell {
  width: 100%;
  padding: 0 0 40px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 32px 20px 36px;
  background: linear-gradient(115deg, #2c001e 0%, #3d1233 62%, #772953 100%);
  color: #fff;
}

.eyebrow {
  color: #f99b79;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .03em;
}

.hero h1 {
  max-width: 900px;
  margin: 10px 0 14px;
  font-size: clamp(28px, 6vw, 62px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.hero p {
  max-width: 880px;
  margin: 0;
  color: #f3eaf0;
  font-size: 15px;
  line-height: 1.55;
}

.workbench { padding: 0 12px; }

/* -------------------------------------------------------------- questions */

.assessment {
  margin-top: 20px;
  padding: 20px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

#assessment { scroll-margin-top: calc(var(--header-h) + 12px); }

.section-head { margin-bottom: 20px; }

.section-head .eyebrow { color: var(--accent); }

.assessment h2 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.015em;
}

.section-note {
  max-width: 670px;
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}

.questions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.question {
  padding: 16px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--purple);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  min-width: 0;
}

.question legend,
.question-title {
  display: block;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
}

.help {
  margin: 6px 0 12px;
  color: #666;
  font-size: 13px;
  line-height: 1.45;
}

.option-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.option-chip {
  position: relative;
  cursor: pointer;
}

.option-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-chip span {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 12px;
  border: 1px solid #bfbfbf;
  border-radius: var(--radius);
  background: var(--surface);
  color: #333;
  font-size: 13px;
  line-height: 1.3;
}

.option-chip span:hover {
  border-color: var(--purple);
  background: var(--surface-alt);
}

.option-chip input:checked + span {
  border-color: var(--accent);
  background: #fdf0eb;
  box-shadow: inset 4px 0 0 var(--accent);
  color: #111;
  font-weight: 500;
}

/* Inline "what this answer changes" feedback, shown next to the question. */
.question-impact {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: #fdf0eb;
  color: #8b2e0e;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
}

.question-impact[hidden] { display: none; }

.affected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.affected-chip {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(233, 84, 32, .6);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.affected-chip:hover { background: #fdf0eb; }

.footer-note {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #ccc;
  color: #666;
  font-size: 12.5px;
  line-height: 1.55;
}

/* ------------------------------------------------------------ scope panel */

/* The sidebar only exists on desktop. Below 1200px the same cards are
   rendered inside the bottom sheet instead, so nothing covers the form. */
.scope-panel { display: none; }

.scope-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.scope-title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
}

.status-summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* ------------------------------------------------------------ scope cards */

.mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #d6d6d6;
  border-top: 3px solid var(--off);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.mini:hover {
  border-color: #bcbcbc;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  transform: translateY(-2px);
}

.mini-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.mini-no {
  flex: none;
  color: var(--purple);
  font-size: 12px;
  font-weight: 700;
}

.mini-title {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Two-line clamp keeps the reason readable instead of truncating to one
   ellipsised line the way the previous layout did. */
.mini-reason {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: #666;
  font-size: 11.5px;
  line-height: 1.35;
}

.mini-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: #555;
  font-size: 11px;
  font-weight: 500;
}

.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
}

.mini-more {
  margin-left: auto;
  color: var(--purple);
  font-size: 11px;
  font-weight: 500;
}

.mini-more::after {
  content: "›";
  margin-left: 3px;
  color: var(--accent);
}

[data-status="retained"] .status-dot { background: var(--retained); }
[data-status="conditional"] .status-dot { background: var(--conditional); }
[data-status="project"] .status-dot { background: var(--project); }
[data-status="off"] .status-dot { background: var(--off); }

.mini[data-status="retained"] { border-top-color: var(--retained); }
.mini[data-status="conditional"] { border-top-color: var(--conditional); }
.mini[data-status="project"] { border-top-color: var(--project); }
.mini[data-status="off"] {
  border-top-color: var(--off);
  border-color: #bdbdbd;
  background: #e3e3e3;
}

.mini[data-status="off"] .mini-title { color: #4a4a4a; }
.mini[data-status="off"] .mini-reason { color: #5c5c5c; }
.mini[data-status="off"] .mini-foot { color: #5a5a5a; font-weight: 600; }

/* Live feedback: a card flashes when an answer changes its status. */
@keyframes card-flash {
  0% { background: #fdf0eb; box-shadow: 0 0 0 3px rgba(233, 84, 32, .5); }
  100% { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
}

.mini.is-changed { animation: card-flash 1.4s ease-out; }

/* ------------------------------------------------------------- status bar */

.status-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--statusbar-h);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--aubergine);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .3);
  color: #fff;
}

.status-bar-copy {
  flex: 1;
  min-width: 0;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.count b { font-weight: 700; }

.change-note {
  margin-top: 4px;
  color: #f4d9cc;
  font-size: 11.5px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-note.is-new { animation: note-in .5s ease-out; }

@keyframes note-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- dialogs */

dialog {
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

/* Authored styles normally win over the UA stylesheet regardless of
   specificity, so ".sheet { display:flex }" below would otherwise force a
   closed dialog to stay visible and laid out on top of the page. Pin the
   closed state explicitly so it always wins. */
dialog:not([open]) { display: none !important; }

dialog::backdrop { background: rgba(44, 0, 30, .55); }

/* While a sheet is open, stop the page behind it from taking over the scroll
   gesture (touch scroll chaining is what made the sheet feel "stuck"). */
html.dialog-open,
html.dialog-open body { overflow: hidden; }

.sheet {
  position: fixed;
  /* Longhands, never the `inset` shorthand, and never a `bottom` anchor.
     On iOS WebKit a modal <dialog> lives in the top layer, where anchoring by
     `bottom` resolves against a box that can sit below the visible area (the
     browser toolbars / translation bar shrink the visual viewport without
     moving the layout viewport). The result was a sheet whose head was the
     only part on screen.

     Instead the dialog itself is an invisible container that exactly covers
     the *visual* viewport -- positioned by top/left and sized by width/height,
     driven by the VisualViewport API (see syncViewportMetrics in app.js), with
     a plain 100% fallback. The visible surface is .sheet-panel inside it. */
  top: var(--vv-top, 0px);
  left: var(--vv-left, 0px);
  width: var(--vv-width, 100%);
  /* Height cascade, weakest first. `100%` is the layout viewport, which on iOS
     still runs underneath the browser toolbars -- that is what left the sheet
     taller than the screen, so its body never overflowed and never scrolled.
     `100svh` is the viewport with the toolbars expanded, and the visual
     viewport is used only when it is smaller still (e.g. keyboard open). */
  height: 100%;
  height: min(var(--vv-height, 100svh), 100svh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: transparent;
  overflow: visible;
}

/* The surface the user actually sees. Bottom sheet on phones, centred card
   from 768px up. It can never outgrow .sheet, so it can never leave the
   screen. */
.sheet-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  overflow: hidden;
  /* Drag-to-dismiss: JS writes translateY while the finger is down, and this
     transition animates the snap-back or the slide-out. */
  transition: transform .22s ease;
}

.sheet-panel.is-dragging { transition: none; }

/* A sheet with another sheet stacked on top of it. Anchored at its bottom
   edge so the inset stays flush with the screen. */
.sheet-panel.is-behind {
  transform: scale(.96);
  transform-origin: 50% 100%;
}

/* Grab handle: the affordance for pulling the sheet away. Phone only -- from
   768px up the sheet is a centred dialog, not a bottom sheet. */
.sheet-grab {
  display: flex;
  flex: none;
  justify-content: center;
  padding: 9px 0 3px;
  background: var(--surface);
  cursor: grab;
  touch-action: none;
}

.sheet-grab::before {
  content: "";
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #c9c9c9;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.sheet-heading {
  flex: 1;
  min-width: 0;
}

.sheet-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sheet-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sheet-close {
  flex: none;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.sheet-close:hover {
  border-color: var(--accent);
  background: #fdf0eb;
}

.sheet-body {
  flex: 1;
  min-height: 0;
  padding: 14px;
  /* Keep the last card clear of the home indicator and of the browser's
     bottom toolbar on iOS Safari/Edge. */
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Vertical panning belongs to this scroller; the drag-to-dismiss handler
     only takes over once it is already scrolled to the top. */
  touch-action: pan-y;
}

.code-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 4px 9px;
  border-radius: var(--radius);
  background: #fdf0eb;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill[data-status="retained"] { color: var(--retained); border-color: var(--retained); }
.status-pill[data-status="conditional"] { color: var(--conditional); border-color: var(--conditional); }
.status-pill[data-status="project"] { color: var(--project); border-color: var(--project); }
.status-pill[data-status="off"] { color: #555; }

/* ------------------------------------------------------------ detail grid */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.detail-block {
  padding: 14px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--purple);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.detail-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
}

.detail-block ul {
  margin: 0;
  padding-left: 18px;
  color: #555;
  font-size: 12.5px;
  line-height: 1.5;
}

.detail-block li + li { margin-top: 5px; }

.label-included { color: var(--retained); }
.label-excluded { color: var(--project); }
.label-checks { color: var(--conditional); }
.label-reasons { color: var(--purple); }

/* ----------------------------------------------------------------- footer */

.about-guide {
  margin-top: 32px;
  padding: 28px 20px 32px;
  border-top: 4px solid var(--accent);
  background: var(--aubergine);
  color: #fff;
}

.about-guide-inner {
  display: grid;
  gap: 14px;
  max-width: 1280px;
  margin: auto;
}

.about-guide h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
}

.about-guide-copy {
  max-width: 920px;
  color: #f1e7ee;
  font-size: 14px;
  line-height: 1.65;
}

.about-guide-copy p { margin: 0; }

/* Unobtrusive build/version stamp, so we can confirm a deploy actually
   picked up the latest commit. Small and low-contrast on purpose. */
.build-info {
  padding: 6px 16px 10px;
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
  color: #9a9a9a;
  background: #1c1c1c;
  user-select: text;
}

/* ==========================================================================
   Phone refinements — everything below 640px / 480px.
   Desktop and tablet rendering is untouched: all of this lives inside a
   max-width media query.
   ========================================================================== */

@media (max-width: 640px) {
  /* The detail dialog head used to be a single non-wrapping row of
     badge + title + status pill + Close. On a 390px screen the two fixed
     width items on the right squeezed the title into a one-word column.
     Stack it instead: badge and Close on the first line, then the title,
     then the status pill. */
  #detailDialog .sheet-head {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 8px;
  }

  #detailDialog .code-badge { order: 1; }

  #detailDialog .sheet-close {
    order: 2;
    margin-left: auto;
  }

  #detailDialog .sheet-heading {
    order: 3;
    flex: 1 1 100%;
  }

  #detailDialog .status-pill {
    order: 4;
    flex: 0 1 auto;
    max-width: 100%;
    white-space: normal;
  }

  /* Leave a sliver of the dimmed page visible above the sheet so it reads as
     a panel rather than a full-screen takeover. */
  .sheet-panel { max-height: calc(100% - 20px); }

  /* Slide in from the bottom edge it is anchored to. */
  dialog[open].sheet .sheet-panel { animation: sheet-in .24s ease-out; }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@media (max-width: 480px) {
  /* One card per row: two columns left roughly 150px per card, which broke
     long entitlement titles into one or two words per line. */
  .scope-grid { grid-template-columns: minmax(0, 1fr); }

  .mini { min-height: 0; }
  .mini-reason { -webkit-line-clamp: 3; line-clamp: 3; }

  .workbench { padding: 0 10px; }
  .assessment { padding: 18px 14px; }
  .hero { padding: 26px 16px 30px; }
  .about-guide { padding: 24px 16px 28px; }

  /* Keep the language switcher on one line next to the brand. */
  .appbar-inner { gap: 8px; padding-right: 0; }
  .brand {
    min-width: 0;
    padding: 0 10px;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lang button { padding: 0 8px; font-size: 12px; }
  .lang button:last-child { border-right: 0; }

  .sheet-head { padding: 10px 12px; }
  .sheet-body { padding-left: 12px; padding-right: 12px; }

  .status-bar { gap: 8px; padding-left: 10px; padding-right: 10px; }
}

/* ==========================================================================
   Tablet — 768px and up
   ========================================================================== */

@media (min-width: 768px) {
  :root { --header-h: 50px; }

  .hero { padding: 44px 32px 48px; }
  .workbench { padding: 0 24px; }
  .assessment { padding: 28px; }

  .questions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .option-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .about-guide { padding: 34px 32px 38px; }
  .about-guide-inner { grid-template-columns: minmax(200px, .3fr) minmax(0, 1fr); gap: 32px; }

  /* Centred modal rather than a bottom sheet once there is room. */
  .sheet {
    justify-content: center;
    align-items: center;
  }

  .sheet-panel {
    width: min(920px, calc(100% - 48px));
    max-height: min(calc(100% - 48px), 900px);
    border-radius: var(--radius);
  }

  /* Centred dialog: nothing to pull down. */
  .sheet-grab { display: none; }

  .sheet-body .scope-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Desktop — 1200px and up: side-by-side split view.
   Questions scroll on the left, entitlements stay pinned on the right, so
   neither one covers the other.
   ========================================================================== */

@media (min-width: 1200px) {
  .appbar-inner,
  .hero-inner,
  .workbench {
    width: min(1520px, calc(100% - 40px));
    margin-inline: auto;
  }

  .appbar-inner { padding-right: 0; }

  .brand { margin-left: 0; }

  .nav {
    display: flex;
    gap: 24px;
    color: #fff;
    font-size: 14px;
  }

  .nav button {
    min-height: var(--tap);
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
  }

  .nav button:hover { box-shadow: inset 0 -2px 0 var(--accent); }

  .hero { padding: 52px 0 56px; }
  .hero-inner { position: relative; z-index: 1; }
  .hero::after {
    content: "";
    position: absolute;
    top: -110px;
    right: -90px;
    width: 360px;
    height: 360px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 50%;
    box-shadow: 0 0 0 54px rgba(255, 255, 255, .035), 0 0 0 108px rgba(255, 255, 255, .025);
    pointer-events: none;
  }

  /* No fixed bar on desktop: the sidebar already shows live state. */
  body { padding-bottom: 0; }
  .status-bar { display: none; }

  .workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 540px;
    gap: 24px;
    align-items: start;
    padding: 0;
  }

  .assessment { margin-top: 32px; }
  .questions { grid-template-columns: 1fr; }

  .scope-panel {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    max-height: calc(100svh - var(--header-h) - 48px);
    margin-top: 32px;
    padding: 20px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .scope-panel .scope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .about-guide { padding: 34px 48px 38px; }
}

/* --------------------------------------------------------------------------
   Split view on a short screen (e.g. 1280x720 laptops): compact the cards so
   all twelve entitlements stay visible without scrolling the sidebar.
   -------------------------------------------------------------------------- */

@media (min-width: 1200px) and (max-height: 940px) {
  .scope-panel { padding: 16px; }
  .scope-panel .scope-grid { gap: 8px; }
  .scope-panel .mini { padding: 10px 12px; gap: 5px; }
  .scope-panel .mini-reason { -webkit-line-clamp: 1; line-clamp: 1; }
  .scope-panel .mini-more { display: none; }
}

@media (min-width: 1200px) and (max-height: 800px) {
  .scope-panel .scope-head { margin-bottom: 10px; padding-bottom: 10px; }
  .scope-panel .scope-grid { gap: 6px; }
  .scope-panel .mini { padding: 8px 10px; gap: 3px; }
  .scope-panel .mini-title { font-size: 13px; }
  .scope-panel .mini-reason { font-size: 12px; line-height: 1.35; }
  .scope-panel .mini-foot { font-size: 12px; }
}

/* ==========================================================================
   Short viewports (landscape phones): never let a panel outgrow the screen.
   ========================================================================== */

@media (max-height: 500px) {
  .sheet-panel { max-height: 100%; }
  .hero { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
