/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:   #1a472a;
  --green-l: #2d6a40;
  --green-d: #0f2d1a;
  --cream:   #f5f0e8;
  --cream-d: #ede6d6;
  --gold:    #c9a84c;
  --gold-l:  #e0c270;
  --text:    #1c1c1c;
  --text-m:  #4a4a4a;
  --text-l:  #777;
  --white:   #ffffff;
  --red:     #c0392b;
  --correct: #1a7a3a;
  --radius:  8px;
  --shadow:  0 2px 12px rgba(0,0,0,.12);
  --trans:   .2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh; /* avoids mobile URL-bar jump */
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* ── Header ── */
header {
  background: var(--green);
  color: var(--white);
  padding: 0 1.5rem;
  /* Respect notch / rounded-corner safe areas in standalone (installed) mode */
  padding-top: env(safe-area-inset-top);
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 0;
}
.logo-icon { font-size: 1.6rem; }
.logo-text  { font-size: 1.1rem; font-weight: 700; letter-spacing: .02em; }
.logo-sub   { font-size: .7rem; color: var(--gold-l); letter-spacing: .08em; text-transform: uppercase; }

nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  padding: .4rem 0;
}
nav button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: var(--white);
  padding: .35rem .9rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: .82rem;
  transition: var(--trans);
}
nav button:hover, nav button.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--green-d);
  font-weight: 600;
}

/* ── Sections ── */
section { display: none; }
section.active { display: block; }

/* ── Search Section ── */
#section-search { padding: 2rem 1.5rem; max-width: 860px; margin: 0 auto; }

.mode-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.mode-label { font-size: .8rem; color: var(--text-m); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.mode-btn {
  display: flex;
  background: var(--green-d);
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid var(--green);
}
.mode-btn button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.6);
  padding: .45rem 1.1rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: var(--trans);
}
.mode-btn button.on {
  background: var(--gold);
  color: var(--green-d);
  border-radius: 22px;
}

.search-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}
.search-wrap input {
  width: 100%;
  padding: .9rem 3.2rem .9rem 1.2rem;
  border: 2px solid var(--cream-d);
  border-radius: var(--radius);
  font-size: 1.1rem;
  background: var(--white);
  transition: border-color var(--trans);
  outline: none;
}
.search-wrap input:focus { border-color: var(--green); }
.search-wrap .clear-btn {
  position: absolute;
  right: .8rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--text-l);
  display: none;
}
.search-wrap input:not(:placeholder-shown) ~ .clear-btn { display: block; }

.results-wrap { min-height: 100px; }

.result-card {
  background: var(--white);
  border: 1px solid var(--cream-d);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow);
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(4px) } to { opacity:1; transform:translateY(0) } }

.result-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.result-word { font-size: 1.3rem; font-weight: 700; color: var(--green); }
.result-pos  { font-size: .8rem; color: var(--text-l); font-style: italic; background: var(--cream-d); padding: .1rem .5rem; border-radius: 10px; }

.def-list { list-style: none; }
.def-list li { padding: .3rem 0; border-bottom: 1px solid var(--cream-d); font-size: .95rem; }
.def-list li:last-child { border-bottom: none; }
.def-sense { color: var(--text-m); font-style: italic; margin-right: .4rem; }
.def-malay { color: var(--green); font-weight: 600; }

.no-result {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-l);
  font-size: 1rem;
}
.no-result strong { display: block; font-size: 1.2rem; margin-bottom: .4rem; color: var(--text-m); }

/* ── Glossary Section ── */
#section-glossary { padding: 1.5rem; }

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: center;
  background: var(--green);
  padding: .75rem 1rem;
  position: sticky;
  top: var(--header-h, 56px);
  z-index: 50;
}
.alpha-nav a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-weight: 700;
  font-size: .85rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: var(--trans);
}
.alpha-nav a:hover { background: var(--gold); color: var(--green-d); }

.glossary-mode-bar {
  display: flex;
  justify-content: flex-end;
  padding: .75rem 0;
  max-width: 1400px;
  margin: 0 auto;
}

.letter-section { max-width: 1400px; margin: 0 auto 2rem; }
.letter-heading {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  background: var(--green);
  display: inline-block;
  padding: .15rem .7rem;
  border-radius: 6px;
  margin-bottom: .75rem;
}

/* 4-col grid = 2 EN|BM pairs */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--cream-d);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}
/* Column header row */
.glossary-grid .col-head {
  background: var(--green-d);
  color: var(--gold-l);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .4rem .6rem;
  border-right: 1px solid rgba(255,255,255,.1);
}
.glossary-grid .col-head:last-child { border-right: none; }

/* Entry cells */
.glossary-grid .g-cell {
  padding: .35rem .6rem;
  font-size: .82rem;
  border-right: 1px solid var(--cream-d);
  border-top: 1px solid var(--cream-d);
  line-height: 1.4;
  cursor: pointer;
  transition: background var(--trans);
  word-break: break-word;
}
.glossary-grid .g-cell:nth-child(4n) { border-right: none; }
.glossary-grid .g-cell.en { color: var(--green); font-weight: 500; }
.glossary-grid .g-cell.en:hover { background: #e8f5ed; }
.glossary-grid .g-cell.bm { color: var(--text-m); }
.glossary-grid .g-cell.bm:hover { background: var(--cream-d); }

/* Thicker divider between the two EN–Malay pairs */
.glossary-grid .col-head.pair-div,
.glossary-grid .g-cell.pair-div {
  border-right: 3px solid var(--gold);
}

/* Mobile: 2 col (1 pair) — no inter-pair divider needed */
@media (max-width: 640px) {
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
  .glossary-grid .col-head:nth-child(n+3) { display: none; }
  .glossary-grid .col-head.pair-div { border-right: 1px solid rgba(255,255,255,.1); }
  .glossary-grid .g-cell.pair-div { border-right: 1px solid var(--cream-d); }
  .glossary-grid .g-cell:nth-child(even) { border-right: none; }
}

/* ── Flashcard Section ── */
#section-flash { padding: 2rem 1.5rem; max-width: 560px; margin: 0 auto; text-align: center; }

.game-mode-bar {
  display: flex; justify-content: center; gap: .5rem; margin-bottom: 1.5rem;
}

.flash-stats {
  display: flex; justify-content: space-between; margin-bottom: 1rem;
  font-size: .82rem; color: var(--text-m);
}
.flash-stats span strong { color: var(--green); }

.card-scene {
  perspective: 1000px;
  height: 220px;
  margin-bottom: 1.25rem;
  cursor: pointer;
}
.card-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .45s ease;
}
.card-scene.flipped .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backface-visibility: hidden;
  box-shadow: var(--shadow);
}
.card-front {
  background: var(--green);
  color: var(--white);
}
.card-back {
  background: var(--white);
  border: 2px solid var(--green);
  transform: rotateY(180deg);
}
.card-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem; opacity: .7; }
.card-word  { font-size: 2rem; font-weight: 800; margin-bottom: .4rem; }
.card-pos   { font-size: .8rem; font-style: italic; opacity: .7; }
.card-trans { font-size: 1.3rem; font-weight: 700; color: var(--green); margin-bottom: .3rem; }
.card-sense { font-size: .8rem; color: var(--text-m); font-style: italic; }
.card-hint  { font-size: .8rem; opacity: .6; margin-top: .5rem; }

.card-actions {
  display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem;
}

.progress-bar {
  height: 6px;
  background: var(--cream-d);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 1rem;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Quiz Section ── */
#section-quiz { padding: 2rem 1.5rem; max-width: 620px; margin: 0 auto; }

.quiz-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
}
.quiz-score { font-size: .9rem; color: var(--text-m); }
.quiz-score strong { color: var(--green); font-size: 1.1rem; }

.quiz-question {
  background: var(--green);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.quiz-q-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; margin-bottom: .5rem; }
.quiz-q-word  { font-size: 2rem; font-weight: 800; }
.quiz-q-pos   { font-size: .8rem; font-style: italic; opacity: .7; }

.quiz-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem;
}
.quiz-opt {
  background: var(--white);
  border: 2px solid var(--cream-d);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  cursor: pointer;
  font-size: .95rem;
  text-align: center;
  transition: var(--trans);
  font-family: inherit;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--green); background: #e8f5ed; }
.quiz-opt.correct { border-color: var(--correct); background: #e8f5ed; color: var(--correct); font-weight: 700; }
.quiz-opt.wrong   { border-color: var(--red); background: #fdecea; color: var(--red); }
.quiz-opt:disabled { cursor: default; }

.quiz-feedback {
  text-align: center;
  padding: .75rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: .75rem;
  min-height: 48px;
}
.quiz-feedback.correct-fb { background: #e8f5ed; color: var(--correct); }
.quiz-feedback.wrong-fb   { background: #fdecea; color: var(--red); }

.quiz-summary {
  text-align: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.quiz-summary h2 { color: var(--green); margin-bottom: .5rem; }
.quiz-summary .big-score { font-size: 3.5rem; font-weight: 800; color: var(--gold); line-height: 1; margin: .5rem 0; }

/* ── Matching Game ── */
#section-match { padding: 2rem 1.5rem; max-width: 720px; margin: 0 auto; }

.match-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem;
}
.match-timer { font-size: 1.3rem; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: 1rem;
}
.match-col { display: flex; flex-direction: column; gap: .5rem; }

.match-tile {
  background: var(--white);
  border: 2px solid var(--cream-d);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  cursor: pointer;
  font-size: .9rem;
  text-align: center;
  transition: var(--trans);
  min-height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.match-tile:hover:not(.matched):not(:disabled) { border-color: var(--green); background: #e8f5ed; }
.match-tile.selected { border-color: var(--gold); background: #fdf8ec; font-weight: 600; }
.match-tile.matched  { border-color: var(--correct); background: #e8f5ed; color: var(--correct); font-weight: 600; opacity: .7; cursor: default; }
.match-tile.wrong-flash { border-color: var(--red); background: #fdecea; }

.match-progress { text-align: center; color: var(--text-m); font-size: .85rem; }

.match-complete {
  text-align: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.match-complete h2 { color: var(--green); margin-bottom: .4rem; }
.match-complete .time-display { font-size: 2.5rem; font-weight: 800; color: var(--gold); }

/* ── Shared Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  transition: var(--trans);
}
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-l); }
.btn-gold    { background: var(--gold); color: var(--green-d); }
.btn-gold:hover { background: var(--gold-l); }
.btn-outline { background: transparent; border: 2px solid var(--green); color: var(--green); }
.btn-outline:hover { background: var(--green); color: var(--white); }
.btn-sm { padding: .35rem .85rem; font-size: .78rem; }

.result-card .card-actions {
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid var(--cream-d);
  justify-content: flex-end;
}

.corrected-badge {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #e8f5ed;
  color: var(--correct);
  padding: .15rem .45rem;
  border-radius: 10px;
}

.user-added-badge {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #fdf8ec;
  color: var(--gold);
  padding: .15rem .45rem;
  border-radius: 10px;
}

.no-result-actions {
  margin-top: 1rem;
}

/* ── Corrections nav button ── */
.corrections-nav-btn {
  background: rgba(255,255,255,.12) !important;
  border-color: rgba(255,255,255,.35) !important;
}
.corrections-nav-btn:hover {
  background: var(--gold) !important;
}
.corrections-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 .3rem;
  margin-left: .25rem;
  background: var(--gold);
  color: var(--green-d);
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 800;
}

/* ── Correction modal ── */
body.corr-modal-open { overflow: hidden; }

.corr-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.corr-modal.open { opacity: 1; visibility: visible; }

.corr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.corr-modal-dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.corr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--green);
  color: var(--white);
}
.corr-modal-title { font-size: 1rem; font-weight: 700; }
.corr-modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  padding: .25rem;
  line-height: 1;
}

.corr-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.corr-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--cream-d);
  background: var(--cream);
}
.corr-modal-footer-left { display: flex; gap: .5rem; flex-wrap: wrap; }
.corr-modal-actions { display: flex; gap: .5rem; margin-left: auto; }

.corr-field {
  display: block;
  margin-bottom: 1rem;
}
.corr-field > span {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-m);
  margin-bottom: .35rem;
}
.corr-field input,
.corr-field textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 2px solid var(--cream-d);
  border-radius: var(--radius);
  font: inherit;
  font-size: .95rem;
  background: var(--white);
}
.corr-field input:focus,
.corr-field textarea:focus {
  outline: none;
  border-color: var(--green);
}

.corr-def-block {
  background: var(--cream);
  border: 1px solid var(--cream-d);
  border-radius: var(--radius);
  padding: .85rem;
  margin-bottom: .75rem;
}
.corr-def-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
  color: var(--green);
}
.corr-remove-def,
.corr-remove-item {
  background: none;
  border: none;
  color: var(--text-l);
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem .4rem;
}
.corr-remove-def:hover,
.corr-remove-item:hover { color: var(--red); }

.corr-hint {
  font-size: .78rem;
  color: var(--text-l);
  margin-top: .5rem;
  line-height: 1.5;
}
.corr-hint code {
  font-size: .75rem;
  background: var(--cream-d);
  padding: .1rem .35rem;
  border-radius: 4px;
}

/* ── Corrections panel ── */
.corr-panel {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.corr-panel-inner {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(440px, 100%);
  box-shadow: var(--shadow);
  position: relative;
}
.corr-panel-inner h3 {
  color: var(--green);
  margin-bottom: .5rem;
}
.corr-panel-desc {
  font-size: .88rem;
  color: var(--text-m);
  margin-bottom: 1rem;
}
.corr-panel-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.corr-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.corr-import-label { cursor: pointer; }
.corr-panel-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: none;
  border: none;
  font-size: .85rem;
  color: var(--text-l);
  cursor: pointer;
}
.corr-panel-close:hover { color: var(--green); }

@media (max-width: 640px) {
  .corr-modal-footer { flex-direction: column; align-items: stretch; }
  .corr-modal-footer-left,
  .corr-modal-actions { width: 100%; justify-content: stretch; }
  .corr-modal-actions .btn { flex: 1; justify-content: center; }
}
.loading {
  text-align: center; padding: 3rem; color: var(--text-l);
  font-size: .95rem;
}
.loading::after {
  content: '';
  display: block;
  width: 36px; height: 36px;
  border: 3px solid var(--cream-d);
  border-top-color: var(--green);
  border-radius: 50%;
  margin: 1rem auto 0;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Responsive (phones, portrait-first) ── */
@media (max-width: 640px) {
  header {
    padding: 0 .9rem;
    padding-top: env(safe-area-inset-top);
    gap: .35rem;
  }
  .logo { padding: .55rem 0; }
  .logo-icon { font-size: 1.4rem; }
  .logo-text { font-size: .95rem; }
  .logo-sub  { font-size: .62rem; letter-spacing: .05em; }

  /* Nav: one horizontal scroll strip instead of wrapping to 2 rows */
  nav {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0 .5rem;
    gap: .4rem;
  }
  nav::-webkit-scrollbar { display: none; }
  nav button { flex: 0 0 auto; min-height: 40px; padding: .45rem .9rem; font-size: .8rem; }

  /* Roomier tap targets for direction toggles */
  .mode-btn button { min-height: 40px; padding: .5rem 1rem; }

  /* Search input stays put under the header while results scroll */
  #section-search { padding: 1rem .9rem calc(1.5rem + env(safe-area-inset-bottom)); }
  .search-wrap {
    position: sticky;
    top: var(--header-h, 56px);
    z-index: 40;
    background: var(--cream);
    margin: 0 -.9rem 1rem;
    padding: .5rem .9rem 0;
  }
  .search-wrap .clear-btn { right: 1.4rem; top: calc(50% + .25rem); }
  .search-wrap input { font-size: 1.05rem; } /* >=16px keeps iOS from zooming on focus */

  /* Glossary */
  #section-glossary { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .alpha-nav { padding: .55rem .4rem; gap: .15rem; }
  .alpha-nav a { width: 30px; height: 30px; font-size: .8rem; }
  .glossary-grid .g-cell { padding: .5rem; font-size: .82rem; min-height: 40px; }

  /* Games — bigger touch targets, safe-area-aware bottom padding */
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-opt { min-height: 48px; }
  .match-grid { grid-template-columns: 1fr 1fr; }
  .match-tile { font-size: .82rem; padding: .6rem .55rem; min-height: 52px; }
  .card-scene { height: 240px; }
  .card-actions .btn { min-height: 44px; flex: 1 1 auto; justify-content: center; }
  #section-flash, #section-quiz, #section-match {
    padding: 1rem .9rem calc(1.5rem + env(safe-area-inset-bottom));
  }
}
