/* The same focused workspace is shared by all fifteen exercises. */
body.exercise-mode .topbar, body.exercise-mode .main-nav, body.exercise-mode .app-footer { display: none; }
body.exercise-mode { background: radial-gradient(ellipse at 80% 10%, #12334966, transparent 50%), radial-gradient(ellipse at 10% 80%, #37266433, transparent 55%), #07111f; }
#gamePage { max-width: 1140px; padding: 18px 24px; }
#gamePage .game-layout { width: 100%; max-width: 1000px; margin: 0 auto; }
#gamePage .game-header { display: flex; gap: 20px; align-items: center; margin: 0 0 18px; padding: 10px 0 16px; border-bottom: 1px solid #ffffff12; }
#gamePage .back-button { width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff18; border-radius: 14px; font-size: 1.1rem; flex-shrink: 0; }
.exercise-heading { display: grid; gap: 3px; min-width: 155px; }
.exercise-heading span { color: #74d4f9; font-size: .72rem; }
.exercise-heading strong { font-size: .95rem; }
.exercise-progress { flex: 1; display: flex; align-items: center; gap: 14px; }
.exercise-progress .progress-track { flex: 1; height: 9px; background: #ffffff0d; }
.exercise-progress .progress-fill { border-radius: 20px; background: linear-gradient(90deg, #a78bfa, #38bdf8); box-shadow: 0 0 14px #38bdf830; transition: width .45s ease; }
.exercise-progress > span { white-space: nowrap; font-size: .78rem; color: #9fb2c7; }
.exercise-stage { padding-bottom: 16px; animation: question-enter .32s ease both; }
#gamePage .question-card { position: relative; width: 100%; padding: 26px 30px; border-radius: 25px; border: 1px solid #ffffff15; background: linear-gradient(135deg, #142337e6, #0d1929f0); box-shadow: 0 20px 60px #0002; text-align: center; }
#gamePage .question-index { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; padding: 5px 12px; border-radius: 20px; background: #38bdf810; border: 1px solid #38bdf82a; color: #81d9fb; }
#gamePage .question-title { font-size: clamp(1.25rem, 2.5vw, 1.85rem); line-height: 1.65; margin: 13px auto 8px; max-width: 850px; }
#gamePage .question-title:focus, #gamePage .find-target:focus { outline: none; }
.question-instruction, #gamePage .builder-help { margin: 8px auto 16px; color: #aebfd2; font-size: .84rem; line-height: 1.9; max-width: 750px; }
#gamePage .question-big-symbol { width: 92px; height: 92px; display: grid; place-items: center; font-size: 2.8rem; margin: 16px auto; direction: ltr; background: linear-gradient(135deg, #38bdf824, #a78bfa18); border: 1px solid #38bdf830; border-radius: 24px; }
#gamePage .answer-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px auto 4px; max-width: 800px; }
#gamePage .answer-btn { min-height: 65px; padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 16px; border: 1px solid #ffffff1f; border-bottom-width: 3px; background: #07111f66; font-size: 1rem; transition: background .18s, border-color .18s, transform .18s; }
#gamePage .answer-btn:hover:not(:disabled), .match-btn:hover:not(:disabled) { transform: none; border-color: #38bdf877; background: #38bdf80f; }
#gamePage .answer-btn.selected, .match-btn.selected { border-color: #38bdf8; background: #38bdf820; color: #f8fafc; }
.option-letter { color: #9fb2c7; background: #ffffff08; border: 1px solid #ffffff16; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: .7rem; flex-shrink: 0; }
.option-mark { margin-inline-start: auto; width: 18px; flex-shrink: 0; }
.question-blank { display: inline-block; min-width: 65px; padding: 0 10px; border-bottom: 2px dashed #38bdf8; color: #7dd3fc; direction: ltr; unicode-bidi: isolate; }
#gamePage .answer-btn > span:nth-child(2) { flex: 1; }
#gamePage .answer-btn.correct, #gamePage .match-btn.correct { background: #34d39918; border-color: #34d399aa; color: #a7f3d0; }
#gamePage .answer-btn.correct .option-mark::after { content: '✓'; }
#gamePage .answer-btn.wrong, #gamePage .match-btn.wrong { background: #fb718518; border-color: #fb718599; color: #fecdd3; }
#gamePage .answer-btn.wrong .option-mark::after { content: '×'; }
#gamePage button:disabled { opacity: .55; cursor: default; }
#gamePage .answer-btn:disabled, #gamePage .match-btn:disabled { opacity: 1; }
.exercise-dock { position: sticky; bottom: 0; z-index: 5; background: #0b1728f5; backdrop-filter: blur(18px); border: 1px solid #ffffff18; border-radius: 20px; padding: 16px 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 22px; align-items: center; box-shadow: 0 -12px 40px #07111f77; }
.exercise-feedback { min-width: 0; }
.exercise-feedback > p { color: #9fb2c7; font-size: .82rem; margin: 0; }
#gamePage .feedback { min-height: 0; margin: 0; padding: 0; text-align: start; font-size: .86rem; line-height: 1.85; }
#gamePage .feedback br + br { display: none; }
.exercise-dock.is-correct { border-color: #34d39955; background: #0b2426f5; animation: feedback-enter .25s ease; }
.exercise-dock.is-wrong { border-color: #fb718555; background: #281b2af5; animation: feedback-enter .25s ease; }
.exercise-actions { display: flex; align-items: center; justify-content: end; gap: 12px; }
#gamePage .exercise-actions .btn-primary { min-height: 46px; min-width: 160px; margin: 0; padding: 10px 20px; border-radius: 13px; font-size: .9rem; border-bottom: 3px solid #1367b9; }
#gamePage .exercise-actions button:hover { transform: none; }
.explain-question { padding: 9px 12px; color: #b9defb; border: 1px solid #ffffff25; background: #ffffff06; border-radius: 11px; font-size: .8rem; min-height: 44px; }
.question-explanation { grid-column: 1 / -1; grid-row: 2; color: #d0dce9; font-size: .85rem; line-height: 2; background: #07111f66; padding: 14px 18px; border-radius: 12px; border-inline-start: 3px solid #38bdf8; max-height: 170px; overflow-y: auto; animation: feedback-enter .2s ease; }
#gamePage [hidden] { display: none !important; }
#gamePage button:focus-visible, #gamePage input:focus-visible, #gamePage textarea:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 4px; }
#gamePage .trend-hint { margin: 10px auto; padding: 10px 16px; font-size: .86rem; line-height: 1.8; }
#gamePage .trend-element-card { min-height: 150px; }
#gamePage .trend-element-symbol { font-size: 2.4rem; }
#gamePage .bond-game-label { display: none; }
#gamePage .bond-ion-pair { max-width: 650px; grid-template-columns: 1fr 25px 1fr; gap: 14px; margin: 18px auto; direction: ltr; }
#gamePage .bond-ion-card { min-height: 0; padding: 15px 18px; border-radius: 20px; direction: rtl; }
#gamePage .bond-ion-symbol { font-size: 3rem; margin: 4px 0; direction: ltr; unicode-bidi: isolate; }
#gamePage .bond-ion-symbol sup { position: static; vertical-align: super; font-size: .38em; }
#gamePage .bond-counter { margin-top: 12px; gap: 15px; direction: ltr; }
#gamePage .bond-counter button, #gamePage .counter button { min-width: 42px; min-height: 42px; border-radius: 12px; }
#gamePage .formula-lab { max-width: 650px; margin: 12px auto 0; padding: 13px 18px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 4px 12px; border-radius: 17px; }
#gamePage .formula-label { grid-column: 1 / -1; text-align: start; font-size: .75rem; }
#gamePage .formula-preview { min-height: 45px; font-size: 2.2rem; text-align: start; }
#gamePage .charge-equation { margin: 0; justify-content: end; font-size: .85rem; direction: ltr; unicode-bidi: isolate; }
#gamePage .bond-tip { font-size: .75rem; margin-top: 10px; }
#gamePage .atom-builder-visual { width: 92px; height: 92px; margin: 8px auto 14px; }
#gamePage .atom-core { width: 75px; height: 75px; font-size: 2rem; box-shadow: 0 0 25px #38bdf830; }
#gamePage .particle-grid { margin: 12px auto 0; gap: 12px; max-width: 700px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#gamePage .particle-grid-single { max-width: 270px; grid-template-columns: 1fr; }
#gamePage .particle-card { padding: 15px 10px; border-radius: 18px; }
#gamePage .particle-symbol { font-size: 1.35rem; line-height: 1.4; }
#gamePage .counter { gap: 8px; margin-top: 10px; direction: ltr; }
#gamePage .counter input { width: 55px; text-align: center; font-size: 1.1rem; padding: 8px 2px; background: #07111f88; color: #f8fafc; border: 1px solid #ffffff20; border-radius: 9px; }
#gamePage .ion-display { margin: 14px auto; padding: 16px; max-width: 620px; }
#gamePage .ion-element .ion-symbol { font-size: 3rem; }
#gamePage .ion-controls { margin: 12px auto; gap: 12px; }
.numeric-label { display: block; font-size: .84rem; color: #b6c9df; margin: 16px 0 8px; }
.numeric-answer { width: 200px; max-width: 100%; text-align: center; font-size: 2rem; padding: 12px; border: 2px solid #38bdf855; border-radius: 18px; background: #07111f80; color: #f8fafc; direction: ltr; }
.matching-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; max-width: 600px; margin: 20px auto 0; }
.matching-grid > div { display: grid; gap: 12px; }
.match-btn { min-height: 59px; width: 100%; background: #07111f66; color: #f8fafc; border: 1px solid #ffffff20; border-bottom-width: 3px; border-radius: 14px; padding: 10px 14px; position: relative; transition: transform .18s, background .18s; }
.match-btn.paired { background: #a78bfa18; border-color: #a78bfa99; }
.match-token { position: absolute; inset-inline-end: 12px; color: #c4b5fd; }
.match-btn[data-pair]:not([data-pair=""])::after { content: attr(data-pair); position: absolute; inset-inline-start: 12px; color: #c4b5fd; font-size: .8rem; }
.recall-scope { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 15px 0; color: #b8daf3; font-size: .8rem; }
.recall-scope > * { padding: 7px 13px; border: 1px solid #38bdf82a; border-radius: 10px; background: #38bdf80b; }
#groupRecall { width: min(600px, 100%); min-height: 100px; resize: vertical; padding: 16px; border: 2px solid #38bdf850; background: #07111f80; color: #f8fafc; border-radius: 16px; line-height: 1.8; font: inherit; }
.recall-range { display: inline-flex; margin-top: 12px; gap: 5px; border: 1px solid #ffffff18; border-radius: 12px; padding: 4px; background: #07111f55; }
.recall-range button { min-height: 40px; padding: 6px 15px; border: 1px solid transparent; border-radius: 9px; color: #9fb2c7; background: transparent; font-size: .8rem; }
.recall-range button.selected { background: #38bdf818; border-color: #38bdf850; color: #7dd3fc; }
#gamePage .atom-core { animation: core-glow 4s ease-in-out infinite; }
@keyframes core-glow { 50% { box-shadow: 0 0 40px #38bdf855; } }
.coefficient-fields { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; direction: ltr; margin: 20px auto; }
.coefficient-fields label { display: grid; gap: 8px; color: #cbd5e1; font-size: 1.1rem; padding: 12px; border: 1px solid #ffffff20; border-radius: 15px; background: #07111f66; flex: 1 1 60px; max-width: 110px; min-width: 0; }
.coefficient-fields input { width: 100%; max-width: 70px; justify-self: center; text-align: center; padding: 10px 2px; color: #f8fafc; border: 1px solid #38bdf850; background: #122238; font: inherit; border-radius: 10px; }
.formula-token { white-space: nowrap; }
.trend-choice { display: grid; gap: 6px; }
.trend-choice strong { font-size: 2.4rem; color: #7dd3fc; }
.trend-choice small { color: #9fb2c7; font-size: .75rem; }
.exercise-hint { margin: 12px auto; color: #9fb2c7; font-size: .8rem; max-width: 600px; }
.exercise-hint summary { cursor: pointer; color: #7dd3fc; }
#gamePage .electron-controls { margin: 12px auto; }
#gamePage .electron-controls button { min-height: 44px; padding: 10px 15px; font-size: .85rem; }
#gamePage .live-charge { margin: 12px auto 0; font-size: 1rem; padding: 10px; }
#gamePage .game-selected { outline: 3px solid #7dd3fc; outline-offset: -2px; background: #38bdf850; }
#gamePage .find-instruction { margin: 8px 0 15px; text-align: center; }
#gamePage .find-target { display: inline-block; font-size: 1.2rem; margin: 4px 10px; }
.table-scroll-hint { display: none; }
#gamePage .periodic-wrapper { margin: 0; padding-bottom: 8px; }
#gamePage .results { margin-top: 35px; animation: question-enter .4s ease; }
#gamePage .result-icon { font-size: 3rem; }
#gamePage .result-score { font-size: 3rem; margin: 10px; }
.result-ring { width: 150px; height: 150px; margin: 18px auto; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; gap: 2px; background: radial-gradient(closest-side, #102136 85%, transparent 86%), conic-gradient(#38bdf8 var(--result-progress), #ffffff0e 0); }
.result-ring strong { font-size: 2.2rem; color: #7dd3fc; }
.result-ring span { font-size: .74rem; color: #9fb2c7; }
.exercise-result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 650px; margin: 20px auto; }
.exercise-result-stats > div { display: grid; gap: 5px; padding: 14px 8px; border: 1px solid #ffffff15; background: #07111f66; border-radius: 15px; }
.exercise-result-stats strong { font-size: 1.2rem; }
.exercise-result-stats span { color: #9fb2c7; font-size: .75rem; }
#gamePage .result-actions { justify-content: center; }
.result-profile-link { margin: 20px 0 0; border: 0; background: transparent; color: #7dd3fc; padding: 10px; }
@keyframes question-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes feedback-enter { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 640px) {
  #gamePage { padding: 10px 12px 12px; }
  #gamePage .game-header { flex-wrap: wrap; gap: 10px; padding: 4px 0 12px; margin-bottom: 12px; }
  .exercise-heading { flex: 1; }
  .exercise-progress { flex-basis: 100%; order: 4; }
  #gamePage .question-card { padding: 18px 14px; border-radius: 20px; }
  #gamePage .question-title { font-size: 1.2rem; margin-top: 10px; }
  #gamePage .answer-options { gap: 9px; margin-top: 16px; }
  #gamePage .answer-btn { padding: 10px; min-height: 62px; font-size: .9rem; gap: 6px; }
  .option-letter { width: 22px; height: 26px; font-size: .6rem; }
  .option-mark { width: 12px; }
  .exercise-dock { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); grid-template-columns: 1fr; gap: 8px; border-radius: 16px; }
  .exercise-actions { justify-content: space-between; }
  #exerciseSubmit { width: 100%; }
  #gamePage .exercise-actions .builder-submit { width: 100%; }
  #gamePage .exercise-actions .btn-primary { min-width: 130px; }
  .exercise-feedback > p { text-align: center; }
  .question-explanation { grid-row: auto; max-height: 145px; padding: 10px 12px; }
  #gamePage .bond-ion-pair { grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); gap: 7px; margin: 14px auto; }
  #gamePage .bond-ion-card { padding: 12px 7px; }
  #gamePage .bond-ion-symbol { font-size: 2.3rem; }
  #gamePage .bond-counter { gap: 6px; }
  #gamePage .bond-counter button { min-width: 36px; min-height: 42px; }
  #gamePage .formula-lab { grid-template-columns: 1fr; text-align: center; padding: 12px; }
  #gamePage .formula-preview { text-align: center; font-size: 1.9rem; }
  #gamePage .charge-equation { justify-content: center; }
  #gamePage .particle-grid { grid-template-columns: 1fr; gap: 8px; }
  #gamePage .particle-card { display: grid; grid-template-columns: 35px 1fr auto; align-items: center; padding: 8px 12px; text-align: start; gap: 8px; }
  #gamePage .counter { margin: 0; gap: 4px; }
  #gamePage .counter input { width: 45px; }
  #gamePage .particle-grid-single { max-width: 100%; }
  .matching-grid { gap: 14px; margin-top: 14px; }
  .match-btn { padding: 10px 22px; font-size: .85rem; min-height: 54px; }
  .question-instruction, #gamePage .builder-help { font-size: .78rem; margin-bottom: 12px; }
  #gamePage .trend-element-card { min-height: 140px; }
  .table-scroll-hint { display: block; text-align: center; }
}
@media (max-height: 760px) and (min-width: 641px) {
  #gamePage { padding-top: 10px; }
  #gamePage .game-header { margin-bottom: 12px; }
  #gamePage .question-card { padding: 18px 26px; }
  #gamePage .bond-ion-card { padding: 10px 18px; }
  #gamePage .question-title { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #gamePage *, #gamePage *::before, #gamePage *::after { animation: none !important; transition: none !important; }
}
