/**
 * Shared AI feedback styles (Writing, Listening, and Speaking pages).
 * These classes are used only by js/ai-feedback.js.
 */

.ai-feedback {
  display: block;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.ai-feedback:not(.ai-feedback--visible) {
  display: none;
}

/* Loading opens gently so the feedback card takes page space gradually. */
.ai-feedback.is-loading {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 1.2s ease,
    opacity 0.6s ease,
    transform 0.6s ease;
}

.ai-feedback.is-loading.is-loading-open {
  max-height: 200px; /* room for the orb row + the larger caption without clipping */
  opacity: 1;
  transform: translateY(0);
}

/* The section heading band above a Speaking feedback card — a red uppercase
   strip naming what's below ("Content Errors"). Spans the card width; the outer
   .ai-feedback padding insets it, so no negative-margin bleed is needed. */
.rubric-heading {
  margin: 0;
  padding: 5px;
  background: var(--rubric);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1em;
  line-height: 1;
}

.ai-feedback-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  color: #6b7280;
  font-style: italic;
}

/* The rings, then the caption: `flex-wrap` on the loading block plus the row's
   own full width puts the row on its own line above the message. Three trait
   rings (content, pronunciation, fluency) by default, then the larger Overall
   ring right-most. */
.ai-feedback-loading {
  flex-wrap: wrap;
}
/* The row itself is a `.score-ring-row` (css/main.css), which supplies the
   no-wrap, the scrollport, the peek, the snap and the room the chip overhangs
   into. It used to fold here — `flex-wrap: wrap`, "last resort: a row that
   still cannot fit folds instead of spilling" — which ADR-0108 refuses: a
   wrapped row stops reading as a row, and these rows are read as one
   comparison. What is set here is the row's own width and spacing. */
.ai-score-orbs {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px; /* wide enough that "Pronunciation" reads clear of its neighbours */
  /* The chip's overhang one axis over: it sits at `right: ring * -0.04`,
     which on the 64px Overall ring is 2.56px past the last slot. That used to
     disappear into the score panel's slack, and since #1034 the panel is as
     wide as this row and has no slack, so an unreserved 2.56px made a row
     that fits report itself as scrollable. Reserved on both sides so the row
     stays centred, and 4px rather than the measured 2.56 so the reservation
     still covers the chip on a larger ring. Declared here, on the score
     panel's row, and not on the shared `.score-ring-row`: the Speaking card's
     HUD is one too, and it keeps its own padding. */
  padding-inline: 4px;
}
/* The slot's geometry and its default hue are the shared orb vocabulary in
   css/main.css, and the ring inside it is the shared form's. What is the row's
   own: the separator anchor, and the trait rings' size step below the headline
   ring they feed. */
.ai-score-orb-slot {
  position: relative; /* anchors the overall slot's separator rule */
}
.ai-score-orb-slot:not([data-orb-key="overall"]) {
  --orb-size: 54px; /* 10px under the overall orb: near-peers, not equals */
  --orb-number-size: 0.95rem;
}
/* Keyed by the trait itself, not by child position: the row is N-orb, so a
   trait must keep its hue wherever a page happens to place it. Overall is
   absent on purpose — it keeps the page's skill hue from the shared rule. */
.ai-score-orb-slot[data-orb-key="content"]          { --orb-color: var(--score-content); } /* steel blue */
.ai-score-orb-slot[data-orb-key="pronunciation"]    { --orb-color: var(--score-pronunciation); } /* plum */
.ai-score-orb-slot[data-orb-key="fluency"]          { --orb-color: var(--score-fluency); } /* sea green */
.ai-score-orb-slot[data-orb-key="form"]             { --orb-color: var(--score-form); } /* olive */
.ai-score-orb-slot[data-orb-key="grammar"]          { --orb-color: var(--score-grammar); } /* tan */
.ai-score-orb-slot[data-orb-key="vocabulary"]       { --orb-color: var(--score-vocabulary); } /* moss */
.ai-score-orb-slot[data-orb-key="spelling"]         { --orb-color: var(--score-spelling); } /* clay */
.ai-score-orb-slot[data-orb-key="development"]      { --orb-color: var(--score-development); } /* teal */
.ai-score-orb-slot[data-orb-key="linguistic-range"] { --orb-color: var(--score-linguistic-range); } /* orchid */
/* A trait key with no rule above is a bug, not a default. Left to inherit it
   would render the speaking purple — Overall's own hue — so an unkeyed trait
   would sit beside Overall as its identical twin and nothing would fail. It
   wears the alarm hue instead. Keep this list in step with the rules above;
   tests/unit/js/orb-vocabulary.test.js holds it to that. */
.ai-score-orb-slot[data-orb-key]:not([data-orb-key="content"]):not([data-orb-key="pronunciation"]):not([data-orb-key="fluency"]):not([data-orb-key="form"]):not([data-orb-key="grammar"]):not([data-orb-key="vocabulary"]):not([data-orb-key="spelling"]):not([data-orb-key="development"]):not([data-orb-key="linguistic-range"]):not([data-orb-key="overall"]) {
  --orb-color: var(--score-unkeyed);
}
/* A short gray rule sets OVERALL apart from the three skill orbs: the skills
   feed the headline score. Hung off the last slot, centred in the 28px gap. */
.ai-score-orb-slot:last-child {
  margin-left: 70px; /* 2.5x the 28px row gap: overall stands apart from the skills */
}
.ai-score-orb-slot:last-child::before {
  content: '';
  position: absolute;
  left: -49px; /* half of gap + margin (98px), so the rule splits the space evenly */
  top: 40%;
  transform: translateY(-50%);
  width: 1px;
  height: 35px;
  background: var(--score-divider); /* barely-there: a whisper of separation, not a wall */
}
/* A narrow PANEL, which is not the same thing as a narrow window — and asking
   the window is what let the row spill.

   This step down used to be @media (max-width: 480px), with a middle tier at
   768px that only tightened the gaps. On a phone the window reads correctly,
   because there the panel is the page. On the app shell's wide-nav layouts it
   does not: at 844x390 the nav takes ~300px, so <main> gets ~518 and the panel
   is capped near 448px of content, while the window still measures 844 and
   reads as "not narrow". The five-trait row was handed full desktop spacing
   inside a phone-sized panel — it needs ~600px that way — and hung ~56px past
   each edge.

   So the row asks its container instead. The two viewport tiers collapse to
   one: measured against the room the page actually has, the middle tier covered
   a band no real layout produces, while this step is what makes six orbs fit.
   The widths it replaces are subsumed — a 390px phone gives <main> ~390 and a
   500px window ~500, both of which land here as they always did.

   The container is NAMED (ADR-0024). It used to be unnamed, written when
   <main> was the nearest container and therefore the box the panel had to fit.
   Since the Frame migration <practice-page-frame> sits between them and is a
   container of its own, so an unnamed query resolved against the whole page
   (~1400px) and never fired — while the panel itself sat in a ~350px Spatial
   column on Describe Image. It asks `task-surface` instead: the Task Surface
   or Outcome Surface the panel is actually mounted in.

   The width below is that surface's room, not the panel's: the panel keeps
   32px of it as its gutter and its own padding takes another 36, leaving
   `width - 68` for the row. Five traits plus Overall at full spacing need
   ~600px, so they stop fitting just under 700.

   Six slots at full size cannot sit on one line in this much room. The row
   SCROLLS rather than shrinking to make them: shrinking made a Trait's ring
   smaller on a six-trait page than the same Trait's ring on a three-trait
   page, so two scores stopped being comparable by size — which is the one
   thing the arc is for (ADR-0108). The scroll, the peek and the snap all come
   with `.score-ring-row`; what is left here is what the row has to change to
   be swiped. */
@container task-surface (max-width: 700px) {
  .ai-score-orbs {
    /* A scrollport starts at its leading edge. Centred content that overflows
       one is clipped on the LEFT as well as the right, and no amount of
       scrolling brings the first ring back — so the centring that is right at
       full width is wrong here. */
    justify-content: flex-start;
    gap: 12px;
    /* The row is the last thing in the panel allowed to decide how wide the
       panel is, and HERE it is not allowed to. A one-line row that cannot fit
       is as wide as its rings, and that width travels outward — the panel is
       `width: min-content`, and the Outcome Surface's grid gives its item an
       automatic minimum of its min-content size — so a six-ring row on a
       phone pushed the whole Outcome Surface 118px past the page instead of
       scrolling inside it. Size containment on the inline axis is the cut:
       the row is sized by the room it is given and its contents scroll, which
       is the arrangement the scroll was chosen for.

       Scoped to this step rather than declared for every panel (#1034). On a
       surface with room, containment was also what stopped the row pushing
       the panel past its 640px floor — the panel could not widen because its
       row was forbidden to ask, which is the widening #1034 restores. Above
       this step there is always room for the row the panel holds, so nothing
       is left to spill. */
    contain: inline-size;
  }
  /* 70px of empty space inside a row the learner has to swipe is width spent
     on nothing, and the rule hung in it would be swiped past on its own. The
     stand-off and the separator say which ring is the headline where the whole
     row is in view at once; here Overall's size says it. */
  .ai-score-orb-slot:last-child {
    margin-left: 0;
  }
  .ai-score-orb-slot:last-child::before {
    content: none;
  }
}

/* A ROOMY surface, the other end of the same ladder (#1034). The panel is
   `width: min-content` (css/main.css), so the only thing that can make it
   wider than its 640px floor is the row asking for more — and at the spacing
   above the widest row in the app, five traits plus Overall, measures 585px
   and fits the floor with room to spare. That is why the panel read exactly
   640px on every desktop viewport: not because the page had nothing to give,
   but because the row never asked.

   So the six-orb row asks. Above 760px of surface — the room the widened
   panel and its 32px gutter need — the gap and Overall's stand-off step up,
   the row's intrinsic width goes past the floor, and the panel widens to it.
   Nothing here resizes a ring: ADR-0108's comparability is a claim about the
   rings, and this moves only the space between them.

   Summarize Written Text's row, four traits plus Overall, is unchanged in
   width by design: at this spacing it is still short of the floor, so its
   panel stays at exactly the number it has always been and only its own
   spacing opens up. No Speaking page reaches this rule — their scores are on
   the Attempt's card, and their panel holds no orb row (ADR-0048,
   ADR-0129). */
@container task-surface (min-width: 760px) {
  .ai-score-orbs {
    gap: 40px;
  }
  .ai-score-orb-slot:last-child {
    margin-left: 100px;
  }
  .ai-score-orb-slot:last-child::before {
    /* Half of gap + margin (140px), so the rule still splits the space it
       hangs in evenly — the same derivation as the default above. */
    left: -70px;
  }
}

/* The orb header's box — its width, its bottom-only radius, its chrome and its
   blank-until-earned state — is the shared `.score-panel` definition in
   css/main.css now (ADR-0009). A Writing page had its own copy of the width
   here; it said nothing the shared rule does not. */

/* ─── Every orb in the row is a ring ───────────────────────────────────────
   A Score is drawn in the one ring form (`.score-ring` in css/main.css,
   ADR-0108), so the row opts in rather than keeping a flat-rimmed circle with
   a fraction inside and no arc. `.ai-score-orb` stays its name: the Overall
   separator above, the narrow step above that and the button affordance below
   are all genuinely the row's own.

   Opting in is the class plus these tokens. The geometry, the arc arithmetic,
   the hole and the waiting breath come WITH the form and are not restated
   here — restating them is the drift ADR-0009 records, six properties in a
   week with every suite green. What the row supplies is its own size, its
   trait's hue, the panel's ground and the track a ring waits on.

   Two things retired with the rim, because a ring has none: the 28-second
   `orb-dash-crawl` that rotated the whole orb to make its dashes appear to
   move, and the `orb-rim-settle` that eased the rim from placeholder-grey to
   solid when a score landed. A ring's whole surface is the arc — there is
   nothing left to dash, and the arc arriving in one move IS the settle.

   The selector names BOTH classes, and has to, for the reason
   `.score-orb.score-ring` gives in css/main.css: `.score-ring` sets these same
   tokens as the form's own defaults at (0,1,0), so a bare `.ai-score-orb` ties
   it and won only because this stylesheet's <link> comes after main.css. The
   Marks orb had already lost its hue to exactly that tie.
   tests/unit/js/orb-vocabulary.test.js works the cascade out, over the sheets
   concatenated in load order. */
.ai-score-orb.score-ring {
  --ring-size: var(--orb-size);
  /* A fixed proportion of the ring, so the 54px trait and the 64px Overall
     read as one instrument at two sizes rather than two instruments. */
  --ring-thickness: max(4px, calc(var(--ring-size) * 0.09));
  --ring-color: var(--orb-color);
  --ring-track: var(--score-placeholder); /* the grey the dashed rim used to wear */
  /* The panel's own ground. Named rather than left to the form's default,
     because the button states below move the hole and need a base to move
     from. */
  --ring-hole: var(--surface);
  /* The flat orb kept a long fraction off its rim with side padding. A ring
     has no rim to touch, and padding here would push its hole off-centre:
     `.score-ring::before` insets from the padding box. */
  padding: 0;
}

/* The figure eases in as the arc lands. The row keeps its own name for the
   figure — the shared `.score-ring-figure` beside it sets the size, this sets
   the arrival — because that name is what the Playwright specs read a landed
   score by. */
.ai-score-orb-score {
  animation: orb-arrive 0.3s ease-out;
}
.ai-score-orb.is-loaded {
  font-style: normal; /* the loading container is italic; a score is not status text */
}
@media (prefers-reduced-motion: reduce) {
  .ai-score-orb-score {
    animation: none;
  }
}

.ai-score-orb-label {
  font-style: normal; /* the loading container is italic; labels are chrome, not status text */
}
/* Until its score lands a label is placeholder-gray beside its waiting ring;
   loaded, it takes the shared tint with no JS touching it. */
.ai-score-orb:not(.is-loaded) + .ai-score-orb-label {
  color: var(--ink-placeholder);
}
/* ─── An orb that is a button ──────────────────────────────────────────────
   Where a scored orb doubles as the passage view switcher it is a real
   <button> with `aria-pressed`. Nothing emits that markup today — the branch,
   the button markup and the handler behind it were deleted (docs/TECHNICAL_DEBT.md)
   and tests/unit/js/score-orb.test.js holds the row to inert spans — so these
   rules are dormant. They are redrawn rather than left flat, because a flat
   affordance under a ring form is a trap for whoever revives the switcher.

   Everything moves to the HOLE. Hover tints it, pressed tints it further, and
   focus draws a ring OUTSIDE the track. The arc is never touched: it is the
   score, and a score must not appear to change because a finger is on it.
   That is exactly what the rim states this replaces did — "border-color at
   75%" on hover, "border-color at full strength" when pressed — which on a
   ring would have redrawn the score itself.

   No geometry here: the size, the stroke, the hole and the arc are the ring's
   (css/main.css) and the row's tokens above. */
button.ai-score-orb {
  /* font-family only: the shared rules' size and weight already outrank the
     UA button styles, and restating them here is exactly the copy that let the
     two orbs drift. */
  font-family: inherit;
  cursor: pointer;
}
button.ai-score-orb::before {
  transition: background-color 0.2s ease;
}
/* Dormant: an unpressed orb reads back a notch, so the view you are in is the
   one that stands out. Reduced on the FIGURE rather than as `opacity` on the
   orb — opacity would fade the arc with it, and the arc has to say what the
   score is in every state of the control. */
button.ai-score-orb .ai-score-orb-score {
  color: color-mix(in srgb, var(--orb-color) 65%, var(--ink-tertiary));
}
/* Scoped off the pressed orb, not merely written before it: a bare
   `:hover` outranks `[aria-pressed="true"]` on specificity, so hovering the
   active view's orb would have lightened it back towards dormant. */
button.ai-score-orb:not([aria-pressed="true"]):hover {
  --ring-hole: color-mix(in srgb, var(--orb-color) 8%, var(--surface));
}
/* The active view's orb: its hole tinted and its figure at full strength. Its
   neighbours stay dormant-faint until tapped. */
.ai-score-orb[aria-pressed="true"] {
  --ring-hole: color-mix(in srgb, var(--orb-color) 16%, var(--surface));
}
.ai-score-orb[aria-pressed="true"] .ai-score-orb-score {
  color: color-mix(in srgb, var(--orb-color) 80%, var(--ink-strongest)); /* darkest: reads strongest */
}
/* Outside the track, with air between: a focus indicator drawn on the ring
   itself would be read as arc. */
button.ai-score-orb:focus-visible {
  outline: 2px solid var(--orb-color);
  outline-offset: 3px;
}

/* A loaded label takes the shared tint; only the pressed one steps up, driven
   off the orb's own state via the adjacent sibling so the JS never has to
   touch the label. */
.ai-score-orb[aria-pressed="true"] + .ai-score-orb-label {
  color: color-mix(in srgb, var(--orb-color) 80%, var(--ink-strongest));
}

/* The loading caption wears the orb-label uniform (uppercase, tracked, upright)
   so it reads as the group's headline, not a stray footnote — one notch larger
   and darker than the labels it captions. */
.ai-score-orbs + .ai-feedback-loading-message {
  margin-top: 14px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--ink-tertiary);
}
/* OVERALL used to wear a bolder, larger label than the traits around it. It no
   longer does: the label is the orb's, not the row's, and it has to read the
   same here as it does on a Marks page, where the lone orb is this same
   headline orb (ADR-0009). Its size, the stand-off and the separator already
   say which orb is the headline. */

.ai-feedback-loading-message + .ai-feedback-loading-countdown {
  margin-left: 4px;
}

.ai-feedback-error-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 12px;
  color: #b45309;
  font-style: italic;
}

.dots-anim::after {
  content: '';
  animation: scoringDots 1.5s steps(4, end) infinite;
}
@keyframes scoringDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* Copy, then the retry button at the trailing edge. The overall-score gauge
   that used to lead this row is gone: the orb header at the top of <main> is
   the Score headline on every page now (ADR-0009). */
.ai-feedback-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.ai-feedback-summary-copy h3 {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

.ai-feedback-summary-copy p {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
}

.ai-feedback-next-steps-list {
  margin: 8px 0 0 0;
  padding-left: 20px;
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.5;
}

.ai-feedback-next-steps-list li {
  margin-bottom: 4px;
}

.ai-feedback-next-steps-list li:last-child {
  margin-bottom: 0;
}

.ai-feedback-retry {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.ai-feedback-retry:hover {
  background: #374151;
}

.ai-feedback-cascade {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 4px solid #c62828;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
}

.ai-feedback-cascade-headline {
  margin: 0 0 4px 0;
  font-weight: 700;
  font-size: 0.96rem;
}

.ai-feedback-cascade-detail {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
}

.ai-feedback-improve {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fefce8;
}

.ai-feedback-improve h3 {
  margin: 0 0 10px 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.ai-feedback-improve--empty {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.ai-feedback-improve--empty p {
  margin: 4px 0 0 0;
  font-size: 0.88rem;
  color: #4b5563;
}

.ai-feedback-priority-item {
  padding: 8px 0;
}

.ai-feedback-priority-item + .ai-feedback-priority-item {
  border-top: 1px solid #fde68a;
}

.ai-feedback-priority-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.ai-feedback-priority-head strong {
  font-weight: 800;
}

.ai-feedback-priority-item p {
  margin: 0;
  font-size: 0.88rem;
  color: #4b5563;
}

.ai-feedback-traits {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.ai-feedback-trait {
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-left: 5px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.ai-feedback-trait--high {
  border-left-color: #e5e7eb;
}

.ai-feedback-trait--mid {
  border-left-color: #9ca3af;
}

.ai-feedback-trait--low {
  border-left-color: #f87171;
}

.ai-feedback-trait--max {
  border-left-color: #16a34a;
}

.ai-feedback-trait--zero {
  border-left-color: #ef4444;
}

.ai-feedback-trait-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.ai-feedback-trait-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-feedback-trait-name {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0;
}

.ai-feedback-trait-subtitle {
  font-size: 0.78rem;
  color: #9ca3af;
  font-weight: 600;
  line-height: 1.25;
}

.ai-feedback-trait-score {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.ai-feedback-dots {
  /* One place for the two dot colours, so a half dot can mix them. */
  --ai-dot-on: #16a34a;
  --ai-dot-off: #d1d5db;
  display: inline-flex;
  gap: 4px;
}

.ai-feedback-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ai-dot-off);
}

.ai-feedback-dot--filled {
  background: var(--ai-dot-on);
}

.ai-feedback-dot--half {
  background: linear-gradient(90deg, var(--ai-dot-on) 50%, var(--ai-dot-off) 50%);
}

.ai-feedback-trait-number {
  min-width: 34px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #374151;
  text-align: right;
}

.ai-feedback-bullets {
  display: grid;
  gap: 8px;
  margin: 12px 0 0 0;
  padding: 0;
  list-style: none;
}

.ai-feedback-bullet {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: start;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ai-feedback-bullet-mark {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
}

.ai-feedback-bullet--positive .ai-feedback-bullet-mark {
  background: #dcfce7;
  color: #166534;
}

.ai-feedback-bullet--issue .ai-feedback-bullet-mark {
  background: #fee2e2;
  color: #991b1b;
}

/* A measurement carrying no verdict: grey, so it reads as neither praise nor fault. */
.ai-feedback-bullet--info .ai-feedback-bullet-mark {
  background: var(--chrome-line);
  color: var(--chrome-ink-muted);
}

.ai-feedback-bullet-text {
  min-width: 0;
  color: #374151;
}

.ai-feedback-see,
.ai-feedback-how {
  padding: 3px 8px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: var(--surface);
  color: #374151;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.ai-feedback-see:hover,
.ai-feedback-how:hover {
  border-color: #9ca3af;
  background: #f3f4f6;
}

.ai-feedback-bullet-expand {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid #e5e7eb;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ai-feedback-bullet-expand[hidden] {
  display: none;
}

.ai-feedback-action-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  padding: 6px 0;
}

.ai-feedback-action-item + .ai-feedback-action-item {
  border-top: 1px solid #f3f4f6;
}

.ai-feedback-action-num {
  font-weight: 700;
  color: #6b7280;
  min-width: 20px;
}

.ai-feedback-action-title {
  font-weight: 700;
  color: var(--ink);
}

.ai-feedback-action-detail {
  display: block;
  margin-top: 2px;
  color: #4b5563;
  font-weight: 400;
}

.ai-feedback-error {
  color: #991b1b;
  font-size: 0.88rem;
}

.ai-feedback-how-all {
  display: block;
  margin-top: 12px;
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: var(--surface);
  color: #374151;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  width: fit-content;
}

.ai-feedback-how-all:hover {
  border-color: #9ca3af;
  background: #f3f4f6;
}

.ai-feedback-back-to-feedback {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  padding: 10px 18px;
  background: #2e7d32;
  color: #ffffff;
  border: none;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s, transform 0.2s;
}

.ai-feedback-back-to-feedback:hover {
  background: #1b5e20;
  transform: translateY(-1px);
}

.ai-feedback-back-to-feedback:active {
  transform: translateY(0);
}

.ai-feedback-back-to-feedback--visible {
  display: block;
}

.ai-feedback-checks {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.ai-feedback-checks h3 {
  margin: 0 0 8px 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.ai-feedback-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ai-feedback-check {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #f8fafc;
}

.ai-feedback-check-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #6b7280;
}

.ai-feedback-check-value {
  justify-self: end;
  color: var(--ink);
}

.ai-feedback-check-note {
  grid-column: 1 / -1;
  font-style: normal;
  color: #4b5563;
  font-size: 0.85rem;
}

.ai-feedback-check-grid:has(:only-child) {
  grid-template-columns: 1fr;
}

.auto-submit-banner {
  margin: 12px 0 4px 0;
  padding: 10px 16px;
  border-radius: 4px;
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
  color: #2e7d32;
  font-weight: 600;
  font-size: 0.9em;
}

@media (max-width: 768px) {
  .ai-feedback {
    padding: 5px;
  }

  .ai-feedback-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-feedback-retry {
    grid-column: 1 / -1;
    width: 100%;
  }

  .ai-feedback-trait-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-feedback-bullet {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ai-feedback-see,
  .ai-feedback-how {
    justify-self: start;
  }
}

/* Speaking content feedback — the response as a passage. */

.ai-feedback-passage {
  padding: 14px 16px;
  font-size: 1.05rem;
  line-height: 2;
  color: var(--ink);
}

@media (max-width: 768px) {
  .ai-feedback-passage {
    padding: 5px;
  }
}
