/* TOEFL Trainer — Front-end player styles (Phase 2.2)
 *
 * Design tokens — match the verified mockup.
 *   INK         #1c1c1e   body text
 *   INK_SOFT    #4a4a52   subtle body text
 *   INK_FAINT   #8a8a92   secondary text
 *   ACCENT      #2c4f7c   primary buttons, active radio, stimulus border
 *   ACCENT_SOFT #e9eff5   light accent backgrounds
 *   SURFACE     #fafbfc   onboarding/intro card background
 *   SURFACE_2   #f4f6f9   subtle backgrounds
 *   BORDER      #e5e7eb   default border
 *   DANGER      #c43838   low timer, error
 */

.tqb-frontend {
	--tqb-ink:         #1c1c1e;
	--tqb-ink-soft:    #4a4a52;
	--tqb-ink-faint:   #8a8a92;
	--tqb-ink-fainter: #c7c7cc;
	--tqb-accent:      #2c4f7c;
	--tqb-accent-2:    #1e6b8a;
	--tqb-accent-soft: #e9eff5;
	--tqb-surface:     #fafbfc;
	--tqb-surface-2:   #f4f6f9;
	--tqb-border:      #e5e7eb;
	--tqb-danger:      #c43838;
	--tqb-ok:          #2d8a47;
	--tqb-ok-soft:     #e8f3eb;
	--tqb-header-bg:   #f4f6f9;
	--tqb-content-width: 1300px;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--tqb-ink);
	line-height: 1.5;
	background: #fff;
	display: flex;
	flex-direction: column;
	min-height: 600px;
	width: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
}

/* Login-required + initial loading screens */
.tqb-frontend--login-required,
.tqb-frontend--error {
	padding: 48px;
	text-align: center;
}

.tqb-loading {
	padding: 60px 32px;
	text-align: center;
	color: var(--tqb-ink-soft);
	font-size: 15px;
}

/* ============================================================
   Buttons
   ============================================================ */
.tqb-btn,
.tqb-button {
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	padding: 10px 24px;
	border-radius: 4px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: all 0.12s;
	text-decoration: none;
	display: inline-block;
}

.tqb-btn--primary,
.tqb-button {
	background: var(--tqb-accent);
	color: #fff !important;
}
.tqb-btn--primary:hover:not(:disabled),
.tqb-button:hover:not(:disabled) {
	background: #1e3c64;
}
.tqb-btn--primary:disabled,
.tqb-button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.tqb-btn--secondary,
.tqb-button--secondary {
	background: #fff;
	color: var(--tqb-accent) !important;
	border-color: var(--tqb-accent);
}
.tqb-btn--secondary:hover:not(:disabled),
.tqb-button--secondary:hover:not(:disabled) {
	background: var(--tqb-accent-soft);
}
.tqb-btn--secondary:disabled,
.tqb-button--secondary:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ============================================================
   Header (TOEFL-style: minimalist white, sticky)
   ============================================================ */
.tqb-header {
	background: var(--tqb-header-bg);
	border-bottom: 1px solid var(--tqb-border);
	position: sticky;
	top: 0;
	z-index: 20;
	/* Full-width background — break out of theme container. */
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.tqb-header__inner {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 24px;
	min-height: 52px;
	max-width: var(--tqb-content-width);
	margin: 0 auto;
	box-sizing: border-box;
}

.tqb-header__brand {
	font-weight: 800;
	color: var(--tqb-accent-2);
	letter-spacing: 0.04em;
	font-size: 16px;
	background: #b9e8f5;
	padding: 4px 8px;
	border-radius: 3px;
}

.tqb-header__title {
	font-weight: 600;
	color: var(--tqb-ink);
	font-size: 15px;
}

.tqb-header__sep {
	color: var(--tqb-ink-fainter);
	margin: 0 4px;
}

.tqb-header__counter {
	color: var(--tqb-ink-soft);
	font-size: 13px;
	font-weight: 500;
}

.tqb-header__right {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 14px;
}

.tqb-timer__value {
	font-family: "SF Mono", Menlo, Consolas, monospace;
	font-size: 16px;
	color: var(--tqb-ink);
	font-weight: 600;
	min-width: 60px;
	text-align: right;
}
.tqb-timer__value--low {
	color: var(--tqb-danger);
	animation: tqb-pulse 1s infinite;
}
@keyframes tqb-pulse {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.5; }
}

.tqb-timer__toggle {
	color: var(--tqb-accent-2);
	font-size: 13px;
	cursor: pointer;
	user-select: none;
}

/* ============================================================
   Main content area
   ============================================================ */
.tqb-main {
	flex: 1;
	padding: 0;
}
.tqb-main__inner {
	max-width: var(--tqb-content-width);
	margin: 0 auto;
	padding: 36px 24px;
	box-sizing: border-box;
}

/* ============================================================
   Footer (Back / Next) — full-width like the header
   ============================================================ */
.tqb-footer {
	border-top: 1px solid var(--tqb-border);
	background: #fff;
	position: sticky;
	bottom: 0;
	z-index: 20;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}
.tqb-footer__inner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 24px;
	min-height: 72px;
	max-width: var(--tqb-content-width);
	margin: 0 auto;
	box-sizing: border-box;
}

.tqb-footer__left { display: flex; }
.tqb-footer__right { display: flex; align-items: center; gap: 12px; }

.tqb-footer__hint {
	color: var(--tqb-danger);
	font-size: 13px;
	opacity: 0;
	transition: opacity 0.2s;
}
.tqb-footer__hint--show { opacity: 1; }

/* ============================================================
   Onboarding screen
   ============================================================ */
.tqb-onb__title {
	font-size: 32px;
	margin: 8px 0 12px;
	font-weight: 700;
}
.tqb-onb__desc {
	color: var(--tqb-ink-soft);
	font-size: 16px;
	margin: 0 0 24px;
}
.tqb-onb__preview {
	background: #fef3cd;
	border-left: 4px solid #d6a000;
	color: #6b4f0a;
	padding: 10px 14px;
	margin: 0 0 24px;
	font-size: 14px;
	border-radius: 0 4px 4px 0;
}
.tqb-onb__rules {
	background: var(--tqb-surface);
	border: 1px solid var(--tqb-border);
	border-radius: 6px;
	padding: 18px 22px;
	margin: 0 0 24px;
}
.tqb-onb__rules h3 {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--tqb-ink-soft);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.tqb-onb__user {
	color: var(--tqb-ink-soft);
	font-size: 14px;
	margin: 0 0 20px;
}

.tqb-onb__name {
	margin: 20px 0 24px;
	padding: 16px 18px;
	background: var(--tqb-surface);
	border: 1px solid var(--tqb-border);
	border-radius: 6px;
	max-width: 480px;
}
.tqb-onb__name-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 8px;
	color: var(--tqb-ink);
}
.tqb-onb__name-input {
	display: block;
	width: 100%;
	padding: 10px 12px;
	font-size: 16px;
	border: 1.5px solid var(--tqb-border);
	border-radius: 4px;
	background: #fff;
	color: var(--tqb-ink);
	box-sizing: border-box;
}
.tqb-onb__name-input:focus {
	outline: none;
	border-color: var(--tqb-accent);
}

/* ============================================================
   Intro screens (section / module description / instructions)
   ============================================================ */
.tqb-intro__title {
	font-size: 26px;
	font-weight: 700;
	margin: 8px 0 16px;
}
.tqb-intro__body {
	max-width: 900px;
}

/* ============================================================
   Task headline + instructions
   ============================================================ */
.tqb-task__headline {
	font-size: 22px;
	font-weight: 700;
	text-align: center;
	margin: 0 0 24px;
}
.tqb-task__instructions {
	margin: 0 0 18px;
	color: var(--tqb-ink-soft);
	font-size: 14px;
}

/* ============================================================
   Rich text containers (description/instructions HTML output)
   ============================================================ */
.tqb-rich p { margin: 8px 0 12px; }
.tqb-rich ul,
.tqb-rich ol { margin: 8px 0 12px; padding-left: 24px; }
.tqb-rich li { margin-bottom: 4px; }
.tqb-rich table {
	border-collapse: collapse;
	margin: 16px 0;
	max-width: 720px;
}
.tqb-rich th,
.tqb-rich td {
	border: 1px solid var(--tqb-ink-fainter);
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
}
.tqb-rich th {
	background: #b9e8f5;
	font-weight: 600;
}
.tqb-rich strong { font-weight: 600; }

/* ============================================================
   Blocks
   ============================================================ */
.tqb-block {
	margin-bottom: 22px;
}

.tqb-block--text {
	font-size: 16px;
	line-height: 1.7;
	max-width: 900px;
}

.tqb-block--mc {
	/* No outer box. Options stand on their own. */
	padding: 0;
	background: transparent;
	border: 0;
	max-width: 900px;
}

.tqb-mc__question {
	margin: 0 0 12px;
	font-weight: 600;
	font-size: 16px;
}
.tqb-mc__prompt {
	margin: 0 0 14px;
	font-size: 15px;
	color: var(--tqb-ink-soft);
}

.tqb-mc__options {
	display: flex;
	flex-direction: column;
}

/* Options are bare rows separated by thin dividers — no boxes, no fills. */
.tqb-mc__opt {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 4px;
	border: 0;
	border-top: 1px solid var(--tqb-border);
	background: transparent;
	border-radius: 0;
	cursor: pointer;
	transition: background 0.12s;
}
.tqb-mc__opt:last-child {
	border-bottom: 1px solid var(--tqb-border);
}
.tqb-mc__opt:hover {
	background: var(--tqb-surface);
}
.tqb-mc__opt--checked {
	background: var(--tqb-accent-soft);
}

.tqb-mc__radio {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 1.5px solid var(--tqb-ink-faint);
	margin-top: 3px;
	display: inline-block;
	position: relative;
	transition: border-color 0.12s;
}
.tqb-mc__opt--checked .tqb-mc__radio {
	border-color: var(--tqb-accent);
}
.tqb-mc__opt--checked .tqb-mc__radio::after {
	content: '';
	position: absolute;
	top: 3px; left: 3px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--tqb-accent);
}

.tqb-mc__text {
	flex: 1;
	line-height: 1.5;
}

.tqb-block--unknown {
	color: var(--tqb-ink-faint);
	font-style: italic;
	padding: 12px;
	background: var(--tqb-surface-2);
	border-radius: 4px;
}

.tqb-empty {
	color: var(--tqb-ink-faint);
	font-style: italic;
	text-align: center;
	padding: 40px 0;
}

/* ============================================================
   Results
   ============================================================ */
.tqb-results__title {
	text-align: center;
	font-size: 26px;
	font-weight: 700;
	margin: 24px 0 32px;
}
.tqb-results__score {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 4px;
	margin: 32px 0;
}
.tqb-results__main {
	font-size: 84px;
	font-weight: 700;
	color: var(--tqb-accent);
	line-height: 1;
}
.tqb-results__max {
	font-size: 28px;
	color: var(--tqb-ink-faint);
}
.tqb-results__detail {
	text-align: center;
	font-size: 17px;
}
.tqb-results__note {
	text-align: center;
	color: var(--tqb-ink-soft);
	font-size: 14px;
	margin-top: 24px;
}
.tqb-results__actions {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

/* ============================================================
   Answer review
   ============================================================ */
.tqb-review__head {
	text-align: center;
	margin-bottom: 16px;
}
.tqb-review__section {
	font-size: 18px;
	font-weight: 700;
	margin: 28px 0 12px;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--tqb-border);
}
.tqb-review__item {
	border: 1px solid var(--tqb-border);
	border-left-width: 4px;
	border-radius: 6px;
	padding: 16px 18px;
	margin: 12px 0;
	background: #fff;
}
.tqb-review__item--correct { border-left-color: #2e9e5b; }
.tqb-review__item--wrong   { border-left-color: var(--tqb-danger); }

.tqb-review__item-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.tqb-review__num {
	font-size: 13px;
	font-weight: 600;
	color: var(--tqb-ink-faint);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.tqb-review__badge {
	font-size: 13px;
	font-weight: 700;
	padding: 2px 10px;
	border-radius: 12px;
}
.tqb-review__badge--ok { color: #1d7a3e; background: #e6f4ec; }
.tqb-review__badge--no { color: #b32d2e; background: #fbeaea; }

.tqb-review__q {
	font-size: 16px;
	font-weight: 600;
	margin: 4px 0 12px;
}
.tqb-review__opts {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.tqb-review__opt {
	padding: 8px 12px;
	border: 1px solid var(--tqb-border);
	border-radius: 4px;
	font-size: 15px;
}
.tqb-review__opt--correct {
	border-color: #2e9e5b;
	background: #eef7f1;
}
.tqb-review__opt--wrongpick {
	border-color: var(--tqb-danger);
	background: #fdeeee;
}
.tqb-review__opt-tag {
	font-size: 13px;
	font-weight: 600;
	color: var(--tqb-ink-soft);
}
.tqb-review__line {
	margin: 6px 0;
	font-size: 15px;
}
.tqb-review__label {
	color: var(--tqb-ink-faint);
}
.tqb-review__val--ok { color: #1d7a3e; font-weight: 600; }
.tqb-review__val--no { color: #b32d2e; font-weight: 600; text-decoration: line-through; }

.tqb-review__expl {
	margin: 12px 0 0;
	padding: 10px 14px;
	background: var(--tqb-accent-soft);
	border-left: 3px solid var(--tqb-accent);
	border-radius: 4px;
}
.tqb-review__expl-label {
	font-size: 12px;
	font-weight: 700;
	color: var(--tqb-accent);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 4px;
}
.tqb-review__expl-body {
	font-size: 14px;
	line-height: 1.55;
	color: var(--tqb-ink);
}
.tqb-review__expl-body p { margin: 4px 0; }
.tqb-review__expl-body p:first-child { margin-top: 0; }
.tqb-review__expl-body p:last-child  { margin-bottom: 0; }

.tqb-error__title {
	text-align: center;
	color: var(--tqb-danger);
	font-size: 24px;
	margin-top: 36px;
}
.tqb-error__msg {
	text-align: center;
	font-size: 15px;
	color: var(--tqb-ink-soft);
}

/* ============================================================
   Task type: Listening (Short + Lecture)
   ============================================================ */
.tqb-listening {
	display: grid;
	grid-template-columns: 0.9fr 1.1fr;
	gap: 48px;
	max-width: 1100px;
	margin: 0 auto;
	align-items: start;
}

/* Lecture slide phase: single column, centered. */
.tqb-listening--slide {
	grid-template-columns: 1fr;
	gap: 28px;
	justify-items: center;
	text-align: center;
	max-width: 720px;
	margin: 32px auto 0;
}

/* Image: no container, no background — just the image at full column width,
   height auto to preserve aspect ratio. */
.tqb-listening__image {
	display: block;
	width: 100%;
}
.tqb-listening__img {
	display: block;
	width: 100%;
	height: auto;
}
.tqb-listening__img--large {
	max-width: 640px;
	margin: 0 auto;
}

.tqb-listening__question {
	display: flex;
	flex-direction: column;
}

/* Audio-playing badge (Short Response, inside question column) */
.tqb-listening__playing {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--tqb-accent-soft);
	color: var(--tqb-accent);
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 18px;
	width: fit-content;
}
.tqb-listening__playing-dot {
	width: 8px;
	height: 8px;
	background: var(--tqb-accent);
	border-radius: 50%;
	animation: tqb-pulse 1.2s infinite;
}

/* Slide-phase audio indicator */
.tqb-listening__audio-indicator {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 24px;
	border-radius: 24px;
	background: var(--tqb-accent-soft);
	color: var(--tqb-accent);
	font-weight: 600;
	font-size: 15px;
}
.tqb-listening__audio-indicator--done {
	background: var(--tqb-ok-soft);
	color: var(--tqb-ok);
}
.tqb-listening__playing-dot--done {
	background: var(--tqb-ok);
	animation: none;
}

/* MC options dim while audio plays */
.tqb-mc__opt--disabled {
	cursor: not-allowed;
	opacity: 0.4;
}

@media (max-width: 900px) {
	.tqb-listening {
		grid-template-columns: 1fr;
		gap: 24px;
	}
}


/* ============================================================
   Task type: Build a Sentence
   ============================================================ */
.tqb-build__dialog {
	max-width: 900px;
	margin: 40px auto 24px;
	font-size: 18px;
	line-height: 2.2;
}

.tqb-build__qnum {
	max-width: 900px;
	margin: 32px auto 8px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--tqb-ink-faint);
}

.tqb-build__line {
	display: flex;
	align-items: baseline;
	gap: 14px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.tqb-build__speaker {
	font-weight: 700;
	color: var(--tqb-accent);
	min-width: 24px;
}

.tqb-build__prompt {
	color: var(--tqb-ink);
}

.tqb-build__sentence {
	display: inline;
	line-height: 2.6;
	color: var(--tqb-ink);
}

.tqb-build__slots {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: baseline;
}

.tqb-build__slot {
	display: inline-block;
	min-width: 48px;
	min-height: 1.5em;
	padding: 2px 10px;
	margin: 0 4px;
	border-bottom: 1.5px solid var(--tqb-accent);
	background: var(--tqb-accent-soft);
	border-radius: 3px;
	font-family: inherit;
	color: var(--tqb-ink-faint);
	text-align: center;
	cursor: default;
	vertical-align: baseline;
	transition: background 0.12s;
}
.tqb-build__slot--filled {
	background: var(--tqb-accent);
	color: #fff;
	cursor: pointer;
}
.tqb-build__slot--filled:hover {
	background: var(--tqb-accent-2);
}

.tqb-build__bank {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	max-width: 900px;
	margin: 20px auto 0;
	padding-top: 20px;
	border-top: 1px solid var(--tqb-border);
}

.tqb-build__chip {
	display: inline-block;
	padding: 8px 16px;
	background: #fff;
	border: 1.5px solid var(--tqb-border);
	border-radius: 24px;
	font-size: 16px;
	color: var(--tqb-ink);
	cursor: pointer;
	transition: border-color 0.12s, background 0.12s;
}
.tqb-build__chip:hover {
	border-color: var(--tqb-accent);
	background: var(--tqb-surface);
}
.tqb-build__chip--used {
	opacity: 0.25;
	cursor: not-allowed;
	pointer-events: none;
}


/* ============================================================
   Task type: Fill in the Missing Letters
   ============================================================ */
.tqb-task--fill-letters {
	max-width: 1100px;
	margin: 40px auto 0;
	font-size: 18px;
	line-height: 2.4;
	color: var(--tqb-ink);
	text-align: left;
}

.tqb-fill-blank {
	display: inline-block;
	background: var(--tqb-accent-soft);
	border: none;
	border-bottom: 1.5px solid var(--tqb-accent);
	border-radius: 2px;
	padding: 0 4px;
	margin: 0 1px;
	text-align: center;
	font-family: "SF Mono", Menlo, Consolas, monospace;
	font-size: 16px;
	color: var(--tqb-accent);
	outline: none;
	letter-spacing: 0.08em;
	vertical-align: baseline;
	transition: background 0.1s;
	min-width: 2.2em;
}
.tqb-fill-blank:focus {
	background: #d6e3f0;
	box-shadow: inset 0 -2px 0 var(--tqb-accent);
}
.tqb-fill-blank::placeholder {
	color: var(--tqb-ink-fainter);
	letter-spacing: 0.15em;
	opacity: 0.8;
}
.tqb-fill-blank:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ============================================================
   Task type: Casual Text — two-column (stimulus left, question right)
   ============================================================ */
.tqb-task--casual {
	display: grid;
	grid-template-columns: 1fr 1px 1fr;
	gap: 32px;
	max-width: 1100px;
	margin: 0 auto;
	align-items: start;
}
.tqb-task--casual::before {
	content: '';
	grid-column: 2;
	align-self: stretch;
	background: var(--tqb-border);
}

.tqb-stimulus {
	/* No rectangle. Stimulus is just stacked content (image + text). */
	padding: 0;
	background: transparent;
	border: 0;
	align-self: start;
	grid-column: 1;
}

.tqb-stimulus__image {
	margin: 0 0 16px;
}
.tqb-stimulus__image img {
	display: block;
	width: 100%;
	height: auto;
}

.tqb-stimulus__body {
	color: var(--tqb-ink);
	line-height: 1.7;
	text-align: justify;
}

.tqb-task__question-col {
	align-self: start;
	grid-column: 3;
}

/* ============================================================
   Task type: Academic Text — single column, page scrolls
   ============================================================ */
.tqb-task--academic {
	max-width: 800px;
	margin: 0 auto;
}

.tqb-passage {
	font-size: 16px;
	line-height: 1.85;
	color: var(--tqb-ink);
	text-align: justify;
	margin-bottom: 36px;
}
.tqb-passage p { margin: 0 0 14px; }

@media (max-width: 900px) {
	.tqb-task--casual {
		grid-template-columns: 1fr;
		gap: 24px;
	}
	.tqb-task--casual::before { display: none; }
	.tqb-stimulus,
	.tqb-task__question-col { grid-column: auto; }
}

/* ============================================================
   Responsive (legacy block)
   ============================================================ */
@media (max-width: 900px) {
	.tqb-frontend {
		margin: 12px;
		min-height: 400px;
	}
	.tqb-main { padding: 24px 20px; }
	.tqb-header,
	.tqb-footer { padding: 12px 16px; }
	.tqb-onb__title { font-size: 24px; }
	.tqb-task__headline { font-size: 18px; }
	.tqb-results__main { font-size: 56px; }
	.tqb-header__counter { display: none; }
}

/* ============================================================
   Writing tasks (Email, Academic Discussion)
   ============================================================ */
.tqb-writing--two-pane {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 24px;
	align-items: stretch;
	min-height: 480px;
}
.tqb-writing__pane {
	display: flex;
	flex-direction: column;
}
.tqb-writing__pane--prompt {
	border-right: 1px solid var(--tqb-border);
	padding-right: 24px;
	overflow-y: auto;
	max-height: 70vh;
}
.tqb-writing__pane--answer {
	gap: 12px;
}
.tqb-writing__headline {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 12px;
	color: var(--tqb-ink);
}
.tqb-writing__scenario,
.tqb-writing__instructions {
	font-size: 15px;
	line-height: 1.6;
	color: var(--tqb-ink);
	margin-bottom: 18px;
}
.tqb-writing__bullets {
	background: var(--tqb-surface);
	border-left: 3px solid var(--tqb-accent);
	padding: 12px 16px;
	border-radius: 4px;
	margin-top: 12px;
}
.tqb-writing__bullets-title {
	font-weight: 700;
	margin-bottom: 6px;
	font-size: 14px;
}
.tqb-writing__bullets ul {
	margin: 0;
	padding-left: 20px;
}
.tqb-writing__bullets li {
	margin: 3px 0;
	font-size: 14px;
}

.tqb-discussion__post {
	background: var(--tqb-surface);
	border: 1px solid var(--tqb-border);
	border-radius: 6px;
	padding: 12px 14px;
	margin-bottom: 12px;
}
.tqb-discussion__post--prof {
	border-left: 3px solid var(--tqb-accent);
}
.tqb-discussion__author {
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--tqb-accent);
}

.tqb-writing__textarea {
	width: 100%;
	min-height: 380px;
	padding: 14px;
	font-size: 15px;
	line-height: 1.55;
	font-family: inherit;
	border: 1.5px solid var(--tqb-border);
	border-radius: 6px;
	resize: vertical;
	background: #fff;
	color: var(--tqb-ink);
	box-sizing: border-box;
}
.tqb-writing__textarea:focus {
	outline: none;
	border-color: var(--tqb-accent);
}
.tqb-writing__bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}
.tqb-writing__count {
	font-size: 13px;
	color: var(--tqb-ink-soft);
}
.tqb-writing__count-value {
	font-weight: 700;
	color: var(--tqb-ink);
}

@media (max-width: 900px) {
	.tqb-writing--two-pane {
		grid-template-columns: 1fr;
	}
	.tqb-writing__pane--prompt {
		border-right: none;
		border-bottom: 1px solid var(--tqb-border);
		padding-right: 0;
		padding-bottom: 16px;
		max-height: 50vh;
	}
}

/* ============================================================
   Writing tasks — typography overrides (themes like The7 use very
   aggressive heading styles that need explicit reset).
   ============================================================ */
.tqb-writing__prompt h1,
.tqb-writing__prompt h2,
.tqb-writing__prompt h3,
.tqb-writing__prompt h4,
.tqb-writing__prompt p,
.tqb-writing__prompt li,
.tqb-writing__prompt blockquote {
	font-family: inherit !important;
	color: var(--tqb-ink) !important;
	line-height: 1.55 !important;
}
.tqb-writing__headline {
	font-size: 18px !important;
	font-weight: 700 !important;
	margin: 0 0 14px !important;
	letter-spacing: 0 !important;
}
.tqb-writing__scenario,
.tqb-writing__instructions {
	font-size: 15px !important;
	margin: 0 0 16px !important;
}
.tqb-writing__scenario p,
.tqb-writing__instructions p {
	margin: 0 0 8px !important;
	font-size: 15px !important;
}
.tqb-writing__instructions p:last-child,
.tqb-writing__scenario p:last-child {
	margin-bottom: 0 !important;
}

/* Avatar circles for discussion posts */
.tqb-discussion__post {
	display: grid;
	grid-template-columns: 48px 1fr;
	gap: 12px;
	align-items: start;
}
.tqb-discussion__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--tqb-accent);
	color: #fff;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	overflow: hidden;
	flex-shrink: 0;
}
.tqb-discussion__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.tqb-discussion__body {
	min-width: 0;
}
.tqb-discussion__author {
	font-weight: 700 !important;
	font-size: 14px !important;
	margin: 0 0 4px !important;
	color: var(--tqb-accent) !important;
}
.tqb-discussion__post .tqb-rich,
.tqb-discussion__post .tqb-rich p {
	font-size: 14px !important;
	margin: 0 0 4px !important;
	color: var(--tqb-ink) !important;
}
.tqb-discussion__post .tqb-rich p:last-child {
	margin-bottom: 0 !important;
}

/* Review: writing / pending state */
.tqb-review__item--pending {
	border-left-color: #8a6d3b !important;
}
.tqb-review__badge--pending {
	background: #fdf3e1;
	color: #8a6d3b;
}
.tqb-review__writing {
	margin-top: 8px;
}
.tqb-review__writing-text {
	margin-top: 6px;
	padding: 12px 14px;
	background: var(--tqb-surface);
	border: 1px solid var(--tqb-border);
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.55;
	white-space: pre-wrap;
	color: var(--tqb-ink);
}

/* Email header above the answer area (To: / Subject:) */
.tqb-writing__email-header {
	padding: 10px 12px;
	background: var(--tqb-surface);
	border: 1px solid var(--tqb-border);
	border-radius: 6px 6px 0 0;
	border-bottom: none;
	font-size: 14px;
	color: var(--tqb-ink);
}
.tqb-writing__email-line { margin: 2px 0; }
.tqb-writing__email-label { font-weight: 700; }
.tqb-writing__email-value { font-weight: 400; }
.tqb-writing__email-header + .tqb-writing__textarea {
	border-radius: 0 0 6px 6px;
	border-top: 1px solid var(--tqb-border);
}

/* Word-count hide toggle */
.tqb-writing__bar-left {
	display: flex;
	align-items: center;
	gap: 14px;
}
.tqb-writing__count--hidden .tqb-writing__count-value {
	visibility: hidden;
}
.tqb-writing__hide-toggle {
	background: none;
	border: none;
	color: var(--tqb-accent);
	font-size: 12px;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 3px;
}
.tqb-writing__hide-toggle:hover {
	background: var(--tqb-surface);
}

/* ── Onboarding auth choice (v0.20.4) ────────────────────────── */
.tqb-onb__auth-choice {
  margin: 20px 0;
  padding: 20px 24px;
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.tqb-onb__auth-hint {
  margin: 0 0 14px;
  color: #555;
  font-size: 14px;
}
.tqb-onb__auth-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tqb-onb__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: #aaa;
  font-size: 13px;
}
.tqb-onb__divider::before,
.tqb-onb__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.tqb-onb__guest-mode { margin-top: 4px; }
.tqb-onb__user-block {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  padding: 12px 16px;
  background: #f0f9f4;
  border: 1px solid #bbddd0;
  border-radius: 8px;
  font-size: 14px;
}
.tqb-onb__user-name { color: #2e7d52; font-weight: 600; }
.tqb-onb__dash-link { color: #2c3e6b; font-size: 13px; }
.tqb-btn--secondary {
  background: #fff;
  color: #2c3e6b;
  border: 2px solid #2c3e6b;
}
.tqb-btn--secondary:hover { background: #f0f4ff; }
