/* Shared interface components. site.css extends these across public, account and staff pages. */
.study-app {
  --ink: #172e49;
  --muted: #53647a;
  --line: #dce3eb;
  --paper: #fff;
  --blue: #174ec4;
  --navy: #112d4a;
  --green: #146348;
  --red: #a02e34;
  margin: 0;
  background: #f4f6f9;
  color: var(--ink);
  font:
    16px/1.6 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  overflow-wrap: anywhere;
}
.study-app * {
  box-sizing: border-box;
}
.study-app [hidden] {
  display: none !important;
}
.study-app a {
  color: var(--blue);
}
.study-app a:hover {
  text-decoration: none;
}
.study-app :focus-visible {
  outline: 3px solid #c2770a;
  outline-offset: 4px;
}
.study-app button:not(.brick-container *),
.study-app select:not(.brick-container *),
.study-app input:not(.brick-container *),
.study-app textarea:not(.brick-container *) {
  font: inherit;
}
.study-app h1,
.study-app h2,
.study-app h3 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
}
.study-app h1 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  margin: 0 0 16px;
}
.study-app h2 {
  font-size: 1.35rem;
  margin: 0 0 14px;
}
.study-app h3 {
  font-size: 1.08rem;
  margin: 0 0 12px;
}
.study-app p {
  margin: 0 0 16px;
}
.study-app button:not(.brick-container *) {
  cursor: pointer;
}
.study-app button:not(.brick-container *):disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.study-app .muted {
  color: var(--muted);
}
.study-header {
  height: 80px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 0 max(24px, calc((100vw - 1160px) / 2));
  position: relative;
  z-index: 20;
}
.study-brand {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 21px;
  font-weight: 800;
  color: var(--navy) !important;
  white-space: nowrap;
  letter-spacing: -0.8px;
}
.study-brand > span:last-child {
  color: var(--blue);
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  border-radius: 11px;
  width: 36px;
  height: 36px;
  margin-right: 9px;
  font-size: 24px;
  font-style: italic;
}
.study-nav {
  display: flex;
  gap: 6px;
  flex: 1;
}
.study-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.study-nav a[aria-current] {
  background: #edf2fc;
  color: #1545a5;
}
.study-nav a > span {
  font-size: 22px;
  line-height: 1;
}
.account-menu {
  position: relative;
  font-size: 14px;
  white-space: nowrap;
}
.account-menu summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}
.account-menu > div {
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 220px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px #132f4d15;
  border-radius: 12px;
}
.account-menu a {
  display: block;
  padding: 12px;
  color: var(--ink);
}
.account-menu a:hover {
  background: #edf2fc;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 100;
  background: white;
  padding: 12px;
}
.skip-link:focus {
  top: 10px;
}
.study-main {
  width: min(1120px, calc(100% - 48px));
  margin: 42px auto 60px;
  min-height: 65vh;
}
.page-heading {
  margin-bottom: 28px;
  max-width: 720px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px !important;
}
.study-hero {
  padding: 36px 40px;
  border-radius: 20px;
  background: var(--navy);
  color: white;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}
.study-hero p {
  max-width: 580px;
  color: #d2deed;
}
.study-hero .eyebrow {
  color: #a9c7ef;
}
.study-hero .btn-primary {
  background: white;
  color: var(--navy);
  border-color: white;
}
.hero-aside {
  border-left: 1px solid #ffffff35;
  padding-left: 30px;
  min-width: 155px;
}
.hero-aside strong {
  display: block;
  font-size: 42px;
  line-height: 1.2;
  letter-spacing: -0.05em;
}
.hero-aside span {
  font-size: 13px;
  color: #d2deed;
}
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.study-app .btn-primary,
.study-app .btn-secondary,
.study-app .btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
  line-height: 1.4;
}
.study-app .btn-primary {
  background: var(--blue);
  color: white;
}
.study-app .btn-primary:hover {
  filter: brightness(0.93);
}
.study-app .btn-secondary {
  background: white;
  border-color: #c6d1df;
  color: var(--ink);
}
.study-app .btn-quiet {
  background: transparent;
  color: var(--blue);
}
.study-hero .btn-quiet {
  color: white;
}
.study-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.study-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.study-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  min-width: 0;
}
.study-card p {
  color: var(--muted);
  font-size: 14px;
}
.card-index {
  display: block;
  color: var(--blue);
  font:
    700 12px/1.5 ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  margin-bottom: 22px;
}
.card-link {
  font-weight: 650;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-heading h2 {
  margin: 0;
}
.empty-state {
  padding: 30px;
  text-align: center;
  background: white;
  border: 1px dashed #bdcada;
  border-radius: 14px;
}
.empty-state p {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 18px;
}
.notice {
  padding: 18px 22px;
  border-radius: 12px;
  background: #eaf0fa;
  border: 1px solid #cedcf2;
  margin: 0 0 24px;
  font-size: 14px;
}
.notice p:last-child {
  margin: 0;
}
.study-footer {
  border-top: 1px solid var(--line);
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
.study-app #flash-overlay {
  position: static;
  background: none;
  width: auto;
  height: auto;
  display: block;
}
.study-app #flash-message {
  max-width: 1120px;
  margin: 16px auto !important;
  padding: 0 24px;
}
.study-app .alert {
  opacity: 1;
  margin-bottom: 10px;
}
.study-app label:not(.brick-container *) {
  font-weight: 550;
}
.study-app select:not(.brick-container *),
.study-app input:not(.brick-container *)[type="search"],
.study-app textarea:not(.brick-container *) {
  width: 100%;
  border: 1px solid #b9c6d5;
  background: white;
  border-radius: 9px;
  padding: 12px;
  color: var(--ink);
  min-height: 48px;
}
.study-app textarea:not(.brick-container *) {
  min-height: 110px;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
.field-help {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.study-app fieldset {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
.study-app legend {
  font-size: 18px;
  font-weight: 700;
  width: auto;
  float: none;
  margin: 0;
}
.subject-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.subject-list {
  max-height: 350px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.subject-choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 8px;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  min-height: 46px;
}
.subject-choice:hover,
.subject-choice:has(:checked) {
  background: #edf2fc;
}
.study-app input:not(.brick-container *)[type="checkbox"],
.study-app input:not(.brick-container *)[type="radio"] {
  accent-color: var(--blue);
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  margin-top: 3px;
}
.form-actions {
  padding: 20px 0;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.form-actions p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.inline-error {
  padding: 14px 18px;
  border-left: 4px solid var(--red);
  background: #fff0f0;
  color: #762128;
  border-radius: 6px;
  margin: 16px 0;
}
.record-list {
  display: grid;
  gap: 12px;
}
.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.record h3 {
  margin: 0 0 5px;
}
.record p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.score {
  font-weight: 750;
  font-size: 24px;
  white-space: nowrap;
}
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  background: #edf2fc;
  color: #254571;
  line-height: 1.3;
  font-weight: 600;
}
.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.study-table-wrap {
  overflow: auto;
  max-width: 100%;
}
.study-app table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.study-app th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  background: #f5f7fa;
}
.study-app td,
.study-app th {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}
.current-user-row {
  background: #edf2fc;
}
.result-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.result-stats strong {
  display: block;
  font-size: 24px;
}
.result-stats span {
  font-size: 13px;
  color: var(--muted);
}
.good {
  color: var(--green);
}
.bad {
  color: var(--red);
}
@media (max-width: 900px) {
  .study-header {
    gap: 12px;
    padding: 0 20px;
  }
  .study-nav a {
    padding: 12px 8px;
  }
  .study-brand {
    font-size: 18px;
  }
  .study-nav a > span {
    display: none;
  }
  .study-grid {
    gap: 12px;
  }
  .study-card {
    padding: 20px;
  }
}
@media (max-width: 680px) {
  .study-header {
    height: 68px;
    justify-content: space-between;
  }
  .study-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--line);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    gap: 4px;
    z-index: 30;
    justify-content: space-around;
  }
  .study-nav a {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    padding: 7px 4px;
    border-radius: 8px;
  }
  .study-nav a > span {
    display: block;
    font-size: 23px;
  }
  .study-main {
    width: calc(100% - 32px);
    margin: 26px auto 36px;
  }
  .study-hero {
    padding: 26px 24px;
    display: block;
    border-radius: 16px;
    margin-bottom: 24px;
  }
  .hero-aside {
    display: none;
  }
  .study-grid,
  .study-grid.two,
  .field-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .study-grid {
    margin-bottom: 24px;
  }
  .card-index {
    margin-bottom: 14px;
  }
  .study-card {
    padding: 22px;
  }
  .page-heading {
    margin-bottom: 24px;
  }
  .study-footer {
    padding-bottom: 105px;
  }
  .form-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .record {
    padding: 18px 16px;
    flex-wrap: wrap;
  }
  .record .actions {
    width: 100%;
    justify-content: space-between;
  }
  .result-stats {
    gap: 20px;
  }
  .section-heading {
    align-items: flex-start;
  }
  .subject-list {
    max-height: 290px;
  }
  .study-app .btn-primary,
  .study-app .btn-secondary {
    min-height: 48px;
  }
  .study-app h1 {
    font-size: 30px;
  }
  .study-app td,
  .study-app th {
    padding: 12px 8px;
  }
  .study-app th {
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .study-app * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

.study-app fieldset.study-card {
  padding: 24px;
  border: 1px solid var(--line);
}
.subject-heading h2 { margin: 0; }

/* Shared accessibility utility, including previews without external Bootstrap. */
.study-app .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
