.chemistry-study { margin-block: var(--space-6); padding: var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); font-family: var(--font-reading); }
.chemistry-study *, .chemistry-study *::before, .chemistry-study *::after { box-sizing: border-box; }
.chemistry-study button, .chemistry-study input, .chemistry-study select { font: inherit; }
.chemistry-study .cs-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-5); }
.chemistry-study h3 { margin: var(--space-1) 0 var(--space-2); font: 500 32px/1.15 var(--font-display); }
.chemistry-study h3 { scroll-margin-block-start: calc(var(--space-7) * 3); }
.chemistry-study h4 { margin: var(--space-2) 0; font: 500 28px/1.2 var(--font-display); }
.chemistry-study p { margin: 0; line-height: 1.5; }
.chemistry-study .cs-heading p:not(.cs-eyebrow) { color: var(--muted); max-width: 48ch; }
.chemistry-study .cs-eyebrow { font-size: var(--text-small); font-weight: 700; color: var(--blue-dark); }
.chemistry-study .cs-local-label { background: var(--cream); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); white-space: nowrap; font-size: var(--text-small); }
.chemistry-study .cs-settings { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-5); margin: 0 0 var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--cream); }
.chemistry-study .cs-settings legend { padding-inline: var(--space-2); font-weight: 700; font-size: var(--text-small); }
.chemistry-study .cs-settings label { display: grid; flex: 1 1 150px; gap: var(--space-2); font-size: var(--text-small); font-weight: 700; }
.chemistry-study select, .chemistry-study input { min-height: var(--target-min); width: 100%; border: 1px solid var(--muted); border-radius: var(--radius-sm); color: var(--ink); background: var(--paper); padding: var(--space-2) var(--space-3); }
.chemistry-study .cs-button { min-width: var(--target-min); min-height: var(--target-min); display: inline-flex; justify-content: center; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); border: 1px solid var(--blue-strong); border-radius: var(--radius-sm); background: var(--blue-strong); color: var(--paper); font-size: var(--text-small); font-weight: 700; cursor: pointer; line-height: 1.3; }
.chemistry-study .cs-button--quiet { background: var(--paper); color: var(--ink); border-color: var(--line); }
.chemistry-study .cs-button:hover:not(:disabled) { border-color: var(--blue-dark); box-shadow: var(--elevation-soft); }
.chemistry-study .cs-button:disabled { color: var(--muted); background: var(--cream); border-color: var(--line); cursor: default; }
.chemistry-study :focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 3px; }
.chemistry-study .cs-toolbar, .chemistry-study .cs-modes, .chemistry-study .cs-stage-header, .chemistry-study .cs-card-navigation { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.chemistry-study .cs-toolbar, .chemistry-study .cs-stage-header, .chemistry-study .cs-card-navigation { justify-content: space-between; }
.chemistry-study .cs-set-note { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: space-between; color: var(--muted); font-size: var(--text-small); margin: var(--space-4) 0; }
.chemistry-study .cs-stage { border-top: 1px solid var(--line); padding-top: var(--space-5); }
.chemistry-study .cs-stage-header { margin-bottom: var(--space-5); font-size: var(--text-small); font-weight: 700; }
.chemistry-study .cs-stage-header span { font-weight: 400; color: var(--muted); }
.chemistry-study .cs-element-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: var(--space-5); padding-block: var(--space-2); }
.chemistry-study .cs-element-tile { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-4); background: var(--nonmetal); border: 2px solid var(--ink); border-radius: var(--radius-md); }
.chemistry-study .cs-tile-number { align-self: flex-start; font-weight: 700; }
.chemistry-study .cs-tile-symbol { font: 500 58px/1.1 var(--font-display); }
.chemistry-study .cs-tile-name { font-size: var(--text-small); font-weight: 700; text-align: center; }
.chemistry-study .cs-element-details { min-width: 0; }
.chemistry-study .cs-pronunciation { font-size: var(--text-body); margin-bottom: var(--space-3); }
.chemistry-study .cs-voice-note { display: inline-block; color: var(--muted); font-size: var(--text-caption); margin: var(--space-2); }
.chemistry-study .cs-fact { margin-top: var(--space-4); max-width: var(--measure-readable); font-size: var(--text-body); }
.chemistry-study .cs-position { grid-column: 1 / -1; margin: 0; padding: var(--space-5); background: var(--cream); border-radius: var(--radius-md); }
.chemistry-study .cs-mini-table { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(10, auto); gap: var(--space-1); max-width: 720px; margin: 0 auto var(--space-3); }
.chemistry-study .cs-table-cell { display: flex; align-items: center; justify-content: center; aspect-ratio: 1.1; border: 1px solid var(--line); border-radius: 0; background: var(--paper); min-height: 3px; }
.chemistry-study .cs-table-cell.is-current { color: var(--paper); background: var(--blue-strong); border-color: var(--ink); outline: 2px solid var(--ink); z-index: 1; font-size: clamp(8px, 1.3vw, 15px); font-weight: 700; }
.chemistry-study figcaption { text-align: center; color: var(--muted); font-size: var(--text-small); line-height: 1.5; }
.chemistry-study .cs-card-navigation { margin-top: var(--space-5); }
.chemistry-study .cs-question { max-width: 520px; margin: var(--space-5) auto; text-align: center; }
.chemistry-study .cs-cue { font: 500 clamp(42px, 6vw, 64px)/1.2 var(--font-display); margin: var(--space-3) 0 var(--space-5); overflow-wrap: anywhere; }
.chemistry-study .cs-question h4 { font-size: var(--text-heading); margin-bottom: var(--space-4); }
.chemistry-study form { display: flex; gap: var(--space-3); }
.chemistry-study form input { font-size: 20px; flex: 1; min-width: 0; }
.chemistry-study form button { flex-shrink: 0; }
.chemistry-study progress { width: 100%; height: 8px; accent-color: var(--blue-strong); }
.chemistry-study .cs-feedback { font-weight: 700; padding: var(--space-3) 0; line-height: 1.6; }
.chemistry-study .cs-feedback:empty { padding: 0; }
.chemistry-study .cs-feedback.is-correct { color: var(--green-text); }
.chemistry-study .cs-feedback.is-incorrect { color: var(--coral-text); }
.chemistry-study .cs-next { display: flex; justify-content: flex-end; margin-top: var(--space-5); }
.chemistry-study .cs-summary { padding: var(--space-5); background: var(--cream); border-radius: var(--radius-md); }
.chemistry-study .cs-summary h4 { font-size: 36px; margin: var(--space-2) 0 var(--space-3); }
.chemistry-study .cs-corrections { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.chemistry-study details { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); }
.chemistry-study summary { min-height: var(--target-min); padding-block: var(--space-3); cursor: pointer; }
.chemistry-study summary > span:last-child { color: var(--muted); font-size: var(--text-small); margin-left: var(--space-4); }
.chemistry-study .cs-element-card--compact .cs-position { padding: var(--space-4); }
.chemistry-study .cs-storage-note { font-size: var(--text-caption); color: var(--muted); margin-top: var(--space-5); }
.chemistry-study .cs-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 620px) {
  .chemistry-study { padding: var(--space-4); }
  .chemistry-study .cs-heading { display: block; }
  .chemistry-study .cs-local-label { display: inline-block; margin-top: var(--space-3); }
  .chemistry-study .cs-settings { padding-inline: var(--space-3); }
  .chemistry-study .cs-settings label { flex-basis: 100%; }
  .chemistry-study .cs-element-card { grid-template-columns: 100px minmax(0, 1fr); gap: var(--space-3); }
  .chemistry-study .cs-element-tile { min-height: 140px; padding: var(--space-2); }
  .chemistry-study .cs-tile-symbol { font-size: 44px; }
  .chemistry-study .cs-element-details h4 { font-size: 24px; overflow-wrap: anywhere; }
  .chemistry-study .cs-fact { font-size: var(--text-small); }
  .chemistry-study .cs-position { padding: var(--space-3); }
  .chemistry-study .cs-mini-table { gap: var(--space-1); }
  .chemistry-study .cs-question form { flex-direction: column; }
  .chemistry-study .cs-modes { width: 100%; }
  .chemistry-study .cs-modes .cs-button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .chemistry-study *, .chemistry-study *::before, .chemistry-study *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.chemistry-study .cs-element-tile[data-category="noble"] { background: var(--noble); }
.chemistry-study .cs-element-tile[data-category="alkali"] { background: var(--alkali); }
.chemistry-study .cs-element-tile[data-category="alkaline"] { background: var(--alkaline); }
.chemistry-study .cs-element-tile[data-category="metalloid"] { background: var(--metalloid); }
.chemistry-study .cs-element-tile[data-category="halogen"] { background: var(--halogen); }
.chemistry-study .cs-element-tile[data-category="transition"] { background: var(--transition); }
.chemistry-study .cs-element-tile[data-category="post-transition"] { background: var(--post-transition); }
.chemistry-study .cs-element-tile[data-category="lanthanide"] { background: var(--lanthanide); }
.chemistry-study .cs-element-tile[data-category="actinide"] { background: var(--actinide); }
.chemistry-study--compact { margin: 0; padding: var(--space-3); height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chemistry-study--compact .cs-compact-title { margin: 0 0 var(--space-2); font: 600 22px/1.2 var(--font-display); flex-shrink: 0; }
.chemistry-study--compact .cs-settings { margin-bottom: var(--space-2); padding: var(--space-2) var(--space-3); flex-shrink: 0; }
.chemistry-study--compact .cs-toolbar,
.chemistry-study--compact .cs-set-note { flex-shrink: 0; }
.chemistry-study--compact .cs-stage { flex: 1; min-height: 0; overflow: auto; padding-top: var(--space-2); }
.chemistry-study--compact .cs-cue { font-size: clamp(28px, 4vw, 42px); margin: var(--space-1) 0 var(--space-2); }
.chemistry-study--compact .cs-question { margin-block: var(--space-2) auto; }
.chemistry-study--compact .cs-question form { position: sticky; bottom: 0; background: var(--paper); padding-top: var(--space-2); }
.chemistry-study--compact .cs-card-navigation { position: sticky; bottom: 0; z-index: 1; margin-top: var(--space-2); padding-top: var(--space-2); background: var(--paper); }
.chemistry-study--compact .cs-element-tile { min-height: 88px; }
.chemistry-study--compact .cs-tile-symbol { font-size: 36px; }
.chemistry-study--compact .cs-storage-note,
.chemistry-study--compact .cs-position,
.chemistry-study--compact .cs-mini-table { display: none; }
.chemistry-study--compact .cs-element-card { grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-3); padding-block: 0; }
.chemistry-study--compact .cs-fact { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.train-panel.train-study { display: flex; flex-direction: column; }
#chemistry-study-app, #chemistry-test-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
