:root {
  --navy: #0f2a4a;
  --blue: #2563eb;
  --light-blue: #e7f0ff;
  --gray: #f3f5f8;
  --line: #d8dee8;
  --text: #172033;
  --muted: #627086;
  --good: #0f766e;
  --bad: #b42318;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
}

button,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 40px);
  background: var(--navy);
  color: #fff;
}

.app-header > div {
    flex: 1;
}

.eyebrow,
.practice-kicker {
  margin: 0 0 4px;
  color: #b8d3ff;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 4vw, 2.1rem);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.icon-button {
  width: 48px;
  padding: 0;
  color: var(--navy);
  background: #fff;
  font-size: 1.4rem;
}

.summary {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:10px;
    margin-bottom:16px;
}


.header-reset{

    width:40px;
    height:40px;

    margin:auto;

    display:flex;
    justify-content:center;
    align-items:center;

    border:1px solid var(--line);
    border-radius:50%;

    background:#fff;
    color:var(--navy);

    font-size:2rem;
    font-weight:700;

    box-shadow:0 3px 10px rgba(15,42,74,.08);

    transition:.2s;
}

.header-reset:hover{
    transform:rotate(-30deg);
}

.summary > div,
.chapter-card,
.practice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 3px 10px rgba(15,42,74,.06);
}

.summary > div {
  padding: 14px;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.summary strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 1.55rem;
}

.toolbar,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar {
  margin-bottom: 16px;
}

.chapter-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:14px;
}

.chapter-card{
    padding:14px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:#fff;
}

.chapter-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:10px;
}

.chapter-tag{
    font-size:.82rem;
    font-weight:700;
    color:var(--muted);
    letter-spacing:.04em;
    text-transform:uppercase;
}

.study-btn{
    min-height:32px;
    padding:4px 12px;
    border-radius:999px;
    background:var(--blue);
    color:#fff;
    font-size:.82rem;
    font-weight:700;
    transition:.2s;
}

.study-btn:hover{
    opacity:.9;
}

.chapter-title{
    margin:0 0 12px;
    font-size:1.05rem;
    line-height:1.45;
    color:var(--navy);
}

.chapter-footer{
    display:flex;
    align-items:center;
    gap:12px;
}

.chapter-count{
    white-space:nowrap;
    font-size:.82rem;
    color:var(--muted);
    font-weight:700;
}

.chapter-progress{
    flex:1;
    height:8px;
    margin-top:0;
    overflow:hidden;
    border-radius:999px;
    background:var(--gray);
}


.chapter-card h2 {
  margin: 6px 0 8px;
  font-size: 1.05rem;
}


.chapter-progress span,
.progress-bar {
  display: block;
  height: 100%;
  background: var(--blue);
}

.primary-button {
  color: #fff;
  background: var(--blue);
}

.secondary-button {
  color: var(--navy);
  background: var(--light-blue);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 16px;
  max-width: 420px;
}

.control-grid button {
  width: 100%;
  color: var(--navy);
  background: var(--light-blue);
}

.practice-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.practice-top h2 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.75rem);
}

.progress-wrap {
  height: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray);
}

.practice-card {
  padding: clamp(14px, 3vw, 22px);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--gray);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.passage-area,
.image-area,
.question-text,
.hint-area,
.answer-panel,
.training-panel {
  margin-bottom: 16px;
  line-height: 1.75;
}

.passage-area {
  padding: 14px;
  border-left: 4px solid var(--blue);
  background: var(--gray);
  white-space: pre-line;
}

.image-area img {
  display: block;
  width: min(100%, 520px);
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--gray);
}

.question-text {
  font-size: 1.12rem;
  font-weight: 800;
}

.choices-area {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.choices-area.number-choices {
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  max-width: 420px;
}

.choices-area.number-choices .choice {
  text-align: center;
}

.choices-area.two-by-two-choices {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  max-width: 640px;
}

.choice {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.choice.selected {
  border-color: var(--blue);
  background: var(--light-blue);
}

.choice.correct {
  border-color: var(--good);
  color: var(--good);
}

.choice.wrong {
  border-color: var(--bad);
  color: var(--bad);
}

.sort-bank,
.sort-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--gray);
}

.sort-answer {
  margin-bottom: 10px;
  background: #fff;
}

.word-chip {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.audio-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--gray);
}

.audio-track-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.audio-track-button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #e7f0ff;
  font-weight: 800;
}

.audio-track-button.selected {
  border-color: var(--primary);
  background: #dbeafe;
}

audio {
  width: min(100%, 420px);
}

select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

select {
  min-height: 40px;
  padding: 6px 10px;
}

.dictation {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px;
  resize: vertical;
}

.answer-panel,
.training-panel,
.hint-area {
  padding: 14px;
  border-radius: 12px;
  background: var(--gray);
}

.answer-panel h3 {
  margin-bottom: 8px;
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.position-row {
  margin-top: 16px;
  text-align: center;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 680px) {
  .summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .practice-top {
    grid-template-columns: 1fr;
  }

  .toolbar button,
  .action-row button {
    flex: 1 1 150px;
  }

  .control-grid {
    max-width: none;
  }

  .choices-area.number-choices {
    grid-template-columns: repeat(4, minmax(48px, 1fr));
    max-width: none;
  }

  .choices-area.two-by-two-choices {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
    max-width: none;
  }


  
}

#chapter07AudioBtn{
    width:100%;
    margin:16px 0;
    font-size:22px;
}

/* =========================
   Login Screen
   ========================= */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--navy);
}

.login-card {
  width: min(100%, 420px);
  padding: 36px 28px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .18);
}

.login-eyebrow {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-card h2 {
  margin-bottom: 12px;
  color: var(--navy);
  font-size: 1.7rem;
}

.login-message {
  margin-bottom: 22px;
  color: var(--muted);
}

.login-input {
  width: 100%;
  min-height: 50px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.login-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.login-button {
  width: 100%;
  min-height: 50px;
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
}

.login-button:hover {
  opacity: .92;
}

.login-error {
  margin: 14px 0 0;
  color: var(--bad);
  font-size: .9rem;
  font-weight: 700;
}

.app-content {
  min-height: 100vh;
}