:root {
  color-scheme: light;
  --paper: #f6f8fc;
  --card: #ffffff;
  --ink: #152342;
  --sub: #46536e;
  --line: #d9e1ed;
  --indigo: #243b90;
  --blue: #3154d1;
  --pale: #eff3ff;
  --warn: #94361d;
  --green: #1e684b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  overscroll-behavior-y: contain;
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
select,
textarea,
a,
summary,
label.choice {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(49, 84, 209, 0.14);
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: .62rem .92rem;
  min-height: 44px;
  font-weight: 650;
  line-height: 1.25;
  transition: background-color .14s ease, border-color .14s ease, transform .08s ease;
}

button:hover:not(:disabled) {
  background: var(--pale);
}

button:active:not(:disabled) {
  transform: scale(0.985);
}

button:disabled {
  opacity: .46;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #8aa1ff;
  outline-offset: 2px;
}

.primary,
.primary:hover {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

.primary:hover:not(:disabled) {
  filter: brightness(.94);
}

.subtle {
  background: transparent;
}

.danger {
  color: var(--warn);
}

a {
  color: var(--indigo);
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .2rem .15rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.header-inner {
  max-width: 1170px;
  margin: auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .5rem 1.15rem;
}

.brand {
  display: inline-flex;
  gap: .6rem;
  align-items: center;
  border: 0;
  background: transparent;
  padding: .25rem .35rem .25rem .15rem;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 750;
  white-space: nowrap;
}

.monogram {
  border-radius: 8px;
  background: var(--indigo);
  color: #ffffff;
  font-size: .74rem;
  letter-spacing: .08em;
  font-weight: 800;
  padding: .42rem .5rem;
  line-height: 1;
}

.header-actions,
.nav {
  display: flex;
  gap: .35rem;
  align-items: center;
}

.header-actions {
  margin-left: auto;
}

.nav button,
.header-actions button {
  border-color: transparent;
  background: transparent;
  color: var(--sub);
  padding: .48rem .72rem;
  min-height: 44px;
}

.nav button[aria-current="page"] {
  background: var(--pale);
  color: var(--indigo);
}

.language {
  white-space: nowrap;
}

/* Main container */
main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.7rem max(1.25rem, var(--safe-right)) 4rem max(1.25rem, var(--safe-left));
  outline: none;
  flex: 1 0 auto;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.65rem, 4.2vw, 3rem);
  letter-spacing: -.035em;
  line-height: 1.18;
  margin-bottom: .75rem;
}

h2 {
  font-size: 1.24rem;
  line-height: 1.35;
  margin-bottom: .7rem;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.4;
  margin-bottom: .55rem;
}

.intro {
  padding: 0 0 1.2rem;
}

.intro > .row + h1,
.intro > button + h1 {
  margin-top: .8rem;
}

.intro p,
.muted {
  color: var(--sub);
}

.eyebrow {
  font-size: .78rem;
  letter-spacing: .1em;
  font-weight: 800;
  color: var(--indigo);
  margin: 0 0 .55rem;
  text-transform: uppercase;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-section {
  margin-top: 1.25rem;
}

.dash-section,
.exam-card {
  min-width: 0;
}

.dash-section p {
  margin: .35rem 0 .95rem;
}

.resume-banner {
  margin-bottom: 1.1rem;
  border-color: #c5d4ff;
  background: #f6f8ff;
}

.resume-banner h3 {
  margin: 0 0 .35rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
}

.skill-card .skill-desc {
  color: var(--ink);
  font-size: .95rem;
  margin: 0 0 .65rem;
}

.skill-card > button {
  margin-top: auto;
  align-self: flex-start;
}

.set-bar label {
  font-weight: 700;
}

.practice-grade-box {
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: .6rem;
}

.practice-grade-actions {
  align-items: center;
}

.tag[data-state="pending"] {
  background: #fff6e6;
  color: #8a5300;
}

.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: .6rem;
}

.part-grid button {
  text-align: left;
  padding: .68rem .8rem;
  min-height: 64px;
}

.part-grid button span {
  display: block;
  margin-top: .15rem;
  font-size: .82rem;
  font-weight: 550;
  color: var(--sub);
}

.part-grid button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--pale);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.row,
.wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: .75rem;
}

/* Login */
.login {
  display: grid;
  grid-template-columns: 1.35fr minmax(0, 350px);
  align-items: center;
  gap: 2rem;
  padding: min(10vh, 7rem) 0 0;
}

.login-form {
  display: grid;
  gap: .75rem;
}

.login-form label {
  font-weight: 700;
}

.login-form button {
  margin-top: .35rem;
  min-height: 48px;
}

.login-copy p:not(.eyebrow) {
  max-width: 39ch;
  color: var(--sub);
}

/* Form controls — always >= 16px to prevent iOS/WebView zoom on focus */
input,
select,
textarea {
  border: 1px solid #c3ccdc;
  background: #ffffff;
  color: var(--ink);
  border-radius: 10px;
  padding: .62rem .8rem;
  font-size: max(16px, 1rem);
  line-height: 1.45;
  min-height: 44px;
  max-width: 100%;
}

input[type="radio"] {
  min-height: auto;
  padding: 0;
}

input[type="number"] {
  width: 96px;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 148px;
  margin-top: .55rem;
  line-height: 1.62;
}

.meta {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  color: var(--sub);
  font-size: .88rem;
}

.tag {
  background: #edf1f8;
  color: var(--ink);
  padding: .2rem .55rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: .86rem;
  line-height: 1.3;
}

.tag[data-state="wrong"],
.tag[data-state="needs-work"] {
  background: #fff1ec;
  color: #873016;
}

.tag[data-state="correct"] {
  background: #e8f5ef;
  color: var(--green);
}

/* Sticky Timing Bar */
.timing {
  position: sticky;
  top: calc(var(--safe-top) + .35rem);
  z-index: 4;
  box-shadow: 0 3px 14px rgba(21, 35, 66, 0.11);
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: .55rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  gap: .55rem;
}

.timing-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  min-width: 0;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.38rem;
  font-weight: 820;
  color: var(--indigo);
  line-height: 1.2;
  white-space: nowrap;
}

.timer[data-low="true"] {
  color: var(--warn);
}

.exam-card {
  margin-bottom: .8rem;
}

#exam-layout {
  scroll-margin-top: 5.5rem;
}

.exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.exam-layout.single {
  grid-template-columns: minmax(0, 1fr);
}

.passage {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 1rem;
  line-height: 1.68;
}

.picture {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 55vh;
  margin: .45rem auto .95rem;
  border-radius: 10px;
  object-fit: contain;
}

.question {
  border: 0;
  margin: 0 0 1.2rem;
  padding: 0;
  min-width: 0;
  line-height: 1.55;
}

.question:last-child {
  margin-bottom: 0;
}

.question legend {
  font-weight: 750;
  font-size: 1.02rem;
  line-height: 1.5;
  margin-bottom: .55rem;
  overflow-wrap: anywhere;
  width: 100%;
}

.question label:not(.choice) {
  display: inline-block;
  font-weight: 650;
  margin-top: .4rem;
}

/* Multiple choice touch cards */
.choice {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .62rem .8rem;
  min-height: 46px;
  margin-top: .42rem;
  border-radius: 10px;
  border: 1px solid #e2e8f3;
  background: #fafcff;
  cursor: pointer;
  line-height: 1.5;
  transition: background-color .12s ease, border-color .12s ease, transform .08s ease;
}

.choice:hover {
  background: var(--pale);
  border-color: #c2d0ff;
}

.choice:active {
  transform: scale(0.99);
}

.choice:has(:checked) {
  background: var(--pale);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(49, 84, 209, 0.25);
}

.choice input {
  flex: none;
  accent-color: var(--blue);
  width: 18px;
  height: 18px;
  margin: .2rem 0 0;
}

.choice span:last-child {
  overflow-wrap: anywhere;
  word-break: normal;
}

.letter {
  display: inline-block;
  font-weight: 800;
  color: var(--indigo);
  min-width: 1.15rem;
  flex: none;
}

ol,
ul {
  padding-left: 1.35rem;
}

audio {
  width: 100%;
  margin: .35rem 0;
  min-height: 44px;
}

.audio-inline {
  max-width: 30rem;
}

/* History & Review */
.history-item,
.review-card {
  margin-bottom: .85rem;
}

.history-item h3 {
  margin: 0;
}

.history-item p {
  margin: .3rem 0;
}

.review-card > .row {
  margin-bottom: .65rem;
  align-items: flex-start;
}

.review-card > .row h3 {
  margin: 0;
  flex: 1 1 200px;
}

.review-card > p {
  margin-bottom: .55rem;
  line-height: 1.62;
}

.review-filters {
  margin-bottom: .9rem;
}

.review-filters button[aria-pressed="true"] {
  background: var(--pale);
  color: var(--indigo);
  border-color: var(--blue);
}

.feedback {
  margin-top: .9rem;
  padding: 1rem;
  border-radius: 12px;
  background: #f1f4fb;
  border: 1px solid #dce3f2;
  display: grid;
  gap: .6rem;
}

.feedback p {
  margin: 0;
  line-height: 1.62;
}

.feedback ul {
  margin: .35rem 0 0;
  display: grid;
  gap: .4rem;
}

.feedback li {
  line-height: 1.58;
}

.feedback details {
  background: #ffffff;
  border: 1px solid #dce3f2;
  border-radius: 10px;
  padding: .15rem .65rem;
}

.quote {
  margin: .6rem 0;
  padding: .7rem .9rem;
  border-left: 3px solid #8399e8;
  border-radius: 0 8px 8px 0;
  background: #f4f6fc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
}

.media-note {
  font-size: .82rem;
  color: var(--sub);
  margin: .55rem 0 0;
}

.summary {
  font-size: 1.06rem;
  font-weight: 750;
  color: var(--indigo);
}

.subhead {
  margin: 1rem 0 .65rem;
}

/* Prev/Next & Question Navigation */
#exam-navigation {
  margin: .85rem 0;
}

.qnav-shell {
  margin: .75rem 0 .9rem;
  padding: .85rem 1rem;
}

.qnav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .5rem;
}

.qnav-summary {
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink);
}

.qnav-toggle {
  display: none;
  padding: .42rem .75rem;
  font-size: .88rem;
  min-height: 44px;
  white-space: nowrap;
}

.progress-nav {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  padding: .2rem 0;
}

.progress-nav button {
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-width: 44px;
  min-height: 44px;
  padding: .38rem .58rem;
  font-size: .88rem;
  border-radius: 9px;
}

.progress-nav button[data-answered="true"] {
  background: #edf3ff;
  border-color: #b7c8f7;
  color: var(--indigo);
}

.progress-nav button[data-graded="true"] {
  background: #e3f5ec;
  border-color: #7cc4a3;
  color: #124d34;
  font-weight: 750;
}

.progress-nav button[data-grading="true"] {
  background: #fff6e6;
  border-color: #e6c27a;
  color: #8a5300;
}

.progress-nav button[aria-current="true"] {
  border-color: var(--blue);
  background: var(--pale);
  color: var(--indigo);
  box-shadow: inset 0 0 0 1.5px var(--blue);
}

.progress-nav button[data-graded="true"][aria-current="true"] {
  background: #d7f1e4;
  border-color: var(--green);
  color: #124d34;
  box-shadow: inset 0 0 0 1.5px var(--green);
}

/* Tables with responsive scroll hint */
.table-block {
  display: grid;
  gap: .35rem;
  min-width: 0;
}

.table-scroll-hint {
  display: none;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 650;
  color: var(--indigo);
  background: var(--pale);
  border: 1px solid #d5e0ff;
  border-radius: 999px;
  padding: .24rem .68rem;
  width: fit-content;
  margin: 0;
}

.table-block.is-scrollable .table-scroll-hint {
  display: inline-flex;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  max-width: 100%;
}

.table-wrap.is-scrollable:not(.at-end) {
  box-shadow: inset -18px 0 18px -14px rgba(21, 35, 66, 0.28);
}

.info-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: .92rem;
  line-height: 1.48;
}

.info-table th,
.info-table td {
  border-bottom: 1px solid var(--line);
  padding: .52rem .65rem;
  text-align: left;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: break-word;
}

.info-table tr:last-child td {
  border-bottom: 0;
}

.info-table th {
  background: #f2f5fb;
  font-weight: 700;
  color: var(--ink);
}

.hint {
  font-size: .9rem;
  color: var(--sub);
}

details {
  margin: .35rem 0;
}

details > summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: .45rem .65rem;
  border-radius: 8px;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::after {
  content: "▾";
  font-size: .92em;
  color: var(--sub);
  flex: none;
  transition: transform .16s ease;
  transform: rotate(-90deg);
}

details[open] > summary::after {
  transform: rotate(0deg);
}

details > summary:hover {
  background: rgba(49, 84, 209, 0.06);
}

.details-text {
  margin: .45rem 0 .65rem;
  padding: 0 .25rem;
}

.speaking-text-toggle {
  margin: .85rem 0 .15rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
}

.speaking-text-toggle > summary {
  min-height: 46px;
  padding: .55rem .85rem;
  border-radius: 10px;
  color: var(--indigo);
  font-size: .95rem;
}

.speaking-text-toggle[open] > summary {
  border-bottom: 1px solid #e4eaf4;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.speaking-text-body {
  margin: 0;
  padding: .75rem .85rem .85rem;
}

.question label.speaking-text-hint {
  display: block;
  margin: 0;
  font-weight: 500;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--sub);
}

.speaking-text-toggle textarea {
  margin-top: .5rem;
  min-height: 120px;
  font-size: max(16px, 1rem);
}

.status {
  color: var(--sub);
  font-size: .9rem;
}

#notice {
  position: fixed;
  z-index: 20;
  right: max(1rem, var(--safe-right));
  bottom: calc(1rem + var(--safe-bottom));
  max-width: min(32rem, calc(100% - 2rem));
  border: 1px solid #e2b3a4;
  background: #fff4ee;
  color: #762b19;
  border-radius: 12px;
  padding: .8rem 1rem;
  box-shadow: 0 6px 24px rgba(21, 35, 66, 0.16);
}

#notice[data-tone="ok"] {
  border-color: #a9d9c2;
  background: #edf9f2;
  color: #16593f;
}

/* Admin Panel */
.admin-form {
  display: grid;
  gap: .85rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.admin-field {
  display: grid;
  gap: .35rem;
  min-width: 0;
}

.admin-field label {
  font-weight: 700;
  font-size: .92rem;
}

.admin-field input {
  width: 100%;
}

.admin-form-actions {
  justify-content: flex-start;
}

.admin-user-list {
  display: grid;
  gap: .75rem;
}

.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1rem;
  background: #fbfcff;
  display: grid;
  gap: .6rem;
  min-width: 0;
}

.admin-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  flex-wrap: wrap;
}

.admin-user-title {
  gap: .45rem;
}

.admin-user-title strong {
  font-size: 1.05rem;
  color: var(--ink);
  word-break: break-all;
}

.admin-user-actions {
  gap: .45rem;
}

.admin-inline-form {
  display: grid;
  gap: .55rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
}

.admin-inline-form input {
  width: 100%;
  max-width: 22rem;
}

.tag[data-state="admin"] {
  background: var(--pale);
  color: var(--indigo);
}

.tag[data-state="active-user"] {
  background: #e8f5ef;
  color: var(--green);
}

.tag[data-state="disabled-user"] {
  background: #fff1ec;
  color: #873016;
}

.credits {
  margin-top: 1.4rem;
  color: var(--sub);
}

/* Screen-reader only (immune to legend width overrides) */
.sr-only,
.question legend.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.word-count {
  margin: .45rem 0 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.directions-card {
  padding: 1.6rem 1.25rem;
}

/* LC Visual Graphics & Tables */
.lc-visual {
  margin: .55rem 0 1.1rem;
  padding: .85rem .95rem;
  border: 1px solid #d2dceb;
  border-radius: 12px;
  background: #f8faff;
  display: grid;
  gap: .65rem;
  min-width: 0;
}

.lc-visual-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .6rem;
}

.lc-visual-title {
  font-weight: 750;
  font-size: .98rem;
  color: var(--ink);
  line-height: 1.35;
}

.lc-graphic-frame {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .35rem;
  overflow: hidden;
  max-width: 100%;
}

.lc-graphic-img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

.lc-visual-note {
  margin: 0;
  font-size: .84rem;
  color: var(--sub);
  line-height: 1.45;
}

/* Writing & Reading Document Cards */
.writing-prompt {
  display: grid;
  gap: .95rem;
  margin: .35rem 0 1.15rem;
}

.writing-prompt p,
.reading-document p {
  margin: 0;
}

.writing-prompt .passage,
.reading-document .passage {
  line-height: 1.68;
}

.writing-instruction {
  padding: .8rem .95rem;
  border-inline-start: 3.5px solid var(--indigo);
  border-radius: 0 10px 10px 0;
  background: #eff3ff;
  line-height: 1.58;
}

.document-fields {
  display: grid;
  grid-template-columns: minmax(max-content, 36%) minmax(0, 1fr);
  gap: .38rem .85rem;
  margin: 0;
  padding: .8rem .9rem;
  border-radius: 10px;
  border: 1px solid #e0e7f3;
  background: #f4f7fc;
}

.document-fields dt {
  font-weight: 700;
  color: var(--indigo);
  font-size: .92rem;
}

.document-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.reading-documents {
  display: grid;
  gap: 1.15rem;
}

.reading-document {
  display: grid;
  gap: .82rem;
  border: 1px solid #d2dceb;
  border-radius: 12px;
  background: #ffffff;
  padding: clamp(.85rem, 2.5vw, 1.15rem);
  min-width: 0;
}

.doc-head {
  display: grid;
  gap: .32rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid #e7edf6;
}

.doc-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--indigo);
  background: var(--pale);
  border: 1px solid #d1ddff;
  border-radius: 999px;
  padding: .16rem .58rem;
}

.reading-document h3,
.reading-document h4 {
  margin: 0;
}

.reading-document h4 {
  font-size: 1.2rem;
  line-height: 1.35;
}

.chat-turn {
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid #e1e8f4;
  background: #f5f8fd;
  line-height: 1.58;
}

.chat-turn strong {
  color: var(--indigo);
}

.chat-turn time {
  margin-inline-start: .6rem;
  font-size: .82em;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.chat-turn p {
  margin-top: .25rem;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* Mobile Responsive Overrides (<= 680px) */
@media (max-width: 680px) {
  .header-inner {
    flex-wrap: wrap;
    gap: .3rem .5rem;
    padding: .42rem .75rem .55rem;
    min-height: 54px;
  }

  .brand {
    font-size: .96rem;
  }

  .header-actions {
    order: 1;
    gap: .15rem;
  }

  .header-actions button {
    padding: .42rem .58rem;
    font-size: .9rem;
  }

  .nav {
    order: 2;
    flex-basis: 100%;
    background: var(--paper);
    padding: .22rem;
    border-radius: 11px;
    border: 1px solid var(--line);
    gap: .25rem;
  }

  .nav button {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
    font-size: .9rem;
    padding: .45rem .35rem;
    white-space: nowrap;
    min-width: 0;
  }

  .nav button[aria-current="page"] {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(21, 35, 66, 0.1);
  }

  main {
    padding: .95rem max(.75rem, var(--safe-right)) 3.25rem max(.75rem, var(--safe-left));
  }

  .panel {
    padding: .9rem .82rem;
    border-radius: 12px;
  }

  .grid,
  .login,
  .exam-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .login {
    gap: 1.1rem;
    padding-top: 1.15rem;
  }

  .part-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Compact single-row sticky timing bar */
  .timing {
    flex-wrap: nowrap;
    margin-left: -.1rem;
    margin-right: -.1rem;
    padding: .42rem .62rem;
    gap: .4rem;
  }

  .timing-meta {
    flex-wrap: nowrap;
    gap: .4rem;
    overflow: hidden;
  }

  .timing .timer {
    font-size: 1.02rem;
  }

  .timing .tag {
    font-size: .82rem;
    padding: .18rem .48rem;
    white-space: nowrap;
  }

  .timing .status[data-state="idle"] {
    display: none;
  }

  .timing .status {
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .timing button {
    padding: .45rem .75rem;
    font-size: .9rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #exam-layout {
    scroll-margin-top: 5.2rem;
  }

  .picture {
    max-height: 40vh;
  }

  .lc-visual {
    padding: .7rem .68rem;
    gap: .5rem;
  }

  .lc-visual-title {
    font-size: .94rem;
  }

  .lc-graphic-frame {
    padding: .2rem;
  }

  .choice {
    min-height: 48px;
    padding: .68rem .78rem;
  }

  /* Thumb-friendly full-width Prev/Next bar */
  #exam-navigation:not(:empty) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
  }

  #exam-navigation button {
    width: 100%;
    min-height: 48px;
  }

  /* Collapsible horizontal swipeable question strip on mobile */
  .qnav-shell {
    padding: .75rem .8rem;
  }

  .qnav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .progress-nav[data-expanded="false"] {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding: .2rem .05rem .35rem;
  }

  .progress-nav[data-expanded="false"] button {
    flex: 0 0 auto;
    scroll-snap-align: center;
  }

  .progress-nav[data-expanded="true"] {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .reading-document {
    padding: .78rem .72rem;
  }

  .document-fields {
    padding: .7rem .75rem;
    gap: .3rem .65rem;
  }

  .info-table {
    font-size: .875rem;
    line-height: 1.45;
  }

  .info-table th,
  .info-table td {
    padding: .46rem .5rem;
  }

  .history-item {
    align-items: flex-start;
  }

  .history-item > .row:last-child {
    width: 100%;
    justify-content: space-between;
    padding-top: .35rem;
    border-top: 1px solid #eef2f8;
  }

  .admin-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-form-actions button {
    width: 100%;
  }

  .admin-user-card {
    padding: .8rem .78rem;
  }

  .admin-inline-form input {
    max-width: 100%;
  }
}
