/* Writing Feedback (Annotated writing questions): tab bar, essay highlights, Summary / Rubrics / Good Points.
   Loaded after student.css and the panel-toggle stylesheets. Colours follow the staging page. */

:root {
  --sq-w-purple: #302574;
  --sq-w-card-border: #e6ebf1;
  --sq-w-soft-bg: #f7f9fb;
}

/* ---------- tab bar (above the scrolling body) ---------- */
.sq-w-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--sq-border);
  background: #fff;
  scrollbar-width: none;
}

.sq-w-tabs::-webkit-scrollbar {
  display: none;
}

.sq-w-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--sq-border);
  border-radius: 999px;
  background: #fff;
  color: var(--sq-muted);
  font-family: var(--sq-font);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.sq-w-tab b {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #eef2f7;
  color: var(--sq-text);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.sq-w-tab.is-active {
  border-color: var(--sq-blue);
  background: var(--sq-blue);
  color: #fff;
}

.sq-w-tab.is-active b {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* ---------- Answer tab ---------- */
.sq-essay-label {
  margin: 16px 0 8px;
  font-weight: 700;
}

.sq-essay {
  line-height: 1.95;
  white-space: pre-wrap;
}

.sq-anno {
  padding: 1px 0;
  border-bottom: 2px solid var(--c);
  border-radius: 3px;
  background: color-mix(in srgb, var(--c) 26%, transparent);
  color: inherit;
  cursor: pointer;
}

.sq-anno:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 1px;
}

.sq-words {
  margin: 16px 0 0;
  color: var(--sq-muted);
  font-size: 13px;
}

.sq-audio {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
}

.sq-ai-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.sq-ai-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  background: #fff7e0;
  color: #d99a00;
  font-size: 12px;
  font-weight: 600;
}

.sq-see-result {
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--sq-blue);
  color: #fff;
  font-family: var(--sq-pill-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.sq-see-result:hover {
  background: var(--sq-blue-dark);
}

/* ---------- Summary tab ---------- */
.sq-w-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sq-w-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--sq-border);
  border-radius: 12px;
  background: #fff;
  color: var(--sq-text);
  font-family: var(--sq-font);
  font-size: 13.5px;
  cursor: pointer;
  touch-action: manipulation;
}

.sq-w-chip b {
  min-width: 22px;
  height: 22px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.sq-w-chip.is-active {
  border-color: var(--sq-blue);
  box-shadow: inset 0 0 0 1px var(--sq-blue);
}

.sq-w-group h5 {
  margin: 20px 0 8px;
  color: var(--sq-w-purple);
  font-size: 15px;
  font-weight: 700;
}

.sq-w-item {
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid var(--sq-w-card-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(18, 38, 63, 0.06);
}

.sq-w-item-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sq-w-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
}

.sq-w-quote {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  line-height: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sq-w-item.is-open .sq-w-quote {
  -webkit-line-clamp: unset;
  display: block;
}

.sq-w-feedback-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sq-blue);
  font-family: var(--sq-font);
  font-size: 13px;
  cursor: pointer;
}

.sq-w-chevron {
  transition: transform 0.2s;
}

.sq-w-feedback-btn[aria-expanded="true"] .sq-w-chevron,
.sq-w-param.is-open .sq-w-chevron {
  transform: rotate(180deg);
}

.sq-w-item-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sq-w-card-border);
}

.sq-w-item-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

.sq-ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff8e1;
  color: #b7860b;
  font-size: 12px;
  font-weight: 600;
}

.sq-w-empty {
  margin: 32px 0;
  color: #8a8a8a;
  text-align: center;
}

/* empty category inside the Summary list */
.sq-w-empty.is-inline {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--sq-w-soft-bg);
  font-size: 14px;
}

/* ---------- Rubrics tab ---------- */
.sq-w-eyebrow {
  display: block;
  margin: 0;
  color: var(--sq-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sq-w-rubric-name h4,
.sq-w-card h4 {
  margin: 4px 0 0;
  color: var(--sq-w-purple);
  font-size: 15px;
  font-weight: 700;
}

.sq-w-subtabs {
  display: flex;
  gap: 4px;
  margin: 14px 0;
  padding: 4px;
  border-radius: 12px;
  background: #eef2f7;
}

.sq-w-subtab {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sq-muted);
  font-family: var(--sq-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sq-w-subtab.is-active {
  background: #fff;
  color: var(--sq-text);
  box-shadow: 0 1px 3px rgba(18, 38, 63, 0.12);
}

.sq-w-score {
  padding: 14px 16px;
  border: 1px solid #bfe7fa;
  border-radius: 12px;
  background: #e6f6fe;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.sq-w-card {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--sq-w-card-border);
  border-radius: 12px;
  background: #fff;
}

.sq-w-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 90px) auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 14px;
}

.sq-w-bar {
  height: 8px;
  border-radius: 4px;
  background: #e3eaf2;
  overflow: hidden;
}

.sq-w-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--sq-green);
}

.sq-w-bar-row b {
  min-width: 34px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.sq-w-link {
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--sq-blue);
  font-family: var(--sq-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sq-w-link.is-center {
  display: block;
  margin: 12px auto 0;
}

.sq-w-full-row {
  display: flex;
  justify-content: flex-end;
}

.sq-w-param {
  margin-top: 10px;
  border: 1px solid var(--sq-w-card-border);
  border-radius: 12px;
  background: #fff;
}

.sq-w-param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: none;
  font-family: var(--sq-font);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.sq-w-param-body {
  padding: 0 14px 14px;
}

.sq-w-obtained {
  margin: 0 0 10px;
  color: var(--sq-muted);
  font-size: 13px;
  font-style: italic;
  text-align: right;
}

.sq-w-obtained b {
  color: var(--sq-text);
  font-style: normal;
}

.sq-w-descriptor {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--sq-w-soft-bg);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-line;
}

.sq-w-remark-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sq-w-remark-selects label {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.sq-w-remark-selects .sq-select {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-weight: 400;
}

.sq-w-remark {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
}

/* ---------- small screens ---------- */
@media (max-width: 820px) and (orientation: portrait), (max-height: 500px) and (orientation: landscape) {
  /* the collapsed bar only has room for the title row; tabs appear once the panel is open */
  .sq-detail[data-sheet="peek"] .sq-w-tabs {
    display: none;
  }
}

@media (max-width: 820px) and (orientation: portrait) {
  .sq-w-remark-selects {
    grid-template-columns: 1fr;
  }
}
