/* Match the supplied original flashcard viewer. */
:root{--card-width:min(350px,calc((100svh - 325px)*.666667),calc(100vw - 380px))}
body{font-family:Fredoka,'Nirmala UI','Segoe UI',sans-serif;color:#08294b;min-height:100svh;overflow-x:hidden}
body:before{display:none}
header{display:block;position:relative;text-align:center;padding:20px 14px 0;background:transparent;box-shadow:none}
.course-row{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}
.course-badge{display:flex;align-items:center;justify-content:center;gap:10px;border:2px solid #ffda76;border-radius:40px;padding:6px 14px 6px 8px;color:#fff7dc;background:linear-gradient(#123457,#07172e);font-family:'Segoe UI',sans-serif;font-size:12px;font-weight:800;letter-spacing:1.2px;text-shadow:0 2px 3px #000;box-shadow:inset 0 1px 1px #ffffff66,0 4px #051428,0 10px 24px #0006}
.course-badge b{color:#ffcd56;font-size:18px}
.course-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:linear-gradient(#fff6b3,#ffca3a,#d97706);border:2px solid #fff6d8;color:#3b1d06;font-size:19px}
.class-tag{background:linear-gradient(#ffe57f,#f59e0b,#d97706);color:#3b1d06;border:1.5px solid #fffbeb;border-radius:20px;padding:4px 12px;text-shadow:none;letter-spacing:.4px;font-size:11px}
header button{height:52px;display:flex;align-items:center;justify-content:center;gap:8px;padding:7px 18px;border:2px solid #b9e9ff;border-radius:40px;background:linear-gradient(#62d8ff,#149cd1 50%,#08628e);color:white;font-family:'Segoe UI',sans-serif;font-size:13px;font-weight:800;text-shadow:0 1px 2px #073c59;box-shadow:inset 0 2px 2px #ffffff88,0 5px #07364d,0 10px 20px #0005}
header .chapter-back{border-color:#ffd5e5;background:linear-gradient(#e44c85,#af2258,#77143c);box-shadow:inset 0 2px 2px #ffffff88,0 5px #4a0822,0 10px 20px #0005}
h1{font:700 clamp(21px,2.1vw,29px)/1.18 'Manrope','DM Sans','Nunito','Segoe UI',sans-serif;letter-spacing:-0.4px;margin:14px 0 0;color:#163547;-webkit-text-stroke:0;text-shadow:0 1px 0 rgba(255,255,255,0.65)}
main{position:relative;min-height:calc(100svh - 164px);padding:104px 0 76px;justify-content:flex-start}
.card{width:var(--card-width);min-width:0;max-width:none;border-radius:5%;filter:drop-shadow(0 6px 10px #05253f55)}
.face{font-family:Fredoka,'Nirmala UI','Segoe UI',sans-serif;font-weight:600}
.face .number,.face .cap,.face .wood,.face .topic{display:flex;align-items:center;justify-content:center;text-align:center;line-height:1;white-space:normal;margin:0;padding:0}
.number{left:4%;top:6%;width:17%;height:11%;color:#102e43;font-size:9cqw;font-weight:600;font-variant-numeric:tabular-nums;direction:ltr}
.cap{left:27%;top:3%;height:6.8%;font-size:6cqw;font-weight:700}
.wood{left:24%;top:11.5%;height:6%;font-size:5.8cqw;color:#38230b;font-weight:600}
.question,.answer,.example{display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.23;text-wrap:pretty;overflow-wrap:break-word;color:#08294b;font-weight:600}
.question{left:12%;top:23%;width:76%;height:18%;font-size:6.4cqw}
.frontExample{left:12%;top:40%;width:76%;height:7%;font-size:4.6cqw;color:#ed1248}
.answer{left:12%;top:21%;width:76%;height:8%;font-size:5.2cqw}
.backExample{left:12%;top:29%;width:76%;height:6%;font-size:4cqw;color:#bd2345}
.topic{font-size:4.4cqw;color:#08294b;font-weight:600}
.points{font-size:3.8cqw;line-height:1.2;font-weight:500}
.points li{justify-content:center;text-align:center}
.face [dir=rtl]{text-align:center}
nav{display:contents}
nav button{position:absolute;top:calc(104px + var(--card-width)*.75 - 35px);height:70px;width:174px;border:3px solid #fffde4;border-radius:50px;padding:10px;font-family:Fredoka,'Nirmala UI','Segoe UI',sans-serif;font-weight:700;font-size:23px;color:#3a2807;text-shadow:0 1px #fff6;box-shadow:inset 0 2px 2px #fff9,0 6px #4e5c3480,0 9px 20px #21482b55;background:linear-gradient(#fffab0,#ffe356 45%,#ffb329)}
#previous{right:calc(50% + var(--card-width)/2 + 36px)}
#next{left:calc(50% + var(--card-width)/2 + 36px)}
nav button:disabled{opacity:.55;background:linear-gradient(#d8ffff,#57aec5 50%,#236b8e);color:#fff}
#counter{position:absolute;top:calc(104px + var(--card-width)*1.5 + 28px);left:50%;transform:translateX(-50%);background:#24450baa;color:#fff9d9;border:1px solid #c8d79288;padding:8px 21px;font-family:'Segoe UI',sans-serif;font-size:14px;letter-spacing:2px;box-shadow:0 2px 5px #0003}
#hint{display:none}
#status{position:absolute;top:calc(104px + var(--card-width)*1.5 + 68px)}
@media(max-height:760px) and (min-width:701px){:root{--card-width:min(330px,calc((100svh - 260px)*.666667))}main{padding-top:65px}nav button{top:calc(65px + var(--card-width)*.75 - 30px);height:60px}#counter{top:calc(65px + var(--card-width)*1.5 + 20px)}#status{top:calc(65px + var(--card-width)*1.5 + 55px)}header{padding-top:14px}h1{font-size:40px;margin-top:15px}}
@media(max-width:700px){:root{--card-width:min(350px,calc((100svh - 255px)*.666667),calc(100vw - 156px))}header{padding:15px 6px 0}.course-row{gap:7px}.course-badge{font-size:8px;gap:5px;padding:5px 7px;letter-spacing:.4px}.course-icon{width:21px;height:21px;font-size:13px}.class-tag{font-size:8px;padding:3px 6px}header button{height:36px;font-size:10px;padding:5px 10px}.course-badge b{font-size:12px}h1{font-size:clamp(25px,6vw,37px);margin-top:15px}main{padding-top:70px;min-height:calc(100svh - 115px)}nav button{top:calc(70px + var(--card-width)*.75 - 24px);width:64px;min-width:0;height:48px;font-size:14px;border-width:2px}#previous{right:calc(50% + var(--card-width)/2 + 9px)}#next{left:calc(50% + var(--card-width)/2 + 9px)}#counter{top:calc(70px + var(--card-width)*1.5 + 24px);font-size:12px;padding:7px 16px}#status{top:calc(70px + var(--card-width)*1.5 + 61px)}}
.question-group,.answer-group{position:absolute;left:12%;width:76%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:3cqw}
.question-group{top:22%;height:25%}.answer-group{top:21%;height:14%;gap:1.4cqw}
.question-group .question,.question-group .frontExample,.answer-group .answer,.answer-group .backExample{position:static!important;inset:auto;width:100%;height:auto;flex:0 0 auto;margin:0;padding:0}
.question-group .question{font-size:6.4cqw}.question-group .frontExample{font-size:4.7cqw}.answer-group .answer{font-size:5.1cqw}.answer-group .backExample{font-size:4cqw}
/* Keep live lettering inside the actual yellow/wooden surfaces. */
.face .number,.face .topic,.face .cap,.face .wood{display:flex!important;align-items:center!important;justify-content:center!important;text-align:center!important;box-sizing:border-box;overflow:hidden;padding:0 4%!important}
.face .number{padding:0!important}
.face .label-wording{position:static!important;inset:auto!important;display:block;width:100%;height:auto;flex:0 0 auto;text-align:center!important;font:inherit;line-height:1.1;white-space:normal;overflow-wrap:break-word;transform:translateY(.055em)}
.face .topic{font-size:4.2cqw;line-height:1.1}
/* Compact controls with consistent centered labels. */
header button{height:42px;min-height:42px;padding:6px 15px;font-size:12px;border-width:2px;line-height:1.15}
.course-badge{padding-top:5px;padding-bottom:5px;font-size:11px}.course-icon{width:27px;height:27px;font-size:17px}.class-tag{font-size:10px;padding:3px 10px}
nav button{height:50px;width:132px;min-width:0;padding:6px 13px;font-size:18px;line-height:1.15;display:flex;align-items:center;justify-content:center;text-align:center;top:calc(104px + var(--card-width)*.75 - 25px);border-width:2px;box-shadow:inset 0 1px 2px #fff9,0 4px #4e5c3466,0 6px 12px #21482b33}
#previous{right:calc(50% + var(--card-width)/2 + 30px)}#next{left:calc(50% + var(--card-width)/2 + 30px)}
#counter{font-size:12px;padding:6px 17px;letter-spacing:1.4px}
#languages button{min-height:42px;font-size:14px;padding:8px 10px}#close{height:32px;width:32px;font-size:22px;padding:0;display:flex;align-items:center;justify-content:center}
@media(max-height:760px) and (min-width:701px){nav button{height:46px;width:122px;font-size:17px;top:calc(65px + var(--card-width)*.75 - 23px)}}
@media(max-width:700px){header button{height:34px;min-height:34px;font-size:10px;padding:5px 10px}.course-badge{font-size:8px;padding:4px 7px}.course-icon{width:21px;height:21px;font-size:13px}.class-tag{font-size:8px;padding:3px 6px}nav button{height:40px;width:65px;padding:4px;font-size:12px;top:calc(70px + var(--card-width)*.75 - 20px)}#previous{right:calc(50% + var(--card-width)/2 + 8px)}#next{left:calc(50% + var(--card-width)/2 + 8px)}}
/* Lower footer topic text slightly; other labels keep their current position. */
.face .topic .label-wording{transform:none!important}

/* Label glyphs are optically centered using measured ink bounds. */
.face .number,.face .topic,.face .cap,.face .wood{transform:none!important}
.face .topic svg,.face .number svg,.face .cap svg,.face .wood svg{position:static!important;transform:none!important;max-width:100%;max-height:100%}

/* Text is bounded by each image’s measured parchment panels. */
.question-group,.answer-group{overflow:hidden;box-sizing:border-box;padding:1px 2px}
.answer-group{gap:1cqw}.answer-group .answer,.answer-group .backExample{line-height:1.12}
.points{overflow:hidden;box-sizing:border-box;padding:0}.points ul{height:100%;min-height:0;gap:0;grid-template-rows:repeat(4,minmax(0,1fr))}.points li{min-height:0;max-height:100%;overflow:hidden;line-height:1.14;padding:1px 2px;align-items:center;justify-content:center;text-align:center}

/* Keep learning examples legible; long translations may scroll inside the panel. */
.answer-group{overflow:auto;scrollbar-width:thin;gap:2px;justify-content:safe center}.answer-group .answer{font-size:clamp(14px,4.7cqw,21px);line-height:1.08}.answer-group .backExample{font-size:clamp(13px,4cqw,18px);line-height:1.06;white-space:pre-line}.answer-group>*{flex-shrink:0}

/* Chapter 1 design shared by Chapter 2. Keep footer titles readable and centered. */
.face .topic{font-size:clamp(16px,4.2cqw,20px)!important;font-weight:600!important;padding:0 4%!important;background:transparent!important;border:0!important}
.face .topic::before,.face .topic::after{display:none!important;content:none!important}
.face .topic .label-wording{position:static!important;inset:auto!important;font:inherit!important;line-height:1.1!important;transform:none!important;display:flex!important;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}
.card .inner,.card.flipped .inner{transform:none!important;transition:none!important}
.card .face.front{transform:none!important;visibility:visible;backface-visibility:visible}
.card .face.back{transform:none!important;visibility:hidden;backface-visibility:visible}
.card.flipped .face.front{visibility:hidden}.card.flipped .face.back{visibility:visible}

/* Reference footer: smooth yellow plaque, no heavy brown/orange rim. Applies to every front and back face. */
.face .topic{border:0!important;outline:0!important;box-shadow:none!important;background:transparent!important;overflow:visible!important;isolation:isolate;z-index:3}
.face .topic::before{content:""!important;display:block!important;position:absolute;inset:-1.15cqw -2.25cqw;background:linear-gradient(180deg,#fff99a 0%,#ffe751 22%,#ffdb30 58%,#ffd331 100%);border:1px solid #fff7b0!important;outline:0!important;border-radius:999px;box-shadow:none!important;z-index:-1;pointer-events:none}
.face .topic::after{content:none!important;display:none!important}
.face .topic .label-wording,.face .topic svg,.face .topic text{background:transparent!important;border:0!important;outline:0!important;box-shadow:none!important}

/* Strictly border-free bottom yellow plaques on every card. */
.face .topic,.face .topic::before,.face .topic::after,.face .topic .label-wording,.face .topic svg,.face .topic text{border:0!important;border-width:0!important;outline:0!important;box-shadow:none!important;stroke:none!important}
.face .topic::before{background:#ffdf43!important;inset:-1.35cqw -2.5cqw;border-radius:999px}

/* Long chapter title fits the shared header. */
h1{font-size:clamp(25px,3.1vw,46px);max-width:1100px;margin-left:auto;margin-right:auto}
/* Chapter 3 classroom reading sizes; never shrink lesson text into tiny type. */
.question-group{overflow:auto;scrollbar-width:thin;justify-content:safe center}.question-group .question{font-size:clamp(18px,6.2cqw,25px)!important;line-height:1.18}.question-group .frontExample{font-size:clamp(15px,4.6cqw,19px)!important;line-height:1.15}
.answer-group .answer{font-size:clamp(17px,4.8cqw,21px)!important;line-height:1.13}.answer-group .backExample{font-size:clamp(15px,4.3cqw,19px)!important;line-height:1.13}
.points li{font-size:clamp(14px,4cqw,18px)!important;line-height:1.12;overflow:auto;scrollbar-width:thin}

.frontExample:empty{display:none!important}


/* === MOBILE, TABLET & DESKTOP FLASHCARD RESPONSIVENESS === */
@media (max-width: 900px) and (min-width: 701px) {
  :root {
    --card-width: min(320px, calc((100svh - 270px) * 0.666667), calc(100vw - 290px)) !important;
  }
  nav button {
    width: 110px !important;
    font-size: 16px !important;
  }
  #previous {
    right: calc(50% + var(--card-width) / 2 + 16px) !important;
  }
  #next {
    left: calc(50% + var(--card-width) / 2 + 16px) !important;
  }
}

@media (max-width: 700px) {
  :root {
    --card-width: min(340px, calc(100vw - 28px), calc((100svh - 220px) * 0.666667)) !important;
  }
  header {
    padding: 10px 8px 0 !important;
  }
  .course-row {
    gap: 6px !important;
  }
  h1 {
    font-size: clamp(22px, 5.6vw, 32px) !important;
    margin-top: 10px !important;
  }
  main {
    padding: 12px 10px 20px !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
  }
  nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: var(--card-width) !important;
    max-width: 100% !important;
    margin-top: 2px !important;
    position: static !important;
  }
  nav button,
  #previous,
  #next {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 82px !important;
    height: 42px !important;
    font-size: 13.5px !important;
    padding: 6px 10px !important;
  }
  #counter {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    flex-shrink: 0 !important;
    font-size: 12px !important;
    padding: 7px 12px !important;
    border-radius: 999px !important;
  }
  #status {
    position: static !important;
    top: auto !important;
    margin: 0 !important;
    font-size: 12px !important;
  }
}
/* === END FLASHCARD RESPONSIVENESS === */

/* === EXTRA NARROW MOBILE, DIALOG & LANDSCAPE FLASHCARD RESPONSIVENESS === */
@media (max-width: 480px) {
  dialog {
    padding: 16px 14px !important;
    border-radius: 16px !important;
    max-height: 88dvh !important;
  }
  #languages {
    grid-template-columns: 1fr !important;
    max-height: 55dvh !important;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  :root {
    --card-width: min(240px, calc((100svh - 140px) * 0.666667)) !important;
  }
  header {
    padding: 6px 10px 0 !important;
  }
  h1 {
    font-size: 20px !important;
    margin-top: 4px !important;
  }
  main {
    padding: 8px 10px 12px !important;
  }
}
/* === END EXTRA FLASHCARD RESPONSIVENESS === */

/* Clean Studio Background Guarantee */
html,body{background:#fdf6ec url('images/clean-plain-bg.webp?v=cream1') center center / cover no-repeat fixed!important}
body::before,body:before{display:none!important}

/* === MULTI-DEVICE FLASHCARD POLISH (v=resp30) === */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html, body {
    background-attachment: scroll !important;
    background-position: center top !important;
  }
}
@media (min-width: 701px) and (max-height: 800px) {
  header, .page-header {
    padding-top: 8px !important;
    padding-bottom: 4px !important;
  }
  header h1, .page-header h1, .title-block h1, #title {
    margin-top: 4px !important;
    margin-bottom: 2px !important;
    font-size: clamp(20px, 2vw, 25px) !important;
  }
}
@media (max-width: 390px) {
  .course-row {
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    row-gap: 6px !important;
  }
  .course-badge, .course-eyebrow {
    order: 3 !important;
    width: 100% !important;
    justify-content: center !important;
  }
}
