@media (max-width: 900px) {
  .main {
    padding: 30px 23px;
  }
  .overview {
    grid-template-columns: repeat(2, 1fr);
  }
  .overview .metric:first-child {
    grid-column: span 2;
  }
  .flash-layout {
    grid-template-columns: 1fr;
  }
  .top {
    padding: 0 22px;
  }
  .topnav {
    margin-left: 0;
    gap: 17px;
  }
  .material-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
/* Sidebar desktop diganti drawer di sini (breakpoint disamakan dengan
   700px yang dipakai .mobile-nav/.topnav lewat style ter-inject di
   app.js - lihat mobilePwaStyle) - meluncur dari kiri, dipicu tombol
   hamburger yang sama, ditutup lewat backdrop atau tombol itu lagi.
   Bentuk rail/collapse desktop tidak dipakai di sini. */
@media (max-width: 700px) {
  .layout {
    display: block;
    padding: 0;
    gap: 0;
  }
  /* Di mobile, tombol dalam-sidebar tidak berguna (sidebar geser total
     keluar layar saat tertutup) - pakai tombol navbar sebagai gantinya,
     dan baris tombolnya disembunyikan total (bukan cuma tombolnya)
     supaya tidak menyisakan strip kosong 74px di puncak drawer. */
  .side-toggle-row {
    display: none;
  }
  .sidebar-toggle-mobile {
    display: flex;
  }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    width: min(82vw, 300px);
    max-height: 100vh;
    padding: 27px 16px;
    border-radius: 0 20px 20px 0;
    /* Tanpa shadow saat tertutup - box-shadow tidak ikut "terpotong"
       oleh transform seperti kotaknya sendiri, jadi blur-nya akan
       bocor ke tepi layar walau drawer sudah digeser keluar. Shadow
       baru ditambahkan lewat .sidebar-mobile-open di bawah, saat
       drawer benar-benar terlihat. */
    box-shadow: none;
    transform: translateX(-100%);
    transition:
      transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.3s ease;
    opacity: 1;
    pointer-events: auto;
    z-index: 70;
  }
  .layout.sidebar-mobile-open .side {
    transform: translateX(0);
    box-shadow:
      0 16px 40px -18px #05101f70,
      0 3px 10px -3px #05101f40;
  }
  /* Drawer mobile selalu tampilkan label penuh, terlepas dari
     preferensi rail "collapsed" desktop yang mungkin tersimpan di
     localStorage - selector disamakan supaya spesifisitasnya menang. */
  .layout.sidebar-collapsed .menu-label-text,
  .menu-label-text {
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .layout.sidebar-collapsed .menu-label,
  .layout.sidebar-collapsed .study-note {
    display: block;
  }
  .layout.sidebar-collapsed .side button[data-view] {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 12px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .active-indicator {
    left: 4px;
    right: 12px;
    border-radius: 12px;
  }
  .layout.sidebar-collapsed .side {
    padding-left: 16px;
    padding-right: 16px;
  }
  .sidebar-tooltip {
    display: none;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: #05101f66;
    z-index: 65;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .layout.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 610px) {
  .layout {
    display: block;
  }
  .top {
    height: 62px;
    padding: 0 16px;
  }
  .topnav {
    display: none;
  }
  .main {
    padding: 24px 16px;
    background-attachment: scroll;
  }
  .head {
    display: block;
  }
  .head > p {
    margin-top: 8px;
  }
  .overview,
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .overview .metric:first-child {
    grid-column: auto;
  }
  .flashcard {
    height: 275px;
  }
  .face .kana {
    font-size: 62px;
  }
}
/* Latar Jepang tampak jelas dengan overlay 10%. */
.main {
  background:
    linear-gradient(90deg, #f6f5f21a, #f6f5f21a),
    url("../assets/images/japan-paper-background.png") center/cover fixed;
}
.app {
  background: #d8d1c3;
  box-shadow: 0 25px 80px #0b142c2b;
}
.top {
  background-color: #13243e;
  background-image:
    radial-gradient(circle at 14% 50%, #d3ad6630 0 1px, transparent 1.5px),
    radial-gradient(circle at 19% 50%, #d3ad6622 0 1px, transparent 1.5px);
  background-size: 20px 20px;
  border-bottom-color: #b5904e;
}
.brand {
  color: #f3e7cb;
}
.brand small {
  color: #d0b478;
}
.topnav button {
  color: #c9d0d9;
}
.topnav button.active {
  color: #fff3d7;
  border-bottom-color: #d6ad65;
}
.identity {
  color: #c2cbd7;
}
.identity b {
  color: #f4dfae;
}
.main {
  background:
    linear-gradient(90deg, #dcd4c6cc, #dcd4c6cc),
    url("../assets/images/japan-paper-background.png") center/cover fixed;
}
.head {
  border-bottom-color: #a58d62;
}
.eyebrow {
  color: #876424;
}
.head h1,
.card h2,
.card h3 {
  color: #172740;
}
.head p {
  color: #59667b;
}
.card,
.course,
.answer {
  background: #e9e1d2;
  border-color: #cbb991;
  box-shadow: 0 8px 24px #1d2a3d18;
}
.card:before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid #b7985533;
  border-radius: 7px;
  pointer-events: none;
}
.today {
  background: linear-gradient(120deg, #eee6d7, #d7d9ca);
}
.metric b,
.level b,
.face .kana,
.back b,
.question {
  color: #13243e;
}
.primary {
  background: #142945;
  color: #f6e8c8;
  box-shadow: 0 5px 14px #1020373d;
}
.secondary {
  background: #d9c39a;
  color: #3d3020;
}
.filter.active {
  background: #142945;
  border-color: #142945;
  color: #f6e8c8;
}
.face {
  background: linear-gradient(140deg, #eee4d2, #dfe0d1);
  border-color: #c6b488;
  box-shadow: 0 15px 35px #17274025;
}
.back {
  background: linear-gradient(140deg, #d6c29b, #e3d5bd);
}
.answer:hover {
  background: #f2eadb;
  border-color: #a47e3d;
}
.track {
  background: #d6d0c3;
}
.fill {
  background: #234f87;
}
.card {
  position: relative;
  overflow: hidden;
  z-index: 2;
}
.card:after {
  content: "✦";
  position: absolute;
  right: 13px;
  top: 8px;
  color: #9b793826;
  font-size: 15px;
}
.lesson:before {
  content: "❀";
  position: absolute;
  right: 17px;
  bottom: 12px;
  color: #a3654c1c;
  font-size: 28px;
  font-family: serif;
} /* Ilustrasi Jepang tetap dominan; overlay hanya 10%. */
.main {
  background:
    linear-gradient(90deg, #dcd4c61a, #dcd4c61a),
    url("../assets/images/japan-paper-background.png") center/cover fixed;
}
.grammar-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.grammar-unit {
  background: #e9e1d2ef;
  border: 1px solid #cbb991;
  border-radius: 9px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 7px 18px #1d2a3d12;
}
.grammar-unit summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #142945;
  font-weight: 700;
}
.grammar-unit summary::-webkit-details-marker {
  display: none;
}
.grammar-unit summary:after {
  content: "+";
  margin-left: auto;
  color: #a47e3d;
  font-size: 19px;
  font-weight: 400;
}
.grammar-unit[open] summary {
  border-bottom: 1px solid #ceb98f;
  background: #e2d5bd;
}
.grammar-unit[open] summary:after {
  content: "−";
}
.lesson-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: #142945;
  color: #f6e8c8;
  font-size: 11px;
  flex: none;
}
.grammar-body {
  padding: 15px 18px 17px;
  color: #536176;
  line-height: 1.62;
}
.grammar-body p {
  margin: 0 0 10px;
}
.grammar-pattern {
  display: inline-block;
  background: #d9c39a;
  color: #3d3020;
  border-radius: 4px;
  padding: 4px 7px;
  font: 600 12px "Zen Kaku Gothic New";
}
.source-note {
  margin-top: 16px;
  border-left: 2px solid #d6ad65;
  background: #e5dbc8e8;
  padding: 13px 15px;
  color: #586477;
  font-size: 12px;
  line-height: 1.6;
}
@media (max-width: 610px) {
  .grammar-directory {
    grid-template-columns: 1fr;
  }
}
.pdf-reader {
  width: 100%;
  height: 78vh;
  min-height: 620px;
  border: 1px solid #bfa678;
  border-radius: 9px;
  background: #d8cfbd;
  box-shadow: 0 10px 28px #10203724;
}
.pdf-reader iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}
.pdf-note {
  margin: 0 0 15px;
  color: #526075;
  line-height: 1.55;
}
.source-directory {
  display: grid;
  gap: 13px;
}
.source-lesson {
  background: #e9e1d2ed;
  border: 1px solid #c4ae84;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px #10203716;
}
.source-lesson summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 19px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #142945;
  font-weight: 700;
}
.source-lesson summary::-webkit-details-marker {
  display: none;
}
.source-lesson summary:after {
  content: "Buka materi";
  margin-left: auto;
  background: #142945;
  color: #f4dfae;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 600;
}
.source-lesson[open] summary {
  background: #ded0b4;
  border-bottom: 1px solid #c4ae84;
}
.source-lesson[open] summary:after {
  content: "Tutup materi";
  background: #a47e3d;
}
.source-pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 17px;
  background: #cfc4ad66;
}
.source-pages img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 5px 15px #10203720;
}
.web-material-note {
  margin: 0 0 16px;
  color: #526075;
  line-height: 1.55;
}
@media (max-width: 700px) {
  .source-pages {
    grid-template-columns: 1fr;
  }
  .source-lesson summary:after {
    display: none;
  }
}
.lesson-web {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 15px;
  align-items: start;
}
.lesson-tabs {
  display: grid;
  gap: 6px;
  max-height: 680px;
  overflow: auto;
  padding: 7px;
  background: #d9cfbb;
  border: 1px solid #bfa678;
  border-radius: 9px;
}
.lesson-tab {
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  padding: 10px 11px;
  color: #34465d;
  font: 600 12px "DM Sans";
  cursor: pointer;
}
.lesson-tab:hover {
  background: #e8e0d2;
}
.lesson-tab.active {
  background: #f0e7d6;
  border-left-color: #a47e3d;
  color: #102037;
}
.lesson-paper {
  background: #eee5d5;
  border: 1px solid #c4ae84;
  border-radius: 10px;
  min-height: 560px;
  padding: 36px 42px;
  box-shadow: 0 10px 25px #10203717;
}
.lesson-paper h2 {
  font-size: 28px;
  color: #142945;
  margin: 8px 0 17px;
}
.lesson-paper h3 {
  font-size: 15px;
  color: #765723;
  margin: 24px 0 8px;
}
.lesson-paper p {
  line-height: 1.8;
  color: #3f5066;
  max-width: 760px;
}
.lesson-formula {
  display: inline-block;
  margin: 12px 0 7px;
  padding: 9px 13px;
  border-radius: 5px;
  background: #d5bd91;
  color: #382b1d;
  font: 600 15px "Zen Kaku Gothic New";
}
.lesson-points {
  margin: 14px 0;
  padding-left: 20px;
  color: #485970;
  line-height: 1.75;
}
.lesson-points li {
  margin: 5px 0;
}
.next-lesson {
  margin-top: 23px;
}
@media (max-width: 760px) {
  .lesson-web {
    grid-template-columns: 1fr;
  }
  .lesson-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }
  .lesson-tab {
    font-size: 0;
    text-align: center;
    padding: 10px 2px;
  }
  .lesson-tab:before {
    content: attr(data-number);
    font-size: 12px;
  }
  .lesson-paper {
    padding: 26px 21px;
  }
}
.html-course {
  display: grid;
  gap: 14px;
}
.html-lesson {
  background: #ebe2d1ee;
  border: 1px solid #bfa678;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px #10203714;
}
.html-lesson summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 20px;
  color: #13243e;
  font-weight: 700;
  font-size: 15px;
}
.html-lesson summary::-webkit-details-marker {
  display: none;
}
.html-lesson summary:after {
  content: "+";
  margin-left: auto;
  font-size: 22px;
  color: #9c7739;
  font-weight: 400;
}
.html-lesson[open] summary {
  background: #ddcfb1;
  border-bottom: 1px solid #c4ae84;
}
.html-lesson[open] summary:after {
  content: "−";
}
.html-content {
  padding: 23px 25px;
  background: #eee6d8e8;
}
.html-content h3 {
  font-size: 13px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #896625;
  margin: 0 0 8px;
}
.html-content p {
  color: #43536a;
  line-height: 1.75;
  margin: 0 0 17px;
  max-width: 900px;
}
.html-pattern {
  background: #d5bd91;
  border-left: 3px solid #a47e3d;
  padding: 10px 13px;
  color: #392b1d;
  font: 600 15px "Zen Kaku Gothic New";
  margin: 0 0 18px;
}
.html-note {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.html-note div {
  background: #e3d8c6;
  border: 1px solid #d0bf9e;
  padding: 13px;
  border-radius: 6px;
  color: #536176;
  font-size: 13px;
  line-height: 1.6;
}
.html-note b {
  display: block;
  color: #172740;
  margin-bottom: 4px;
  font-size: 12px;
}
@media (max-width: 650px) {
  .html-content {
    padding: 20px 17px;
  }
  .html-note {
    grid-template-columns: 1fr;
  }
}
.grammar-point {
  border-top: 1px solid #d0bf9e;
  padding: 17px 0;
}
.grammar-point:first-child {
  border-top: 0;
  padding-top: 0;
}
.grammar-point h3 {
  color: #172740;
  font-size: 16px;
  margin: 0 0 7px;
}
.grammar-point p {
  line-height: 1.75;
  color: #43536a;
  margin: 0 0 8px;
}
.grammar-example {
  display: block;
  background: #dfd2b9;
  border-left: 3px solid #a47e3d;
  padding: 8px 11px;
  color: #3b3023;
  font: 600 13px "Zen Kaku Gothic New";
}
.grammar-meaning {
  font: 400 12px "DM Sans";
  color: #647188;
  margin-left: 7px;
}
.grammar-audio-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border: 1px solid #a47e3d66;
  border-radius: 50%;
  background: #fffdf9cc;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.grammar-audio-button:hover {
  background: #fffdf9;
  border-color: #a47e3d;
  transform: scale(1.08);
}
/* Border kiri pola berubah warna sesuai status SRS-nya - hijau/amber
   yang SAMA PERSIS dengan .status-dot & .material-choice.done/.repeat
   di picker pelajaran, supaya satu bahasa visual di seluruh Materi. */
.grammar-point.grammar-point-done,
.grammar-point.grammar-point-repeat {
  padding-left: 12px;
  border-left: 3px solid transparent;
  transition: border-color 0.2s ease;
}
.grammar-point.grammar-point-done {
  border-left-color: #2e8068;
}
.grammar-point.grammar-point-repeat {
  border-left-color: #b56c38;
}
.grammar-rating {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.grammar-rating-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.grammar-rating-btn:hover {
  transform: scale(1.08);
}
.grammar-rating-good {
  border: 1px solid #2e806666;
  background: #fffdf9cc;
  color: #2e8068;
}
.grammar-rating-good:hover {
  background: #eaf5f0;
  border-color: #2e8068;
}
.grammar-rating-repeat {
  border: 1px solid #b56c3866;
  background: #fffdf9cc;
  color: #b56c38;
}
.grammar-rating-repeat:hover {
  background: #fbf1e9;
  border-color: #b56c38;
}
.inline-example {
  display: block;
  margin: 9px 0 2px;
  padding: 7px 9px;
  background: #dfd2b980;
  border-left: 2px solid #a47e3d;
  color: #3b3023;
  font: 600 12px "Zen Kaku Gothic New";
}
.inline-example em {
  font: 400 11px "DM Sans";
  color: #647188;
  margin-left: 6px;
  font-style: normal;
}
.pattern-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: 13px;
}
.pattern-table th,
.pattern-table td {
  border: 1px solid #c9b68e;
  padding: 9px;
  text-align: left;
}
.pattern-table th {
  background: #d7c296;
  color: #342918;
}
.mini-dialog {
  background: #e0d4bd;
  border-left: 3px solid #a47e3d;
  padding: 13px 15px;
  line-height: 1.75;
  color: #374960;
  margin: 12px 0;
}
.mini-dialog p {
  margin: 0 0 7px;
  color: inherit;
  line-height: 1.7;
}
.mini-dialog p:last-of-type {
  margin-bottom: 13px;
}
.mini-dialog small {
  display: block;
  padding-top: 11px;
  border-top: 1px solid #bfa67880;
  color: #56647a;
  line-height: 1.65;
}
.lesson-quiz {
  margin-top: 20px;
  padding: 16px;
  background: #dfd1b6;
  border: 1px solid #bfa678;
  border-radius: 7px;
}
.lesson-quiz p {
  margin: 0 0 10px;
}
.lesson-quiz button {
  margin: 4px 4px 0 0;
}
.quiz-feedback {
  font-weight: 700;
  margin-top: 10px;
  color: #284d41;
}
.material-focus-toggle {
  flex: none;
  padding: 7px 11px;
  border: 1px solid #c4ae84;
  border-radius: 7px;
  color: #7d5b22;
  background: #fffdf8;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.material-focus-toggle.active {
  color: #f8e8c4;
  background: var(--navy);
  border-color: var(--navy);
}
body.focus-mode .top,
body.focus-mode .side,
body.focus-mode .mobile-nav,
body.focus-mode .view.active > .head,
body.focus-mode .material-picker,
body.focus-mode .material-progress-panel {
  display: none !important;
}
body.focus-mode .layout {
  display: block;
}
body.focus-mode .main {
  padding: 22px 22px 60px;
  background-attachment: scroll;
}
body.focus-mode .material-learning-layout {
  grid-template-columns: 1fr;
  margin-top: 0;
}
body.focus-mode .material-reader {
  max-width: 860px;
  margin: 0 auto;
}
@media (prefers-reduced-motion: reduce) {
  .material-focus-toggle {
    transition: none;
  }
}

