:root {
  --blue: #0758d8;
  --deep-blue: #073b9a;
  --sky: #e8f7ff;
  --green: #58b62b;
  --orange: #ff6b13;
  --yellow: #ffc928;
  --teal: #0aa8a7;
  --purple: #7651c9;
  --red: #ef343e;
  --ink: #122042;
  --muted: #61708f;
  --line: #dbe7f6;
  --white: #ffffff;
  --shadow: 0 14px 34px rgba(21, 76, 148, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: #9cc7f2 #edf6ff;
  scrollbar-width: thin;
}

* {
  scrollbar-color: #9cc7f2 #edf6ff;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #edf6ff;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7fb4f1, #0d6bed);
  border: 2px solid #edf6ff;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #0d6bed, #0758d8);
}

body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: "Mitr", "Noto Sans Thai", "Tahoma", sans-serif;
  letter-spacing: 0;
}

body.reader-open,
body.modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(7, 88, 216, 0.035) 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(7, 88, 216, 0.035) 32px);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(7, 88, 216, 0.12);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 82px;
}

.brand img {
  width: 146px;
  height: auto;
}

.header-slogan {
  display: none;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.5vw, 28px);
  font-size: 20.7px;
  font-weight: 500;
  white-space: nowrap;
}

.main-nav a {
  position: relative;
  padding: 28px 0 22px;
  color: #14264c;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  height: 3px;
  border-radius: 999px;
  background: transparent;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--blue);
}

.main-nav a.active::after {
  background: var(--blue);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  width: min(245px, 20vw);
  height: 44px;
  padding: 0 8px 0 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(20, 54, 111, 0.06);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 19.3px;
}

.search-box button,
.cart-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.cart-button {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.cart-button b {
  position: absolute;
  top: -7px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #ffffff;
  background: var(--orange);
  border-radius: 999px;
  font-family: "Baloo 2", sans-serif;
  font-size: 17.9px;
}

.login-button,
.register-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 24px;
  color: #ffffff;
  background: linear-gradient(180deg, #0d6bed, #064fc5);
  border-radius: 999px;
  box-shadow: 0 12px 22px rgba(7, 88, 216, 0.25);
  font-weight: 600;
  white-space: nowrap;
}

.login-button {
  padding: 0 20px;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid #cfe0f4;
  box-shadow: none;
}

.login-button:hover {
  border-color: #a8d2ff;
  background: #f4f9ff;
}

.nav-toggle,
.menu-button {
  display: none;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  background:
    linear-gradient(180deg, #ffffff 0%, #ffffff 66%, #dff5ff 66%, #dff5ff 100%);
  border-bottom: 1px solid #cceeff;
}

.hero::before {
  content: "";
  position: absolute;
  left: -6vw;
  right: -6vw;
  bottom: 38px;
  height: 170px;
  background: #cdeeff;
  border-radius: 48% 52% 0 0 / 60% 58% 0 0;
  transform: rotate(-1deg);
}

.hero::after {
  content: "";
  position: absolute;
  left: -4vw;
  right: -4vw;
  bottom: -70px;
  height: 190px;
  background: #b7e4ff;
  border-radius: 45% 55% 0 0 / 72% 58% 0 0;
  transform: rotate(1deg);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(380px, 0.78fr) minmax(420px, 1.22fr);
  align-items: end;
  gap: 24px;
  width: min(1460px, calc(100% - 48px));
  min-height: 360px;
  margin: 0 auto;
}

.hero-copy {
  align-self: center;
  padding: 32px 0 34px;
}

.eyebrow {
  width: max-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 8px 14px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cce6ff;
  border-radius: 999px;
  font-weight: 600;
}

.hero h1 {
  margin: 0;
  color: var(--deep-blue);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: clamp(40px, 4vw, 66px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero h1 span,
.hero h1 strong {
  display: inline-block;
}

.hero h1 span {
  color: var(--green);
}

.hero h1 strong {
  color: var(--orange);
}

.hero-lead {
  max-width: 720px;
  margin: 14px 0 0;
  color: #24395f;
  font-size: clamp(15px, 1.05vw, 18px);
  line-height: 1.58;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 22px;
}

.hero-tags span {
  display: inline-flex;
  flex-direction: column;
  min-width: 142px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dfeaf8;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(25, 76, 146, 0.08);
  color: #53627d;
  font-size: 17.9px;
}

.hero-tags b {
  color: var(--blue);
  font-size: 23.5px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.primary-button {
  min-width: 290px;
  min-height: 58px;
  padding: 0 30px;
  font-size: 22.5px;
}

.start-price {
  margin: 0;
  color: #28395d;
  font-weight: 500;
}

.start-price strong {
  color: var(--orange);
  font-family: "Baloo 2", sans-serif;
  font-size: 41.4px;
  line-height: 1;
}

.hero-visual {
  align-self: end;
  margin-right: -44px;
}

.hero-visual img {
  width: min(650px, 52vw);
  margin-left: auto;
}

.grade-badge {
  position: absolute;
  right: 16px;
  bottom: 34px;
  display: grid;
  place-items: center;
  width: 190px;
  min-height: 128px;
  padding: 18px;
  color: #ffffff;
  background: linear-gradient(180deg, #0871ee, #064fc4);
  border: 5px solid #ffffff;
  border-radius: 38% 62% 45% 55% / 58% 44% 56% 42%;
  box-shadow: 0 16px 24px rgba(7, 88, 216, 0.24);
  text-align: center;
  transform: rotate(-4deg);
}

.grade-badge span {
  font-weight: 600;
}

.grade-badge strong {
  color: var(--yellow);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 46.0px;
  line-height: 1;
}

.star {
  position: absolute;
  z-index: 2;
  font-size: 41.4px;
  line-height: 1;
}

.star-a {
  top: 98px;
  left: 46px;
  color: var(--yellow);
  transform: rotate(-14deg);
}

.star-b {
  top: 150px;
  right: 138px;
  color: var(--purple);
}

.star-c {
  top: 245px;
  left: 5vw;
  color: var(--orange);
  font-size: 30.0px;
}

.section {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  position: relative;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.25;
}

.section-heading h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 5px;
  height: 1em;
  background: var(--blue);
  border-radius: 999px;
}

.section-heading a {
  color: var(--blue);
  font-weight: 600;
}

.subject-grid,
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.subject-card,
.level-card,
.product-card {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 24px rgba(25, 76, 146, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.subject-card:hover,
.level-card:hover,
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 30px rgba(25, 76, 146, 0.13);
}

.subject-card {
  display: grid;
  align-content: center;
  min-height: 166px;
  padding: 16px;
  border: 2px solid var(--card-color);
  text-align: center;
}

.subject-card.math { --card-color: #79b9f6; --card-soft: #eef8ff; --card-main: var(--blue); }
.subject-card.thai { --card-color: #8bd071; --card-soft: #f3fff0; --card-main: var(--green); }
.subject-card.english { --card-color: #ffb37d; --card-soft: #fff5ed; --card-main: var(--orange); }
.subject-card.science { --card-color: #a991e0; --card-soft: #f7f3ff; --card-main: var(--purple); }
.subject-card.art { --card-color: #ff9aa4; --card-soft: #fff2f4; --card-main: var(--red); }
.subject-card.social { --card-color: #55c6cb; --card-soft: #effdfd; --card-main: var(--teal); }

.subject-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 10px;
  background: var(--card-soft);
  border-radius: 8px;
  overflow: hidden;
}

.subject-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subject-card b {
  color: var(--card-main);
  font-size: 22.5px;
}

.subject-card small {
  color: #53627c;
  line-height: 1.35;
}

.levels {
  padding-top: 20px;
}

.level-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.level-card {
  min-height: 158px;
  padding: 16px 12px;
  border: 2px solid var(--level-color);
  text-align: center;
}

.level-icon {
  display: block;
  width: 68px;
  height: 68px;
  margin: 0 auto 8px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(25, 76, 146, 0.12);
}

.level-card.blue { --level-color: var(--blue); }
.level-card.green { --level-color: var(--green); }
.level-card.orange { --level-color: var(--orange); }
.level-card.purple { --level-color: var(--purple); }
.level-card.red { --level-color: var(--red); }
.level-card.teal { --level-color: var(--teal); }

.level-card b {
  display: block;
  color: var(--level-color);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 34.5px;
  line-height: 1;
}

.level-card span {
  display: block;
  margin-top: 5px;
  color: #42526f;
  font-size: 17.9px;
  line-height: 1.35;
}

.products {
  padding-top: 22px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.product-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  min-height: 140px;
  padding: 10px;
  border: 1px solid var(--line);
}

.product-card img {
  width: 86px;
  height: 120px;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  box-shadow: 0 8px 14px rgba(20, 50, 90, 0.13);
}

.product-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-info h3 {
  margin: 0 0 4px;
  color: #14264c;
  font-size: 22.1px;
  line-height: 1.25;
}

.product-info p {
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 3px 8px;
  color: var(--blue);
  background: #edf6ff;
  border: 1px solid #cce4ff;
  border-radius: 999px;
  font-size: 16.6px;
}

.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.product-foot strong {
  color: var(--orange);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 32.2px;
  line-height: 1;
}

.price-stack {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 2px;
  min-width: max-content;
  line-height: 1;
}

.price-stack strong {
  color: var(--orange);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 32.2px;
  line-height: 1;
}

.price-stack .old-price {
  color: #8291aa;
  font-size: 16.6px;
  font-weight: 800;
  text-decoration: line-through;
}

.price-stack .discount-badge {
  width: max-content;
  padding: 3px 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #ff6b1a, #e11d48);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(255, 107, 26, 0.22);
  font-size: 15.2px;
  font-weight: 900;
}

.bundle-note {
  width: max-content;
  max-width: 100%;
  margin: 0 0 6px;
  padding: 4px 10px;
  color: #075985;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 999px;
  font-size: 16.6px;
  font-weight: 900;
}

.reader-heading .bundle-preview-list,
.bundle-preview-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  width: 100%;
  max-width: min(100%, 620px);
  max-height: 150px;
  margin: 9px 0 0;
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #f8fbff, #eef7ff);
  border: 1px solid #d6e8ff;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  scrollbar-width: thin;
}

.reader-heading .bundle-preview-list[hidden],
.bundle-preview-list[hidden] {
  display: none;
}

.reader-heading .bundle-preview-list button,
.bundle-preview-list button {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
  color: #18345d;
  background: #ffffff;
  border: 1px solid #cfe4ff;
  border-radius: 13px;
  box-shadow: 0 8px 18px rgba(23, 63, 120, 0.08);
  cursor: pointer;
  font: inherit;
  font-size: 17.2px;
  font-weight: 900;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.reader-heading .bundle-preview-list button:hover,
.bundle-preview-list button:hover {
  border-color: #8ec6ff;
  box-shadow: 0 10px 22px rgba(7, 88, 216, 0.14);
  transform: translateY(-1px);
}

.reader-heading .bundle-preview-list button.active,
.bundle-preview-list button.active {
  color: #073b9a;
  background: linear-gradient(180deg, #eff7ff, #ffffff);
  border-color: #63b3ff;
  box-shadow: 0 0 0 2px rgba(13, 107, 237, 0.1), 0 10px 22px rgba(7, 88, 216, 0.14);
}

.reader-heading .bundle-preview-list span,
.bundle-preview-list span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.reader-heading .bundle-preview-index,
.bundle-preview-index {
  justify-content: center;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  color: #0758d8;
  background: #eaf4ff !important;
  border: 1px solid #c7e0ff !important;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(7, 88, 216, 0.1);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 20.7px;
  font-weight: 900;
}

.reader-heading .bundle-preview-list button.active .bundle-preview-index,
.bundle-preview-list button.active .bundle-preview-index {
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8, #0b72ff) !important;
  border-color: #0758d8 !important;
}

.reader-heading .bundle-preview-text,
.bundle-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.product-foot button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  color: #ffffff;
  background: var(--blue);
  border-radius: 8px;
  cursor: pointer;
  font-family: "Baloo 2", sans-serif;
  font-size: 30.0px;
  font-weight: 800;
}

.products-featured {
  padding-top: 18px;
}

.home-product-card .product-meta {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 0 5px;
  padding: 3px 8px;
  color: var(--blue);
  background: #edf6ff;
  border: 1px solid #cce4ff;
  border-radius: 999px;
  font-size: 16.6px;
  font-weight: 700;
}

.home-product-card .product-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 7px;
}

.home-product-card .product-meta-row .product-meta {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 18.6px;
  font-weight: 900;
  line-height: 1.1;
}

.product-meta-subject.tone-math { color: #0758d8; background: #edf6ff; border-color: #b9d8ff; }
.product-meta-subject.tone-thai { color: #2f8a1f; background: #f0ffeb; border-color: #bfeab5; }
.product-meta-subject.tone-english { color: #e85b11; background: #fff3e9; border-color: #ffd0a8; }
.product-meta-subject.tone-science { color: #7651c9; background: #f6f0ff; border-color: #d9c9ff; }
.product-meta-subject.tone-art { color: #df2440; background: #fff0f3; border-color: #ffc4ce; }
.product-meta-subject.tone-social { color: #078284; background: #effdfd; border-color: #b9ecec; }

.product-meta-grade.grade-tone-1 { color: #0758d8; background: #eef7ff; border-color: #b9d8ff; }
.product-meta-grade.grade-tone-2 { color: #2f8a1f; background: #f0ffeb; border-color: #bfeab5; }
.product-meta-grade.grade-tone-3 { color: #e85b11; background: #fff3e9; border-color: #ffd0a8; }
.product-meta-grade.grade-tone-4 { color: #7651c9; background: #f6f0ff; border-color: #d9c9ff; }
.product-meta-grade.grade-tone-5 { color: #df2440; background: #fff0f3; border-color: #ffc4ce; }
.product-meta-grade.grade-tone-6,
.product-meta-grade.grade-tone-all { color: #078284; background: #effdfd; border-color: #b9ecec; }

.page-count-badge {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  color: #9a4c00 !important;
  background: #fff8e8 !important;
  border-color: #ffc978 !important;
  white-space: nowrap;
}

.page-count-badge svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-product-card .product-info > p {
  display: none;
}

.home-product-card.share-target {
  border-color: #0d6bed;
  box-shadow: 0 0 0 3px rgba(13, 107, 237, 0.16), 0 18px 34px rgba(7, 88, 216, 0.18);
}

.recommend-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(135deg, #ff2038 0%, #ff6b1a 58%, #ffc928 100%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(255, 59, 48, 0.28), 0 0 18px rgba(255, 201, 40, 0.2);
  font-size: 16.6px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(130, 23, 18, 0.28);
  pointer-events: none;
}

.recommend-badge::after {
  content: "";
  position: absolute;
  inset: -8px auto -8px -42px;
  width: 26px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: skewX(-18deg);
  animation: recommend-shine 2.4s ease-in-out infinite;
}

.home-product-card.is-recommended,
.product-card.is-recommended {
  border-color: rgba(255, 107, 26, 0.48);
  box-shadow: 0 12px 28px rgba(255, 107, 26, 0.12), 0 0 0 1px rgba(255, 201, 40, 0.1);
}

@keyframes recommend-shine {
  0%, 42% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  52% { opacity: 1; }
  78%, 100% { transform: translateX(150px) skewX(-18deg); opacity: 0; }
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.product-actions button {
  width: auto;
  min-width: 58px;
  height: 40px;
  padding: 0 13px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 19.3px;
  font-weight: 800;
}

.product-actions button[data-preview] {
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
}

.product-actions button[data-buy] {
  color: #ffffff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.product-actions .share-button {
  min-width: 34px;
  width: 34px;
  padding: 0;
  color: #18345d;
  background: #ffffff;
  border: 1px solid #cfe0f4;
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 22.5px;
}

.product-actions .share-button:hover {
  color: var(--blue);
  border-color: #9dccff;
  background: #f7fbff;
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 120;
  padding: 10px 14px;
  color: #ffffff;
  background: #12315f;
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(18, 32, 66, 0.22);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 17.9px;
  font-weight: 700;
}

.share-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.loading-card {
  opacity: 0.75;
}

.loading-card > div:first-child,
.cover-placeholder {
  display: grid;
  place-items: center;
  width: 86px;
  height: 120px;
  color: #8da2c0;
  background: linear-gradient(135deg, #eef7ff, #ffffff);
  border: 1px dashed #bdd8f4;
  border-radius: 6px;
  font-size: 16.6px;
  font-weight: 700;
}

.empty-featured {
  grid-column: 1 / -1;
  padding: 18px;
  color: #53627d;
  background: #f7fbff;
  border: 1px dashed #bcdcff;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(150px, 210px) minmax(220px, 1fr);
  gap: 10px;
  margin: 0 0 12px;
  padding: 14px;
  background: rgba(247, 251, 255, 0.96);
  border: 1px solid #d3eafa;
  border-radius: 8px;
}

.catalog-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.catalog-toolbar span {
  color: #53627d;
  font-size: 17.9px;
  font-weight: 800;
}

.catalog-toolbar select,
.catalog-toolbar input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: #18345d;
  background: #ffffff;
  border: 1px solid #cfe0f4;
  border-radius: 8px;
  outline: 0;
  font: inherit;
  font-weight: 700;
}

.catalog-toolbar select {
  cursor: pointer;
}

.catalog-result-count {
  margin: 0 0 12px;
  color: #53627d;
  font-weight: 700;
}

.benefits {
  margin-top: 28px;
  background: linear-gradient(180deg, #e8f7ff, #d9f0ff);
  border-top: 1px solid #bde4ff;
  border-bottom: 1px solid #bde4ff;
}

.benefit-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 0 18px;
  border-right: 1px dashed #78b8ea;
}

.benefit-item:last-child {
  border-right: 0;
}

.benefit-item > span {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  color: var(--blue);
  background: #ffffff;
  border: 2px solid #a8dcff;
  border-radius: 8px;
  font-family: "Baloo 2", sans-serif;
  font-size: 36.8px;
  font-weight: 800;
}

.benefit-item b,
.benefit-item small {
  display: block;
}

.benefit-item b {
  color: var(--deep-blue);
  font-size: 23.5px;
}

.benefit-item small {
  color: #53627c;
  line-height: 1.35;
}

.site-footer {
  color: #ffffff;
  background:
    linear-gradient(135deg, #0757d4 0%, #0147b6 48%, #00358f 100%);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.25fr 0.7fr 0.8fr 1fr 1.2fr;
  gap: 36px;
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 20px;
}

.footer-brand img {
  width: 160px;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
}

.footer-brand p,
.footer-column p,
.newsletter p {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.footer-column h2,
.newsletter h2 {
  margin: 0 0 10px;
  font-size: 22.5px;
}

.footer-column a {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.86);
}

.newsletter div {
  display: flex;
  margin-top: 14px;
  padding: 5px;
  background: #ffffff;
  border-radius: 999px;
}

.newsletter input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
}

.newsletter button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  color: #ffffff;
  background: var(--green);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.copyright {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 10px 0 18px;
  color: rgba(255, 255, 255, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 17.9px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(1460px, calc(100% - 48px));
  margin: 18px auto 0;
  color: #60708f;
  font-size: 19.3px;
}

.breadcrumbs a {
  color: var(--blue);
  font-weight: 600;
}

.page-hero {
  width: min(1460px, calc(100% - 48px));
  margin: 14px auto 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #eef9ff);
  border: 1px solid #d3eafa;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(21, 76, 148, 0.10);
}

.page-hero-inner {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  align-items: center;
  gap: 14px;
  min-height: 240px;
}

.page-hero-copy {
  padding: 26px 30px;
}

.page-hero-copy h1 {
  margin: 0;
  color: var(--deep-blue);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: clamp(34px, 3.1vw, 50px);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-hero-copy p:not(.eyebrow) {
  margin: 10px 0 0;
  color: #33486b;
  font-size: 20.7px;
  line-height: 1.62;
}

.page-hero-media {
  align-self: stretch;
  min-height: 240px;
}

.page-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.topic-nav a,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 999px;
  font-weight: 600;
}

.seo-text {
  padding-bottom: 28px;
}

.seo-text h2,
.content-block h2,
.info-card h2,
.article-card h2 {
  margin: 0 0 10px;
  color: var(--deep-blue);
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.25;
}

.seo-text p,
.content-block p,
.content-block li,
.info-card p,
.article-card p {
  color: #42526f;
  line-height: 1.75;
}

.feature-grid,
.article-grid,
.policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-card,
.article-card,
.content-block {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(25, 76, 146, 0.08);
}

.info-card,
.article-card {
  padding: 22px;
}

.article-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 14px;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  width: min(1460px, calc(100% - 48px));
  margin: 24px auto 36px;
}

.content-block {
  padding: 28px;
}

.content-block h1 {
  margin: 0 0 14px;
  color: var(--deep-blue);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: clamp(38px, 4vw, 60px);
  line-height: 1.05;
}

.content-block h2 {
  margin-top: 24px;
}

.content-block ul,
.content-block ol {
  padding-left: 24px;
}

.side-nav {
  position: sticky;
  top: 106px;
  align-self: start;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(25, 76, 146, 0.08);
}

.side-nav b,
.side-nav a {
  display: block;
}

.side-nav b {
  color: var(--deep-blue);
  margin-bottom: 10px;
}

.side-nav a {
  padding: 8px 0;
  color: #42526f;
}

.contact-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.contact-item {
  padding: 18px;
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
}

.contact-item b,
.contact-item span {
  display: block;
}

.contact-item b {
  color: var(--deep-blue);
  margin-bottom: 4px;
}

.faq-list details {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  color: var(--deep-blue);
  cursor: pointer;
  font-weight: 600;
}

.faq-list p {
  margin-bottom: 0;
}

.policy-note {
  padding: 14px 16px;
  background: #fff8e6;
  border: 1px solid #ffe0a3;
  border-radius: 8px;
  color: #5e4a13;
}

.subject-grid-large,
.level-grid-large {
  align-items: stretch;
}

.subject-grid-large .subject-card,
.level-grid-large .level-card {
  min-height: 220px;
  padding: 20px;
}

.level-grid-large {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-body,
.app-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 247, 255, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(7, 88, 216, 0.035) 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(7, 88, 216, 0.035) 32px);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(520px, 1fr);
  gap: 28px;
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 38px 0;
  align-items: center;
}

.auth-panel,
.auth-showcase,
.showcase-card,
.metric-card,
.workspace-section,
.online-viewer,
.progress-panel,
.smart-tools,
.purchase-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 34px;
}

.auth-logo img {
  width: 150px;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
}

.auth-copy h1,
.app-topbar h1 {
  margin: 10px 0 0;
  color: var(--deep-blue);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: clamp(40px, 4vw, 62px);
  line-height: 1.02;
}

.auth-copy p:not(.eyebrow) {
  color: #42526f;
  line-height: 1.72;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.login-form label,
.check-row {
  color: #24395f;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #cfe0f4;
  border-radius: 8px;
  outline: 0;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-field button,
.auth-submit,
.icon-action,
.avatar-link {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.password-field button {
  padding: 0 16px;
  color: var(--blue);
  background: #eff7ff;
  border-radius: 8px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 8px;
  font-size: 19.3px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.check-row span {
  line-height: 1.45;
}

.check-row a {
  color: var(--blue);
  font-weight: 700;
}

.form-row a {
  color: var(--blue);
  font-weight: 600;
}

.auth-submit {
  min-height: 54px;
  color: #ffffff;
  background: linear-gradient(180deg, #0d6bed, #064fc5);
  border-radius: 999px;
  box-shadow: 0 12px 22px rgba(7, 88, 216, 0.25);
}

.auth-hint {
  margin: 8px 0 0;
  color: #61708f;
  font-size: 17.9px;
}

/* Phone-OTP auth (login/register) */
.login-form [data-step] {
  display: grid;
  gap: 10px;
}

.login-form .code-input {
  letter-spacing: 0.3em;
  text-align: center;
  font-weight: 700;
  font-size: 25.0px;
}

.label-optional {
  color: #8a97ad;
  font-weight: 500;
}

.auth-ok {
  margin: 4px 0 0;
  padding: 10px 12px;
  color: #067647;
  background: #ecfdf3;
  border: 1px solid #abefc6;
  border-radius: 8px;
  font-size: 19.3px;
  font-weight: 600;
}

.auth-submit[disabled] {
  opacity: 0.65;
  cursor: default;
}

.auth-linkbtn {
  justify-self: center;
  margin-top: 2px;
  padding: 6px 10px;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-weight: 600;
  font-size: 19.3px;
  cursor: pointer;
}

.auth-error {
  margin: 4px 0 0;
  padding: 10px 12px;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 8px;
  font-size: 19.3px;
  font-weight: 600;
}

.auth-secondary {
  display: block;
  margin-top: 4px;
  padding: 15px 12px;
  text-align: center;
  color: var(--blue);
  background: #eff7ff;
  border: 1.5px solid #cfe0f4;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.auth-secondary:hover { background: #e2effd; }

.auth-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.auth-benefits span {
  padding: 10px 12px;
  color: var(--deep-blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  font-weight: 600;
}

.auth-showcase {
  padding: 18px;
}

.showcase-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--deep-blue);
  font-weight: 700;
  margin-bottom: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(88, 182, 43, 0.15);
}

.showcase-card {
  position: relative;
  overflow: hidden;
}

.showcase-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.showcase-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 14px;
  color: #ffffff;
  background: rgba(7, 58, 150, 0.86);
  border-radius: 8px;
}

.showcase-overlay b,
.showcase-overlay span {
  display: block;
}

.showcase-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.showcase-stats div {
  padding: 14px;
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
}

.showcase-stats b {
  display: block;
  color: var(--blue);
  font-family: "Baloo 2", sans-serif;
  font-size: 39.1px;
  line-height: 1;
}

.showcase-stats span {
  color: #42526f;
  font-size: 17.9px;
}

.app-body {
  display: grid;
  grid-template-columns: 268px 1fr;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.app-brand img {
  width: 148px;
  margin-bottom: 24px;
}

.app-nav {
  display: grid;
  gap: 10px;
}

.app-nav::-webkit-scrollbar {
  height: 7px;
}

.app-nav::-webkit-scrollbar-track {
  background: transparent;
}

.app-nav::-webkit-scrollbar-thumb {
  background: #b6d9fb;
  border: 0;
  border-radius: 999px;
}

.app-nav::-webkit-scrollbar-thumb:hover {
  background: #6eadf2;
}

.app-nav a,
.app-nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: #42526f;
  background: #ffffff;
  border: 1px solid #d9e9fb;
  border-radius: 8px;
  appearance: none;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(20, 78, 148, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.app-nav a::before,
.app-nav button::before {
  content: "";
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  background: #b7d8f8;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.app-nav a.active,
.app-nav a:hover,
.app-nav button.active,
.app-nav button:hover {
  color: var(--blue);
  background: #eff7ff;
  border-color: #b8d8ff;
  box-shadow: 0 10px 24px rgba(7, 88, 216, 0.12);
  transform: translateY(-1px);
}

.app-nav button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8, #0b72ff);
  border-color: #0758d8;
  box-shadow: 0 14px 26px rgba(7, 88, 216, 0.24);
}

.app-nav button.active::before {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.app-nav a:last-child {
  margin-top: 6px;
  color: var(--deep-blue);
  background: #f7fbff;
}

.app-nav a:focus-visible,
.app-nav button:focus-visible,
.tile-actions button:focus-visible,
.tile-actions a:focus-visible,
.store-actions button:focus-visible,
.viewer-toolbar a:focus-visible {
  outline: 3px solid rgba(255, 201, 40, 0.85);
  outline-offset: 2px;
}

.dashboard-view[hidden] {
  display: none;
}

.purchase-card {
  margin-top: 24px;
  padding: 16px;
}

.purchase-card span,
.purchase-card small,
.metric-card span,
.metric-card small {
  display: block;
  color: #61708f;
}

.purchase-card b {
  display: block;
  color: var(--deep-blue);
  font-size: 27.5px;
}

.app-main {
  min-width: 0;
  padding: 24px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.app-topbar .eyebrow {
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-search input {
  width: min(330px, 28vw);
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #cfe0f4;
  border-radius: 999px;
  outline: 0;
}

.icon-action,
.avatar-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--blue);
  background: #eff7ff;
  border-radius: 999px;
}

.icon-action {
  position: relative;
  border: 0;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.icon-action:hover {
  background: #e3f1ff;
  transform: translateY(-1px);
}

.icon-action::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 11px;
  width: 8px;
  height: 8px;
  background: var(--orange);
  border: 2px solid #ffffff;
  border-radius: 999px;
}

.avatar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 0 16px;
  font-weight: 700;
  transition: background 0.18s ease, transform 0.18s ease;
}

.avatar-link:hover {
  background: #e3f1ff;
  transform: translateY(-1px);
}

.empty-state {
  margin: 12px 0 0;
  padding: 22px 18px;
  text-align: center;
  color: #61708f;
  font-weight: 600;
  background: #f4f8ff;
  border: 1px dashed #cfe0f4;
  border-radius: 8px;
}

.notif {
  position: relative;
}

.notif.read .icon-action::after {
  display: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(300px, 84vw);
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(20, 50, 90, 0.18);
  z-index: 60;
}

.notif-head {
  margin: 4px 8px 8px;
  font-weight: 700;
  color: var(--ink);
}

.notif-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.notif-panel li {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 8px;
  background: #f7faff;
}

.notif-panel li b {
  color: var(--ink);
  font-size: 19.3px;
}

.notif-panel li span {
  color: #61708f;
  font-size: 17.9px;
  line-height: 1.5;
}

.worksheet-tile.is-new {
  border-color: rgba(88, 182, 43, 0.5);
  box-shadow: 0 12px 26px rgba(88, 182, 43, 0.14);
}

@media (max-width: 860px) {
  .notif-panel {
    left: 0;
    right: auto;
  }
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-card b {
  display: block;
  color: var(--blue);
  font-family: "Baloo 2", sans-serif;
  font-size: 50.6px;
  line-height: 1;
}

.metric-card.green b { color: var(--green); }
.metric-card.orange b { color: var(--orange); }
.metric-card.purple b { color: var(--purple); }

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
}

.workspace-layout.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-layout.single-column .store-section {
  margin-top: 0;
}

.workspace-main[hidden],
.workspace-side[hidden] {
  display: none;
}

.workspace-section,
.online-viewer,
.progress-panel,
.smart-tools {
  padding: 18px;
}

.workspace-section {
  position: relative;
  overflow: hidden;
}

.owned-section {
  background:
    linear-gradient(135deg, rgba(239, 247, 255, 0.98), rgba(255, 255, 255, 0.96) 52%),
    #ffffff;
  border-color: #b9d8ff;
}

.store-section {
  margin-top: 18px;
  background:
    linear-gradient(135deg, rgba(255, 249, 235, 0.98), rgba(244, 255, 244, 0.94) 58%),
    #ffffff;
  border-color: #ffd9a8;
}

.owned-section .workspace-heading h2,
.store-section .workspace-heading h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.owned-section .workspace-heading h2::after,
.store-section .workspace-heading h2::after {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: "Mitr", sans-serif;
  font-size: 16.6px;
  font-weight: 800;
}

.owned-section .workspace-heading h2::after {
  content: "ของฉัน";
  color: #0758d8;
  background: #dff0ff;
  border: 1px solid #b9d8ff;
}

.store-section .workspace-heading h2::after {
  content: "เลือกซื้อ";
  color: #2f7d19;
  background: #e9f9e3;
  border: 1px solid #c8edbb;
}

.workspace-heading,
.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.workspace-heading h2,
.progress-panel h2,
.smart-tools h2 {
  margin: 0;
  color: var(--deep-blue);
  font-size: 30.0px;
}

.workspace-heading p {
  margin: 4px 0 0;
  color: #61708f;
}

.segmented-control {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: #eff7ff;
  border-radius: 999px;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 12px;
  color: #42526f;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.segmented-control button.active {
  color: #ffffff;
  background: var(--blue);
}

.worksheet-library {
  display: grid;
  gap: 12px;
}

.worksheet-tile {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.owned-section .worksheet-tile {
  background: rgba(255, 255, 255, 0.9);
  border-color: #c5ddff;
  box-shadow: 0 8px 18px rgba(7, 88, 216, 0.06);
}

.worksheet-tile img {
  width: 82px;
  height: 106px;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  box-shadow: 0 8px 14px rgba(20, 50, 90, 0.13);
}

.worksheet-tile span {
  color: var(--blue);
  font-weight: 700;
}

.worksheet-tile h3 {
  margin: 4px 0;
  color: var(--ink);
  font-size: 25.0px;
}

.worksheet-tile p {
  margin: 0;
  color: #61708f;
}

.tile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tile-actions button,
.tile-actions a,
.viewer-toolbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  appearance: none;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(7, 88, 216, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.tile-actions button:hover,
.tile-actions a:hover,
.viewer-toolbar a:hover {
  background: #e3f1ff;
  border-color: #a8d2ff;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(7, 88, 216, 0.14);
}

.tile-actions button[data-preview],
.viewer-toolbar a {
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8, #0b72ff);
  border-color: #0758d8;
}

.tile-actions button[data-favorite] {
  width: 38px;
  padding: 0;
}

.tile-actions button.active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.store-link {
  color: var(--blue);
  font-weight: 700;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.store-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 14px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.store-section .store-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: #ffe0b9;
  box-shadow: 0 12px 24px rgba(255, 95, 20, 0.08);
}

.store-card.purchased {
  border-color: rgba(88, 182, 43, 0.62);
  box-shadow: 0 12px 26px rgba(88, 182, 43, 0.14);
}

.store-card img {
  width: 120px;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  background: #eff7ff;
  box-shadow: 0 10px 18px rgba(20, 50, 90, 0.16);
}

.store-card > div {
  display: grid;
  gap: 8px;
  padding: 0;
  align-content: start;
}

.store-card span {
  color: var(--blue);
  font-weight: 700;
}

.store-card h3,
.store-card p {
  margin: 0;
}

.store-card h3 {
  color: var(--ink);
  font-size: 25.0px;
}

.store-card p {
  color: #61708f;
  line-height: 1.55;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.store-actions b {
  color: var(--orange);
  font-family: "Baloo 2", sans-serif;
  font-size: 32.2px;
}

.store-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  appearance: none;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(7, 88, 216, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.store-actions button:hover {
  background: #e3f1ff;
  border-color: #a8d2ff;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(7, 88, 216, 0.14);
}

.store-actions button:first-of-type {
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8, #0b72ff);
  border-color: var(--blue);
}

.store-actions button.active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.viewer-toolbar span,
.viewer-toolbar b {
  display: block;
}

.viewer-toolbar span {
  color: #61708f;
  font-size: 17.9px;
}

.viewer-toolbar b {
  color: var(--deep-blue);
}

.viewer-frame {
  overflow: hidden;
  min-height: 460px;
  background: #f5f9ff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.viewer-frame iframe,
.preview-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.viewer-frame iframe {
  display: block;
  min-height: 460px;
}

.viewer-note {
  margin: 10px 0 0;
  color: #61708f;
  font-size: 17.9px;
  line-height: 1.55;
}

.worksheet-page {
  min-height: 164px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.worksheet-page b {
  color: var(--deep-blue);
}

.mock-lines {
  height: 28px;
  margin: 12px 0;
  background: repeating-linear-gradient(180deg, transparent 0 8px, #d9e8f8 9px 10px);
}

.mock-exercise {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  color: #42526f;
  border-top: 1px dashed #cfe0f4;
}

.mock-exercise i {
  width: 44px;
  height: 24px;
  border: 2px solid #b8d5ef;
  border-radius: 6px;
}

.progress-panel,
.smart-tools {
  margin-top: 14px;
}

.progress-ring {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  margin: 16px auto;
  background:
    radial-gradient(circle, #ffffff 0 58%, transparent 59%),
    conic-gradient(var(--green) 0 76%, #dbe7f6 76% 100%);
  border-radius: 50%;
}

.progress-ring span {
  color: var(--deep-blue);
  font-family: "Baloo 2", sans-serif;
  font-size: 39.1px;
  font-weight: 800;
}

.progress-panel p,
.smart-tools li {
  color: #42526f;
  line-height: 1.6;
}

.smart-tools ul {
  margin-bottom: 0;
  padding-left: 20px;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 32, 66, 0.55);
  backdrop-filter: blur(3px);
}

.preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(960px, 100%);
  height: min(88vh, 920px);
  overflow: hidden;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(12, 24, 55, 0.42);
}

.preview-dialog-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(18, 32, 66, 0.08);
  backdrop-filter: blur(14px);
}

.preview-dialog-bar span,
.preview-dialog-bar b {
  display: block;
}

.preview-dialog-bar span {
  color: #61708f;
  font-size: 17.9px;
}

.preview-dialog-bar b {
  color: var(--deep-blue);
  font-size: 25.0px;
}

.reader-heading {
  min-width: 0;
}

.reader-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.preview-dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-dialog-actions a,
.preview-dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.preview-dialog-actions a:last-child {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.reader-mobile-note {
  display: none;
}

.preview-dialog iframe {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  background: #f7fbff;
}

.preview-modal.ios-pdf-fit .preview-dialog {
  overflow: hidden;
}

.preview-modal.ios-pdf-fit .preview-dialog iframe {
  width: 118%;
  height: 118%;
  max-width: none;
  transform: scale(0.8475);
  transform-origin: top left;
  background: #ffffff;
}

.join-modal[hidden] {
  display: none;
}

.join-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 32, 66, 0.55);
  backdrop-filter: blur(4px);
}

.join-dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 26px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 28px 70px rgba(12, 24, 55, 0.34);
}

.join-dialog .eyebrow {
  margin-bottom: 10px;
}

.join-dialog h3 {
  margin: 0;
  color: var(--deep-blue);
  font-family: "Baloo 2", "Mitr", sans-serif;
  font-size: 39.1px;
  line-height: 1.05;
}

.join-dialog p:not(.eyebrow) {
  margin: 12px 0 0;
  color: #42526f;
  line-height: 1.65;
}

.join-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--deep-blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 30.0px;
  font-weight: 800;
  line-height: 1;
}

.join-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.join-actions .login-button,
.join-actions .register-button {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
}

@media (max-width: 1180px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100% - 40px));
  }

  .app-body {
    display: block;
  }

  .app-sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-brand img {
    width: 124px;
    margin-bottom: 0;
  }

  .app-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px;
    background: #f2f8ff;
    border: 1px solid #d7e9fb;
    border-radius: 8px;
    scroll-snap-type: x mandatory;
  }

  .app-nav a,
  .app-nav button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    scroll-snap-align: start;
    padding: 10px 14px;
    text-align: center;
  }

  .purchase-card {
    margin-top: 0;
  }

  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .workspace-side {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 14px;
  }

  .app-body[data-dashboard-view="viewer"] .workspace-side,
  .app-body[data-dashboard-view="downloads"] .workspace-side {
    display: block;
  }

  .workspace-side .online-viewer {
    grid-row: span 2;
  }

  .store-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .progress-panel,
  .smart-tools {
    margin-top: 0;
  }
}

@media (max-width: 860px) {
  .auth-shell {
    padding: 24px 0;
  }

  .auth-panel,
  .auth-showcase {
    padding: 22px;
  }

  .auth-copy h1,
  .app-topbar h1 {
    font-size: 48.3px;
  }

  .auth-showcase {
    display: none;
  }

  .app-sidebar {
    grid-template-columns: 1fr;
    align-items: start;
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
  }

  .app-nav {
    width: 100%;
  }

  .app-nav button.active {
    box-shadow: none;
  }

  .purchase-card {
    display: none;
  }

  .app-topbar {
    display: grid;
    align-items: start;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .app-search {
    flex: 1 1 100%;
  }

  .app-search input {
    width: 100%;
  }

  .workspace-heading,
  .viewer-toolbar {
    display: grid;
    align-items: start;
  }

  .segmented-control {
    overflow-x: auto;
    border-radius: 8px;
  }

  .segmented-control button {
    white-space: nowrap;
  }

  .worksheet-tile {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .worksheet-tile img {
    width: 76px;
    height: 98px;
  }

  .tile-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .workspace-side {
    grid-template-columns: 1fr;
  }

  .workspace-side .online-viewer {
    grid-row: auto;
  }

  .store-grid {
    grid-template-columns: 1fr;
  }

  .preview-dialog-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .preview-dialog-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .preview-dialog-actions a,
  .preview-dialog-actions button {
    flex: 1 1 0;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    width: min(100% - 24px, 420px);
  }

  .auth-panel,
  .auth-showcase,
  .workspace-section,
  .online-viewer,
  .progress-panel,
  .smart-tools {
    padding: 16px;
  }

  .auth-copy h1,
  .app-topbar h1 {
    font-size: 41.4px;
  }

  .password-field,
  .form-row,
  .showcase-stats,
  .auth-benefits,
  .app-grid,
  .store-actions {
    grid-template-columns: 1fr;
  }

  .password-field button {
    min-height: 42px;
  }

  .form-row {
    display: grid;
  }

  .app-main {
    padding: 14px;
  }

  .metric-card b {
    font-size: 41.4px;
  }

  .worksheet-tile {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
  }

  .worksheet-tile img {
    width: 70px;
    height: 92px;
  }

  .worksheet-tile h3 {
    font-size: 22.5px;
  }

  .tile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile-actions button,
  .tile-actions a,
  .viewer-toolbar a {
    width: 100%;
  }

  .viewer-frame {
    min-height: 360px;
  }

  .viewer-frame iframe {
    min-height: 360px;
  }

  .preview-modal {
    align-items: center;
    padding: 10px;
  }

  .preview-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    width: min(100%, 420px);
    height: calc(100dvh - 20px);
    max-height: none;
    border-radius: 12px;
  }

  .preview-dialog-actions {
    display: flex;
  }

  .preview-dialog-bar {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 58px;
    padding: 8px 10px;
  }

  .reader-back {
    min-height: 40px;
    padding: 0 12px;
  }

  .reader-heading .bundle-preview-list,
  .bundle-preview-list {
    max-width: 100%;
    max-height: 138px;
    margin-top: 7px;
    padding: 6px;
    border-radius: 14px;
  }

  .reader-heading .bundle-preview-list button,
  .bundle-preview-list button {
    min-height: 40px;
    padding: 6px 9px;
    font-size: 16.6px;
  }

  .reader-mobile-note {
    display: none;
  }

  .preview-dialog iframe {
    display: block;
    min-height: 0;
  }

  .preview-modal.ios-pdf-fit .preview-dialog iframe {
    width: 125%;
    height: 125%;
    transform: scale(0.8);
  }

  .progress-ring {
    width: 112px;
    height: 112px;
  }
}

@media (max-width: 1280px) {
  .header-inner {
    grid-template-columns: auto auto 1fr;
  }

  .brand img {
    width: 122px;
  }

  .main-nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .main-nav a {
    padding: 2px 0 10px;
  }

  .main-nav a::after {
    bottom: 3px;
  }

  .header-actions {
    justify-self: end;
  }

  .hero-inner {
    grid-template-columns: minmax(360px, 0.95fr) minmax(440px, 1.05fr);
  }

  .hero-visual {
    margin-right: -120px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-inner {
    grid-template-columns: 1.3fr 1fr 1fr;
  }

  .newsletter {
    grid-column: span 2;
  }
}

@media (max-width: 980px) {
  .header-inner,
  .hero-inner,
  .section,
  .breadcrumbs,
  .page-hero,
  .content-layout,
  .benefit-inner,
  .footer-inner,
  .copyright {
    width: min(100% - 32px, 760px);
  }

  .header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-height: 68px;
  }

  .brand {
    margin-right: auto;
  }

  .brand img {
    width: 118px;
  }

  .menu-button {
    display: grid;
    justify-self: end;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
  }

  .menu-button span {
    display: block;
    height: 3px;
    background: var(--blue);
    border-radius: 999px;
  }

  .main-nav {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 74px;
    display: none;
    grid-column: auto;
    order: initial;
    max-height: calc(100vh - 90px);
    padding: 10px;
    overflow: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .main-nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
  }

  .main-nav a::after {
    display: none;
  }

  .main-nav a.active {
    background: #eef7ff;
  }

  .nav-toggle:checked ~ .main-nav {
    display: grid;
  }

  .header-actions {
    display: flex;
    order: 3;
    flex: 0 0 100%;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 10px;
  }

  .search-box,
  .cart-button {
    display: none;
  }

  .login-button,
  .register-button {
    min-height: 42px;
    padding: 0 18px;
    font-size: 20.7px;
  }

  .hero {
    min-height: auto;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy {
    padding: 38px 0 0;
  }

  .hero h1 {
    font-size: clamp(30px, 7.5vw, 46px);
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .hero-lead {
    font-size: 22.1px;
  }

  .hero-tags {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-tags span {
    min-width: 0;
  }

  .hero-visual {
    margin: 8px auto 0;
  }

  .hero-visual img {
    width: min(560px, 100%);
    max-width: 100%;
    margin: 0 auto;
    display: block;
  }

  .grade-badge {
    right: 2px;
    bottom: 28px;
    width: 150px;
    min-height: 104px;
    padding: 12px;
  }

  .grade-badge strong {
    font-size: 36.8px;
  }

  .subject-grid,
  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subject-grid .subject-card:last-child {
    grid-column: 1 / -1;
  }

  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .benefit-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .benefit-item {
    padding: 12px;
    border: 1px dashed #9ed3f5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.56);
  }

  .page-hero-inner,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .page-hero-copy {
    padding: 30px;
  }

  .page-hero-media {
    min-height: 260px;
  }

  .feature-grid,
  .article-grid,
  .policy-grid,
  .contact-panel,
  .level-grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-nav {
    position: static;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .hero-inner,
  .section,
  .breadcrumbs,
  .page-hero,
  .content-layout,
  .benefit-inner,
  .footer-inner,
  .copyright {
    width: min(100% - 24px, 560px);
  }

  .hero-copy {
    padding-top: 18px;
  }

  .eyebrow {
    font-size: 17.9px;
  }

  .hero h1 {
    font-size: clamp(27px, 8vw, 38px);
    line-height: 1.14;
  }

  .hero-tags {
    grid-template-columns: 1fr;
  }

  .hero-tags span {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .primary-button {
    width: 100%;
    min-width: 0;
  }

  .start-price {
    width: 100%;
    text-align: center;
  }

  .hero-visual {
    margin: 4px auto 0;
  }

  .hero-visual img {
    width: min(460px, 100%);
  }

  .grade-badge {
    right: 0;
    bottom: 18px;
    width: 132px;
    min-height: 92px;
    border-width: 4px;
  }

  .grade-badge span {
    font-size: 17.9px;
  }

  .grade-badge strong {
    font-size: 32.2px;
  }

  .star-a,
  .star-b,
  .star-c {
    display: none;
  }

  .section {
    padding-top: 20px;
  }

  .section-heading {
    align-items: flex-end;
  }

  .section-heading h2 {
    font-size: 27.5px;
  }

  .subject-grid,
  .level-grid,
  .product-grid,
  .feature-grid,
  .article-grid,
  .policy-grid,
  .contact-panel,
  .level-grid-large,
  .benefit-inner,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .subject-grid .subject-card:last-child {
    grid-column: auto;
  }

  .level-card {
    min-height: 148px;
  }

  .product-card {
    grid-template-columns: 96px 1fr;
  }

  .product-card img {
    width: 96px;
    height: 128px;
  }

  .benefits {
    margin-top: 22px;
  }

  .newsletter {
    grid-column: auto;
  }

  .page-hero-copy,
  .content-block,
  .info-card,
  .article-card {
    padding: 20px;
  }

  .page-hero-copy h1,
  .content-block h1 {
    font-size: 43.7px;
  }
}

@media (max-width: 430px) {
  .brand img {
    width: 104px;
  }

  .hero h1 {
    font-size: 48.3px;
  }

  .hero-lead {
    line-height: 1.6;
  }

  .hero-visual {
    margin-left: -310px;
    margin-right: -120px;
  }

  .grade-badge {
    bottom: 10px;
  }

  .product-info h3 {
    font-size: 20.7px;
  }

  .footer-inner {
    gap: 24px;
  }

  .newsletter div {
    display: grid;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
  }

  .newsletter input {
    min-height: 42px;
  }
}

@media (max-width: 720px) {
  .site-header {
    border-bottom-color: rgba(7, 88, 216, 0.08);
  }

  .header-inner {
    flex-wrap: nowrap;
    width: calc(100% - 20px);
    min-height: 58px;
    gap: 6px;
    padding: 6px 0;
  }

  .brand {
    margin-right: 0;
  }

  .brand img {
    width: 84px;
  }

  .header-actions {
    order: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 6px;
    padding-bottom: 0;
  }

  .login-button,
  .register-button {
    min-height: 34px;
    padding: 0 11px;
    font-size: 17.9px;
    box-shadow: 0 8px 14px rgba(7, 88, 216, 0.16);
  }

  .login-button {
    box-shadow: none;
  }

  .menu-button {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 9px;
  }

  .main-nav {
    top: 60px;
    left: 10px;
    right: 10px;
  }

  .hero {
    background:
      linear-gradient(180deg, #ffffff 0%, #ffffff 70%, #dff5ff 70%, #dff5ff 100%);
  }

  .hero-inner {
    gap: 0;
  }

  .hero-copy {
    padding-top: 16px;
  }

  .eyebrow {
    margin-bottom: 8px;
    padding: 7px 11px;
    font-size: 16.6px;
  }

  .hero-lead {
    margin: 12px 0;
    font-size: 19.3px;
    line-height: 1.55;
  }

  .hero-tags {
    gap: 8px;
    margin: 12px 0 14px;
  }

  .hero-tags span {
    padding: 9px 11px;
    font-size: 16.6px;
  }

  .hero-tags b {
    font-size: 20.7px;
  }

  .primary-button {
    min-height: 48px;
    font-size: 22.1px;
  }

  .start-price strong {
    font-size: 34.5px;
  }

  .hero-visual {
    margin: 0 auto -4px;
  }

  .hero-visual img {
    width: min(360px, 100%);
  }

  .grade-badge {
    right: 6px;
    bottom: 8px;
    width: 112px;
    min-height: 78px;
    padding: 9px;
  }

  .grade-badge strong {
    font-size: 30.0px;
  }

  .products-featured {
    padding-top: 18px;
  }

  .product-actions {
    justify-content: flex-start;
  }

  .breadcrumbs {
    margin-top: 10px;
    font-size: 16.6px;
  }

  .page-hero {
    width: calc(100% - 20px);
    margin-top: 10px;
  }

  .page-hero-inner {
    display: block;
    min-height: 0;
  }

  .page-hero-copy {
    padding: 12px 14px;
  }

  .page-hero-copy h1 {
    font-size: 29.9px;
    line-height: 1.08;
  }

  .page-hero-copy p:not(.eyebrow) {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 16.6px;
    line-height: 1.45;
  }

  .page-hero-media {
    display: none;
  }

  .topic-nav {
    display: none;
  }

  .topic-nav a,
  .inline-link {
    min-height: 32px;
    padding: 0 10px;
    font-size: 16.6px;
  }

  .catalog-toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    width: min(100% - 18px, 430px);
    min-height: 100dvh;
    padding: 10px 0;
    align-items: start;
  }

  .auth-panel {
    padding: 18px 14px;
  }

  .auth-logo img {
    width: 98px;
    padding: 4px;
  }

  .auth-copy h1,
  .app-topbar h1 {
    margin-top: 6px;
    font-size: 34.5px;
    line-height: 1.08;
  }

  .auth-copy p:not(.eyebrow) {
    margin: 8px 0 0;
    font-size: 19.3px;
    line-height: 1.5;
  }

  .login-form {
    gap: 8px;
    margin-top: 12px;
  }

  .check-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 8px;
    font-size: 17.9px;
  }

  .check-row input {
    margin-top: 3px;
  }

  .login-form input {
    min-height: 44px;
  }

  .auth-submit {
    min-height: 48px;
  }

  .auth-benefits {
    display: none;
  }

  .join-dialog {
    padding: 22px 18px;
  }

  .join-dialog h3 {
    font-size: 32.2px;
  }

  .join-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .hero h1 {
    font-size: 39.1px;
    line-height: 1.08;
  }

  .hero-visual {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-visual img {
    width: min(330px, 100%);
  }

  .product-card {
    grid-template-columns: 82px 1fr;
    min-height: 128px;
  }

  .product-card img,
  .loading-card > div:first-child,
  .cover-placeholder {
    width: 82px;
    height: 112px;
  }

  .product-actions button {
    min-width: 0;
    padding: 0 8px;
  }
}

/* Mobile app shell: public pages, auth pages, and member dashboard only. */
@media (max-width: 720px) {
  :root {
    --mobile-tab-height: 86px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) {
    padding-bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    box-shadow: 0 8px 24px rgba(18, 47, 94, 0.08);
    backdrop-filter: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .header-inner {
    min-height: 54px;
    padding: 5px 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .brand img {
    width: 78px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .menu-button {
    display: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .header-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .login-button,
  body:not(.auth-body):not(.app-body):not(.admin-body) .register-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 17.9px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 96;
    width: min(164px, 38vw);
    min-height: 62px;
    padding: 0 18px;
    color: #ffffff;
    background: linear-gradient(135deg, #ff7a1a 0%, #0b72ff 58%, #064fc5 100%);
    border: 4px solid #ffffff;
    border-radius: 22px;
    box-shadow: 0 18px 34px rgba(7, 88, 216, 0.34), 0 8px 18px rgba(255, 122, 26, 0.22);
    font-size: 20.7px;
    font-weight: 900;
    transform: translateX(-50%);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button::before {
    content: "";
    width: 11px;
    height: 11px;
    margin-right: 7px;
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.2);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav {
    position: fixed;
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(132px, 1.25fr) minmax(0, 1fr);
    gap: 6px;
    max-height: none;
    min-height: 76px;
    padding: 8px;
    overflow: visible;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(184, 216, 255, 0.92);
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(12, 45, 90, 0.22);
    backdrop-filter: blur(16px);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .nav-toggle:checked ~ .main-nav {
    display: grid;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a {
    display: none;
    place-items: center;
    gap: 5px;
    min-width: 0;
    min-height: 58px;
    padding: 5px 2px 4px;
    color: #47617f;
    border-radius: 16px;
    font-size: 16.6px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a::before {
    content: "";
    display: block;
    width: 22px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 8px;
    opacity: 0.76;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"] {
    display: grid;
    grid-column: 1;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"]::before {
    border-radius: 11px 11px 8px 8px;
    background: linear-gradient(180deg, rgba(13, 107, 237, 0.12), rgba(13, 107, 237, 0));
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"] {
    display: grid;
    grid-column: 3;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]::before {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    box-shadow: inset 0 -7px 0 rgba(7, 88, 216, 0.12);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a.active {
    color: #ffffff;
    background: linear-gradient(180deg, #0d6bed, #064fc5);
    box-shadow: 0 10px 20px rgba(7, 88, 216, 0.24);
  }

  .preview-modal,
  .join-modal,
  .lightbox,
  .buy-modal,
  .notice-modal,
  .checking-modal {
    z-index: 140;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) main {
    overflow: clip;
  }

  .hero-copy {
    padding-top: 14px;
  }

  .hero-actions {
    gap: 8px;
  }

  .section.products-featured {
    padding-top: 14px;
  }

  .content-layout,
  .page-hero {
    margin-bottom: 12px;
  }
}

@media (max-width: 560px) {
  .auth-body {
    min-height: 100dvh;
  }

  .auth-shell {
    width: min(100% - 18px, 430px);
    min-height: auto;
    padding: 12px 0 18px;
  }

  .auth-panel {
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(20, 78, 148, 0.12);
  }

  .auth-logo img {
    width: 86px;
  }

  .auth-copy h1 {
    font-size: 32.2px;
  }

  .auth-secondary,
  .auth-submit {
    min-height: 46px;
  }
}

@media (max-width: 720px) {
  .app-body {
    display: block;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .app-sidebar {
    position: fixed;
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: block;
    height: auto;
    padding: 7px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(184, 216, 255, 0.92);
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(12, 45, 90, 0.22);
    backdrop-filter: blur(16px);
  }

  .app-brand,
  .purchase-card {
    display: none;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .app-nav a,
  .app-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 52px;
    padding: 5px 2px;
    color: #47617f;
    background: transparent;
    border: 0;
    border-radius: 14px;
    box-shadow: none;
    font-size: 15.2px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    transform: none;
  }

  .app-nav a::before,
  .app-nav button::before {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    margin: 0;
    color: currentColor;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    font-family: Arial, sans-serif;
    font-size: 22.5px;
    line-height: 1;
  }

  .app-nav button[data-view="overview"]::before { content: "O"; }
  .app-nav button[data-view="owned"]::before { content: "B"; }
  .app-nav button[data-view="store"]::before { content: "+"; }
  .app-nav a[href*="change-password"]::before { content: "P"; }

  .app-nav a:hover,
  .app-nav button:hover,
  .app-nav button.active {
    color: #ffffff;
    background: linear-gradient(180deg, #0d6bed, #064fc5);
    border: 0;
    box-shadow: 0 10px 20px rgba(7, 88, 216, 0.24);
    transform: none;
  }

  .app-nav a:last-child {
    margin-top: 0;
    color: #47617f;
    background: transparent;
  }

  .app-nav a:last-child:hover {
    color: #ffffff;
    background: linear-gradient(180deg, #0d6bed, #064fc5);
  }

  .app-main {
    padding: 10px 10px 0;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    margin: 0 -10px 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(207, 230, 255, 0.9);
    backdrop-filter: blur(14px);
  }

  .app-topbar .eyebrow {
    display: none;
  }

  .app-topbar h1 {
    margin: 0;
    font-size: 34.5px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .app-search {
    order: 3;
  }

  .app-search input {
    min-height: 40px;
    font-size: 17.9px;
  }

  .icon-action,
  .avatar-link {
    width: 40px;
    height: 40px;
  }

  .avatar-link span {
    display: none;
  }

  .app-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 10px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scroll-snap-type: x mandatory;
  }

  .metric-card {
    min-width: 170px;
    padding: 14px;
    scroll-snap-align: start;
  }

  .metric-card b {
    font-size: 36.8px;
  }

  .workspace-section,
  .online-viewer,
  .smart-tools {
    border-radius: 14px;
    padding: 14px;
  }
}

/* Mobile public dock v2: cleaner 3-action navigation. */
@media (max-width: 720px) {
  :root {
    --mobile-tab-height: 82px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav {
    left: 0;
    right: 0;
    bottom: 0;
    grid-template-columns: 1fr minmax(136px, 1.1fr) 1fr;
    min-height: calc(76px + env(safe-area-inset-bottom, 0px));
    padding: 9px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.98);
    border: 0;
    border-top: 1px solid rgba(198, 220, 246, 0.95);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 38px rgba(19, 49, 96, 0.16);
    backdrop-filter: blur(18px);
    pointer-events: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a {
    position: relative;
    display: none;
    min-height: 56px;
    padding: 7px 6px 5px;
    color: #60738f;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 18px;
    box-shadow: none;
    font-size: 16.6px;
    font-weight: 800;
    letter-spacing: 0;
    pointer-events: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"],
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"] {
    display: grid;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"] {
    grid-column: 1;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"] {
    grid-column: 3;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a::before {
    content: "";
    display: block;
    width: 22px;
    height: 22px;
    background: currentColor;
    border: 0;
    border-radius: 0;
    opacity: 0.92;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    box-shadow: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M3%2011.2%2012%203.7l9%207.5v8.6c0%20.7-.5%201.2-1.2%201.2h-5.1v-6.1H9.3V21H4.2C3.5%2021%203%2020.5%203%2019.8v-8.6Zm3%201.1V18h1.3v-5.1h9.4V18H18v-5.7l-6-5-6%205Z%27/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M3%2011.2%2012%203.7l9%207.5v8.6c0%20.7-.5%201.2-1.2%201.2h-5.1v-6.1H9.3V21H4.2C3.5%2021%203%2020.5%203%2019.8v-8.6Zm3%201.1V18h1.3v-5.1h9.4V18H18v-5.7l-6-5-6%205Z%27/%3E%3C/svg%3E");
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M6.2%203h9.6c1.2%200%202.2%201%202.2%202.2V21l-3-1.8-3%201.8-3-1.8L6%2021V5.2C6%204%207%203%208.2%203Zm1.8%203v11.4l1-.6%203%201.8%203-1.8%201%20.6V5.2c0-.1-.1-.2-.2-.2H8.2c-.1%200-.2.1-.2.2V6Zm2%202h4v2h-4V8Zm0%204h4v2h-4v-2Z%27/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M6.2%203h9.6c1.2%200%202.2%201%202.2%202.2V21l-3-1.8-3%201.8-3-1.8L6%2021V5.2C6%204%207%203%208.2%203Zm1.8%203v11.4l1-.6%203%201.8%203-1.8%201%20.6V5.2c0-.1-.1-.2-.2-.2H8.2c-.1%200-.2.1-.2.2V6Zm2%202h4v2h-4V8Zm0%204h4v2h-4v-2Z%27/%3E%3C/svg%3E");
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a.active {
    color: var(--blue);
    background: rgba(7, 88, 216, 0.08);
    border-color: rgba(7, 88, 216, 0.12);
    box-shadow: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button {
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    width: min(156px, 40vw);
    min-height: 52px;
    padding: 0 18px;
    color: #ffffff;
    background: #0758d8;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 16px 28px rgba(7, 88, 216, 0.32);
    font-size: 20.7px;
    font-weight: 900;
    letter-spacing: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button::before {
    content: "";
    width: 18px;
    height: 18px;
    margin-right: 8px;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M11%203h8c1.1%200%202%20.9%202%202v14c0%201.1-.9%202-2%202h-8v-2h8V5h-8V3Zm1.3%204.7L16.6%2012l-4.3%204.3-1.4-1.4%201.9-1.9H3v-2h9.8l-1.9-1.9%201.4-1.4Z%27/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M11%203h8c1.1%200%202%20.9%202%202v14c0%201.1-.9%202-2%202h-8v-2h8V5h-8V3Zm1.3%204.7L16.6%2012l-4.3%204.3-1.4-1.4%201.9-1.9H3v-2h9.8l-1.9-1.9%201.4-1.4Z%27/%3E%3C/svg%3E") center / contain no-repeat;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button:active {
    transform: translateX(-50%) translateY(1px);
  }
}

/* Mobile public dock v3: single playful worksheet button. */
@media (max-width: 720px) {
  :root {
    --mobile-tab-height: 114px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav {
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: grid;
    place-items: center;
    grid-template-columns: minmax(80px, 1fr) 92px minmax(80px, 1fr);
    min-height: 72px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.93);
    border: 1px solid rgba(197, 221, 248, 0.95);
    border-radius: 28px;
    box-shadow:
      0 18px 36px rgba(28, 67, 124, 0.18),
      0 4px 14px rgba(7, 88, 216, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
    pointer-events: auto;
    isolation: isolate;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -9px;
    height: 18px;
    z-index: -1;
    border-radius: 999px;
    background: rgba(7, 88, 216, 0.12);
    filter: blur(14px);
    pointer-events: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a,
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"],
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a:not([href*="worksheets"]) {
    display: none !important;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"] {
    position: relative;
    display: inline-flex !important;
    grid-column: 2;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 84px;
    height: 84px;
    min-height: 84px;
    padding: 0;
    color: #ffffff;
    background:
      radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 255, 255, 0) 9%),
      linear-gradient(145deg, #2d8cff 0%, #0758d8 58%, #043d9e 100%);
    border: 4px solid #ffffff;
    border-radius: 999px;
    box-shadow:
      0 20px 34px rgba(7, 88, 216, 0.34),
      0 7px 0 rgba(4, 61, 158, 0.22),
      inset 0 -8px 18px rgba(3, 45, 116, 0.22);
    font-size: 17.9px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    transform-origin: 50% 78%;
    animation: worksheet-pop 2.45s ease-in-out infinite;
    pointer-events: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"],
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="contact"] {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 100%;
    max-width: 96px;
    height: 56px;
    min-height: 56px;
    padding: 0;
    color: rgba(29, 58, 103, 0.7);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 18.6px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    transform: none;
    animation: none;
    pointer-events: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"] {
    grid-column: 1;
    justify-self: center;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="contact"] {
    grid-column: 3;
    justify-self: center;
    font-size: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"]::before,
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="contact"]::before {
    display: none;
    content: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="index"]::after {
    display: none;
    content: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="contact"]::after {
    content: "ติดต่อเรา";
    position: static;
    display: inline;
    inset: auto;
    z-index: auto;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-size: 18.6px;
    animation: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]::before {
    content: "";
    width: 25px;
    height: 25px;
    margin: 0;
    background: #ffffff;
    border: 0;
    border-radius: 0;
    opacity: 1;
    box-shadow: none;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M6.2%203h9.6c1.2%200%202.2%201%202.2%202.2V21l-3-1.8-3%201.8-3-1.8L6%2021V5.2C6%204%207%203%208.2%203Zm1.8%203v11.4l1-.6%203%201.8%203-1.8%201%20.6V5.2c0-.1-.1-.2-.2-.2H8.2c-.1%200-.2.1-.2.2V6Zm2%202h4v2h-4V8Zm0%204h4v2h-4v-2Z%27/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%2024%2024%27%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M6.2%203h9.6c1.2%200%202.2%201%202.2%202.2V21l-3-1.8-3%201.8-3-1.8L6%2021V5.2C6%204%207%203%208.2%203Zm1.8%203v11.4l1-.6%203%201.8%203-1.8%201%20.6V5.2c0-.1-.1-.2-.2-.2H8.2c-.1%200-.2.1-.2.2V6Zm2%202h4v2h-4V8Zm0%204h4v2h-4v-2Z%27/%3E%3C/svg%3E") center / contain no-repeat;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]::after {
    content: "";
    position: absolute;
    inset: -11px;
    z-index: -1;
    border-radius: 999px;
    background: rgba(7, 88, 216, 0.16);
    animation: worksheet-pulse 2.35s ease-in-out infinite;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]:active {
    transform: translateY(3px) scale(0.96);
    animation-play-state: paused;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button {
    position: static;
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    color: var(--blue);
    background: #ffffff;
    border: 1px solid #cfe0f4;
    border-radius: 999px;
    box-shadow: none;
    font-size: 17.9px;
    transform: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button::before {
    display: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .site-header .header-actions > .login-button:active {
    transform: translateY(1px);
  }
}

@keyframes worksheet-pop {
  0%, 100% { transform: translateY(0) scale(1); }
  12% { transform: translateY(-9px) scale(1.06, 0.94); }
  22% { transform: translateY(2px) scale(0.96, 1.05); }
  32% { transform: translateY(-3px) scale(1.02, 0.98); }
  44% { transform: translateY(0) scale(1); }
}

@keyframes worksheet-pulse {
  0%, 56%, 100% { opacity: 0.42; transform: scale(0.9); }
  18% { opacity: 0.18; transform: scale(1.16); }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"],
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="worksheets"]::after {
    animation: none;
  }
}

/* Compact home hero: prioritize recommended worksheets above the fold. */
.hero-tags,
.hero-actions {
  display: none;
}

@media (max-width: 900px) {
  .hero {
    min-height: 0;
  }

  .hero-copy {
    padding: 22px 0 0;
  }

  .hero h1 {
    font-size: clamp(28px, 7vw, 42px);
  }

  .hero-lead {
    margin-top: 10px;
    font-size: 19.3px;
    line-height: 1.5;
  }

  .hero-visual img {
    width: min(430px, 100%);
  }

  .grade-badge {
    width: 112px;
    min-height: 76px;
    bottom: 10px;
  }

  .products-featured {
    padding-top: 12px;
  }
}

@media (max-width: 430px) {
  .hero-copy {
    padding-top: 12px;
  }

  .hero-visual img {
    width: min(300px, 100%);
  }

  .grade-badge {
    width: 96px;
    min-height: 68px;
    font-size: 15.2px;
  }
}

/* Compact mobile discovery tiles on the public home page. */
@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .subjects,
  body:not(.auth-body):not(.app-body):not(.admin-body) .levels {
    padding-top: 16px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subjects .section-heading,
  body:not(.auth-body):not(.app-body):not(.admin-body) .levels .section-heading {
    margin-bottom: 10px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subjects .section-heading h2,
  body:not(.auth-body):not(.app-body):not(.admin-body) .levels .section-heading h2 {
    font-size: 25.0px;
    line-height: 1.12;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subjects .section-heading a,
  body:not(.auth-body):not(.app-body):not(.admin-body) .levels .section-heading a {
    font-size: 17.9px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-grid,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-grid .subject-card:last-child {
    grid-column: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-card,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-card {
    min-height: 112px !important;
    padding: 12px 8px 10px !important;
    border-width: 1.5px !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 18px rgba(22, 54, 105, 0.06);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-icon,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-icon img {
    max-width: 42px;
    max-height: 42px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-card b {
    font-size: 20.7px;
    line-height: 1.05;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-card small,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-card span {
    margin-top: 3px;
    font-size: 15.2px;
    line-height: 1.25;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .level-card b {
    font-size: 29.9px;
    line-height: 0.95;
  }
}

@media (max-width: 380px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-card,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-card {
    min-height: 106px;
    padding: 10px 7px 9px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-icon,
  body:not(.auth-body):not(.app-body):not(.admin-body) .level-icon {
    width: 44px;
    height: 44px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .subject-card b {
    font-size: 19.3px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .level-card b {
    font-size: 30.0px;
  }
}

/* Cleaner public home hero copy and image message. */
body:not(.auth-body):not(.app-body):not(.admin-body) .hero-copy {
  display: grid;
  align-content: center;
  gap: 12px;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 {
  max-width: 720px;
  line-height: 0.96;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 strong {
  display: block;
  margin-top: 2px;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-lead {
  max-width: 640px;
  margin-top: 0;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-visual {
  position: relative;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee {
  position: absolute;
  top: 18px;
  left: 38px;
  right: 38px;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 42px;
  overflow: hidden;
  color: var(--deep-blue);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(193, 222, 249, 0.9);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(25, 69, 135, 0.12);
  white-space: nowrap;
  pointer-events: none;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee span {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 0 18px;
  color: #064fc4;
  font-weight: 900;
  text-align: center;
  animation: hero-message-run 7.5s linear infinite;
}

@keyframes hero-message-run {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-copy {
    gap: 10px;
    padding-top: 18px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 {
    max-width: 100%;
    font-size: clamp(34px, 10.2vw, 46px);
    line-height: 0.98;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 strong {
    margin-top: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-lead {
    max-width: 100%;
    font-size: 20.0px;
    line-height: 1.52;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-visual {
    margin-top: 8px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-visual img {
    width: min(390px, 100%);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee {
    top: 8px;
    left: 18px;
    right: 18px;
    height: 34px;
    font-size: 18.6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee span {
    animation: none;
  }
}

/* Keep the hero message readable while the highlight moves. */
body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee {
  justify-content: center;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee::after {
  content: "";
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: -80px;
  width: 64px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: skewX(-18deg);
  animation: hero-message-sweep 2.7s ease-in-out infinite;
}

body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee span {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0 16px;
  animation: hero-message-shine 2.7s linear infinite;
}

body:not(.auth-body):not(.admin-body):not(.app-body) .hero-marquee span + span {
  display: none;
}

@keyframes hero-message-shine {
  0%, 100% { color: #064fc4; }
  48% { color: #0a8bef; }
}

@keyframes hero-message-sweep {
  0% { left: -80px; opacity: 0; }
  22% { opacity: 1; }
  68% { left: calc(100% + 18px); opacity: 1; }
  100% { left: calc(100% + 18px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee::after {
    animation: none;
  }
}

/* Mobile header slogan belongs in the top bar, not on the hero image. */
body:not(.auth-body):not(.app-body):not(.admin-body) .hero-marquee {
  display: none !important;
}

@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .header-inner {
    grid-template-columns: 82px minmax(128px, 1fr) auto;
    gap: 10px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .header-slogan {
    position: relative;
    display: block;
    justify-self: center;
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #0758d8;
    font-size: 21.4px;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
    text-overflow: clip;
    background: linear-gradient(90deg, #0758d8 0%, #0758d8 34%, #ff7a1a 50%, #0758d8 66%, #0758d8 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: header-slogan-shine 3.2s ease-in-out infinite;
  }
}

@keyframes header-slogan-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@media (max-width: 380px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .header-slogan {
    font-size: 18.6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .header-slogan {
    animation: none;
  }
}

/* Final mobile header balance: readable slogan, unsqueezed logo. */
@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .header-inner {
    grid-template-columns: 88px minmax(116px, 1fr) auto;
    gap: 8px;
    width: calc(100% - 18px);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .brand {
    justify-self: start;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .brand img {
    width: 86px;
    min-width: 86px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .header-slogan {
    align-self: center;
    justify-self: center;
    font-size: 21.4px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .header-actions {
    justify-self: end;
    flex: 0 0 auto;
    gap: 6px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .login-button,
  body:not(.auth-body):not(.app-body):not(.admin-body) .register-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 17.2px;
  }
}

/* Put the preview share shortcut in the card corner instead of the action row. */
.home-product-card {
  position: relative;
}

.home-product-card .product-info {
  padding-right: 42px;
}

.home-product-card .product-actions .share-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  color: #0758d8;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cfe0f4;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(24, 52, 93, 0.12);
  font-size: 23.5px;
  line-height: 1;
}

.home-product-card .product-actions .share-button:hover {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

@media (max-width: 720px) {
  .home-product-card .product-info {
    padding-right: 0;
  }

  .home-product-card .product-meta-row,
  .home-product-card .product-info h3 {
    margin-right: 36px;
  }

  .product-foot {
    align-items: flex-end;
  }

  .product-actions {
    justify-content: flex-end;
    margin-left: auto;
  }

  .product-actions button {
    min-width: 64px;
    height: 40px;
    padding: 0 13px;
    font-size: 19.3px;
    border-radius: 9px;
  }

  .home-product-card .product-actions .share-button {
    top: 9px;
    right: 9px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 22.1px;
  }
}

/* Dashboard profile panel + richer mobile app dock. */
.profile-section {
  background:
    linear-gradient(135deg, rgba(239, 247, 255, 0.98), rgba(255, 255, 255, 0.96) 58%),
    #ffffff;
  border-color: #b9d8ff;
}

.profile-heading {
  align-items: flex-start;
}

.profile-back {
  min-height: 38px;
  padding: 0 14px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.profile-card {
  display: grid;
  gap: 13px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #d8e8fb;
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(7, 88, 216, 0.08);
}

.profile-card h3 {
  margin: 0 0 4px;
  color: var(--deep-blue);
  font-size: 27.5px;
}

.profile-card p {
  margin: 0;
  color: #61708f;
  line-height: 1.5;
}

.profile-card label {
  display: grid;
  gap: 6px;
  color: #314464;
  font-weight: 800;
}

.profile-card input,
.profile-card textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #f8fbff;
  border: 1px solid #cfe0f4;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
}

.profile-card textarea {
  min-height: 112px;
  padding-top: 10px;
  resize: vertical;
}

.pin-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.pin-field button {
  min-width: 58px;
  min-height: 44px;
  color: var(--blue);
  background: #eff7ff;
  border: 1px solid #cfe6ff;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.profile-submit {
  justify-self: start;
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8, #0b72ff);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(7, 88, 216, 0.18);
}

.profile-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.profile-status {
  padding: 10px 12px;
  border-radius: 9px;
  font-weight: 800;
}

.profile-status.ok {
  color: #137023;
  background: #ecfaef;
  border: 1px solid #bdecc6;
}

.profile-status.err {
  color: #b1261d;
  background: #fff0ef;
  border: 1px solid #ffc8c4;
}

@media (max-width: 720px) {
  .app-body {
    --mobile-tab-height: 104px;
    padding-bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 9px 10px 11px;
    overflow: visible;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 255, 0.94)),
      #ffffff;
    border: 1px solid rgba(165, 204, 255, 0.96);
    border-radius: 28px;
    box-shadow:
      0 22px 48px rgba(12, 45, 90, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.92);
  }

  .app-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .app-nav button,
  .app-nav a {
    position: relative;
    min-height: 62px;
    padding: 7px 3px 6px;
    color: #526987;
    background: transparent;
    border: 0;
    border-radius: 21px;
    font-size: 15.9px;
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
  }

  .app-nav button::before,
  .app-nav a::before {
    content: "";
    width: 24px;
    height: 24px;
    background: currentColor;
    border-radius: 0;
    box-shadow: none;
    -webkit-mask: var(--dash-nav-icon) center / contain no-repeat;
    mask: var(--dash-nav-icon) center / contain no-repeat;
  }

  .app-nav button[data-view="overview"] {
    --dash-nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M4 4h7v7H4V4Zm9 0h7v7h-7V4ZM4 13h7v7H4v-7Zm9 0h7v7h-7v-7Z'/%3E%3C/svg%3E");
  }

  .app-nav button[data-view="owned"] {
    --dash-nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M6 3h10.2C17.8 3 19 4.2 19 5.8V21l-3.5-2-3.5 2-3.5-2L5 21V4c0-.6.4-1 1-1Zm2 4v2h8V7H8Zm0 4v2h8v-2H8Zm0 4v2h5v-2H8Z'/%3E%3C/svg%3E");
  }

  .app-nav button[data-view="store"] {
    --dash-nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M5 5h14l1.2 5.2c.2 1-.5 2-1.5 2.3V20H5.3v-7.5c-1-.3-1.7-1.3-1.5-2.3L5 5Zm2 9v4h3v-4H7Zm5 0v4h4.7v-4H12Zm-5.4-7-.6 3h12l-.6-3H6.6Z'/%3E%3C/svg%3E");
  }

  .app-nav button[data-view="profile"] {
    --dash-nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M12 12a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Zm0 2c-4.4 0-8 2.2-8 5v2h16v-2c0-2.8-3.6-5-8-5Z'/%3E%3C/svg%3E");
  }

  .app-nav button:hover,
  .app-nav a:hover {
    color: var(--blue);
    background: rgba(13, 107, 237, 0.08);
    box-shadow: none;
    transform: translateY(-1px);
  }

  .app-nav button.active {
    min-height: 74px;
    color: #ffffff;
    background: linear-gradient(145deg, #0b72ff 0%, #0758d8 58%, #0641a8 100%);
    border: 4px solid #ffffff;
    border-radius: 26px;
    box-shadow:
      0 18px 32px rgba(7, 88, 216, 0.34),
      0 8px 16px rgba(255, 122, 26, 0.16);
    transform: translateY(-14px) scale(1.04);
  }

  .app-nav button.active::after {
    content: "";
    position: absolute;
    top: 9px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: #ffc928;
    border: 2px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 0 0 5px rgba(255, 201, 40, 0.2);
  }

  .app-nav button[data-view="store"].active {
    background: linear-gradient(145deg, #ff7a1a 0%, #0b72ff 48%, #0641a8 100%);
  }

  .profile-heading {
    gap: 10px;
  }

  .profile-back {
    width: 100%;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    padding: 15px;
    border-radius: 14px;
  }

  .profile-submit {
    width: 100%;
  }
}

/* Dashboard neo-minimal refresh: glass surfaces, soft gradients, calmer spacing. */
.app-body {
  --dash-surface: rgba(255, 255, 255, 0.78);
  --dash-surface-strong: rgba(255, 255, 255, 0.92);
  --dash-line: rgba(148, 190, 237, 0.42);
  --dash-shadow: 0 24px 70px rgba(23, 63, 120, 0.14);
  --dash-shadow-soft: 0 14px 34px rgba(23, 63, 120, 0.1);
  --dash-neon-blue: 0 18px 36px rgba(7, 88, 216, 0.22), 0 0 0 1px rgba(112, 190, 255, 0.36);
  --dash-neon-warm: 0 18px 36px rgba(255, 122, 26, 0.16), 0 0 0 1px rgba(255, 201, 40, 0.28);
  background:
    linear-gradient(155deg, #f7fbff 0%, #eef8ff 38%, #f8fff6 72%, #fffaf4 100%);
  color: #14264c;
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 88, 216, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(7, 88, 216, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 86%);
}

.app-sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 249, 255, 0.78));
  border-right: 1px solid rgba(184, 216, 255, 0.64);
  box-shadow: 18px 0 48px rgba(23, 63, 120, 0.1);
  backdrop-filter: blur(18px);
}

.app-brand img {
  border-radius: 18px;
  filter: drop-shadow(0 16px 24px rgba(7, 88, 216, 0.13));
}

.app-nav {
  gap: 9px;
}

.app-nav button,
.app-nav a {
  min-height: 50px;
  color: #48607f;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(184, 216, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(23, 63, 120, 0.07);
}

.app-nav button::before,
.app-nav a::before {
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #0b72ff, #3dd6b6);
  box-shadow: 0 0 18px rgba(11, 114, 255, 0.28);
}

.app-nav button:hover,
.app-nav a:hover {
  color: #0758d8;
  background: rgba(240, 248, 255, 0.94);
  border-color: rgba(126, 185, 255, 0.72);
  box-shadow: var(--dash-neon-blue);
}

.app-nav button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0758d8 0%, #0b72ff 58%, #23c7ad 100%);
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 22px 42px rgba(7, 88, 216, 0.28),
    0 0 30px rgba(35, 199, 173, 0.28);
}

.app-nav button.active::before {
  background: #ffffff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18), 0 0 22px rgba(255, 255, 255, 0.52);
}

.purchase-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(238, 249, 255, 0.78));
  border: 1px solid rgba(184, 216, 255, 0.62);
  border-radius: 20px;
  box-shadow: var(--dash-shadow-soft);
}

.app-main {
  padding: 26px min(3vw, 34px);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 48;
  margin: -8px 0 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(184, 216, 255, 0.58);
  border-radius: 24px;
  box-shadow: var(--dash-shadow-soft);
  backdrop-filter: blur(18px);
}

.app-topbar h1 {
  font-size: clamp(32px, 4vw, 46px);
  letter-spacing: 0;
}

.app-topbar .eyebrow {
  color: #0b72ff;
  background: rgba(235, 247, 255, 0.92);
  border-color: rgba(156, 207, 255, 0.76);
}

.app-search input {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(172, 209, 250, 0.78);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 10px 24px rgba(23, 63, 120, 0.08);
}

.icon-action,
.avatar-link {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 216, 255, 0.64);
  box-shadow: 0 12px 26px rgba(23, 63, 120, 0.1);
}

.app-grid {
  gap: 16px;
}

.metric-card,
.workspace-section,
.online-viewer,
.smart-tools {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 24px;
  box-shadow: var(--dash-shadow);
  backdrop-filter: blur(18px);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 20px;
}

.metric-card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, #0b72ff, #23c7ad);
  border-radius: 999px;
  opacity: 0.72;
}

.metric-card.orange::after {
  background: linear-gradient(90deg, #ff7a1a, #ffc928);
}

.metric-card.purple::after {
  background: linear-gradient(90deg, #7b5cff, #21c7c9);
}

.metric-card b {
  text-shadow: 0 8px 22px rgba(7, 88, 216, 0.18);
}

.workspace-layout {
  gap: 20px;
}

.workspace-section {
  padding: 22px;
}

.owned-section,
.store-section,
.profile-section {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(240, 249, 255, 0.7)),
    linear-gradient(135deg, rgba(11, 114, 255, 0.08), rgba(35, 199, 173, 0.08));
  border-color: rgba(164, 207, 255, 0.62);
}

.store-section {
  margin-top: 0;
  box-shadow: var(--dash-shadow), var(--dash-neon-warm);
}

.workspace-heading h2,
.progress-panel h2,
.smart-tools h2 {
  font-size: clamp(24px, 2.7vw, 32px);
}

.workspace-heading p {
  color: #5a6d8d;
  font-size: 20.7px;
}

.owned-section .workspace-heading h2::after,
.store-section .workspace-heading h2::after {
  min-height: 28px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(172, 209, 250, 0.72);
  box-shadow: 0 10px 24px rgba(23, 63, 120, 0.08);
}

.app-body .cat-bar {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.app-body .filter-control span {
  color: #506484;
}

.app-body .filter-control select {
  min-height: 46px;
  color: #14264c;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(172, 209, 250, 0.78);
  border-radius: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), 0 10px 24px rgba(23, 63, 120, 0.08);
}

.store-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.store-card,
.worksheet-tile,
.profile-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(184, 216, 255, 0.62);
  border-radius: 20px;
  box-shadow: 0 18px 38px rgba(23, 63, 120, 0.1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.store-card {
  gap: 14px;
  padding: 15px;
}

.store-card:hover,
.worksheet-tile:hover,
.profile-card:hover {
  border-color: rgba(11, 114, 255, 0.5);
  box-shadow: var(--dash-neon-blue);
  transform: translateY(-2px);
}

.store-card img,
.worksheet-tile img {
  border-radius: 16px;
  box-shadow: 0 18px 28px rgba(23, 63, 120, 0.16);
}

.store-card span,
.worksheet-tile span {
  width: max-content;
  max-width: 100%;
  padding: 4px 10px;
  color: #0758d8;
  background: rgba(235, 247, 255, 0.94);
  border: 1px solid rgba(172, 209, 250, 0.78);
  border-radius: 999px;
  font-size: 17.9px;
}

.store-card h3,
.worksheet-tile h3 {
  color: #12284e;
  line-height: 1.25;
}

.store-card p,
.worksheet-tile p {
  color: #5f708e;
}

.store-actions {
  align-items: flex-end;
  margin-top: 8px;
}

.store-actions b {
  margin-right: auto;
  text-shadow: 0 8px 18px rgba(255, 122, 26, 0.22);
}

.store-actions button,
.tile-actions button,
.tile-actions a,
.viewer-toolbar a,
.profile-submit,
.profile-back,
.pin-field button {
  min-height: 42px;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(23, 63, 120, 0.1);
}

.store-actions button:first-of-type,
.tile-actions button[data-preview],
.viewer-toolbar a,
.profile-submit {
  background: linear-gradient(135deg, #0758d8, #0b72ff 58%, #23c7ad);
  box-shadow: 0 16px 30px rgba(7, 88, 216, 0.22), 0 0 24px rgba(35, 199, 173, 0.18);
}

.store-actions button.active,
.tile-actions button.active {
  background: linear-gradient(135deg, #21b66d, #23c7ad);
  box-shadow: 0 14px 28px rgba(33, 182, 109, 0.2);
}

.viewer-frame {
  border-radius: 18px;
  border-color: rgba(184, 216, 255, 0.58);
  background: rgba(255, 255, 255, 0.72);
}

.profile-grid {
  gap: 16px;
}

.profile-card input,
.profile-card textarea {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(172, 209, 250, 0.78);
  border-radius: 14px;
}

.profile-card input[readonly] {
  color: #536985;
  background: linear-gradient(180deg, #f3f8ff, #eef5ff);
  border-color: rgba(190, 215, 244, 0.95);
  cursor: default;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

@media (max-width: 720px) {
  .app-body {
    background:
      linear-gradient(160deg, #f8fcff 0%, #eef8ff 42%, #f7fff7 100%);
  }

  .app-body::before {
    background-size: 34px 34px;
    opacity: 0.76;
  }

  .app-main {
    padding: 10px 10px 0;
  }

  .app-topbar {
    margin: 0 -2px 12px;
    padding: 12px;
    border-radius: 22px;
  }

  .app-topbar h1 {
    font-size: 36.8px;
  }

  .app-search {
    width: 100%;
  }

  .app-grid {
    gap: 10px;
  }

  .workspace-section,
  .online-viewer,
  .smart-tools {
    padding: 15px;
    border-radius: 22px;
  }

  .workspace-heading {
    align-items: flex-start;
  }

  .workspace-heading h2 {
    font-size: 32.2px;
  }

  .workspace-heading p {
    font-size: 19.3px;
  }

  .app-body .cat-bar {
    grid-template-columns: 1fr;
    gap: 9px;
    margin: 13px 0;
  }

  .store-grid {
    grid-template-columns: 1fr;
  }

  .store-card {
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 12px;
    border-radius: 18px;
  }

  .store-card img {
    width: 96px;
    border-radius: 14px;
  }

  .store-card h3 {
    font-size: 23.5px;
  }

  .store-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 17.9px;
  }

  .store-actions {
    justify-content: flex-end;
  }

  .store-actions b {
    flex: 1 0 100%;
    font-size: 29.9px;
  }

  .store-actions button {
    min-height: 40px;
    padding: 0 12px;
  }

  .worksheet-tile {
    border-radius: 18px;
  }

  .profile-card {
    border-radius: 18px;
  }

  .app-sidebar {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 255, 0.9));
    box-shadow:
      0 22px 48px rgba(23, 63, 120, 0.22),
      0 0 32px rgba(11, 114, 255, 0.16);
  }

  .app-nav button.active {
    box-shadow:
      0 18px 34px rgba(7, 88, 216, 0.32),
      0 0 28px rgba(35, 199, 173, 0.26);
  }
}

/* Dashboard mobile dock v2: compact, clean, less bulky. */
@media (max-width: 720px) {
  .app-body {
    --mobile-tab-height: 74px;
    padding-bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    left: 50%;
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(360px, calc(100% - 28px));
    padding: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(174, 208, 248, 0.72);
    border-radius: 999px;
    box-shadow:
      0 16px 34px rgba(23, 63, 120, 0.2),
      0 1px 0 rgba(255, 255, 255, 0.9) inset;
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    align-items: center;
    padding: 0;
  }

  .app-nav button,
  .app-nav a {
    min-height: 48px;
    padding: 5px 2px 4px;
    color: #60728d;
    background: transparent;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    font-size: 14.5px;
    font-weight: 900;
    line-height: 1.05;
    transform: none;
  }

  .app-nav button::before,
  .app-nav a::before {
    width: 19px;
    height: 19px;
    margin-bottom: 1px;
    background: currentColor;
    opacity: 0.9;
    box-shadow: none;
  }

  .app-nav button:hover,
  .app-nav a:hover {
    color: #0758d8;
    background: rgba(7, 88, 216, 0.07);
    box-shadow: none;
    transform: none;
  }

  .app-nav button.active,
  .app-nav button[data-view="store"].active {
    min-height: 50px;
    color: #ffffff;
    background: linear-gradient(135deg, #0758d8, #0b72ff 70%, #1fb9a5);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(7, 88, 216, 0.26);
    transform: none;
  }

  .app-nav button.active::after {
    display: none;
  }

  .app-nav button.active::before {
    background: #ffffff;
    box-shadow: none;
    opacity: 1;
  }
}

/* Dashboard catalog badges use the same color language as the public catalog. */
.dash-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
}

.store-card .dash-meta-row,
.worksheet-tile .dash-meta-row {
  width: 100%;
}

.store-card .dash-meta-row .product-meta,
.worksheet-tile .dash-meta-row .product-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-height: 26px;
  padding: 5px 11px;
  border-width: 1px;
  border-style: solid;
  border-radius: 999px;
  font-size: 17.9px;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.dash-meta-row .product-meta-subject.tone-math { color: #0758d8; background: #edf6ff; border-color: #b9d8ff; }
.dash-meta-row .product-meta-subject.tone-thai { color: #2f8a1f; background: #f0ffeb; border-color: #bfeab5; }
.dash-meta-row .product-meta-subject.tone-english { color: #e85b11; background: #fff3e9; border-color: #ffd0a8; }
.dash-meta-row .product-meta-subject.tone-science { color: #7651c9; background: #f6f0ff; border-color: #d9c9ff; }
.dash-meta-row .product-meta-subject.tone-art { color: #df2440; background: #fff0f3; border-color: #ffc4ce; }
.dash-meta-row .product-meta-subject.tone-social { color: #078284; background: #effdfd; border-color: #b9ecec; }

.dash-meta-row .product-meta-grade.grade-tone-1 { color: #0758d8; background: #eef7ff; border-color: #b9d8ff; }
.dash-meta-row .product-meta-grade.grade-tone-2 { color: #2f8a1f; background: #f0ffeb; border-color: #bfeab5; }
.dash-meta-row .product-meta-grade.grade-tone-3 { color: #e85b11; background: #fff3e9; border-color: #ffd0a8; }
.dash-meta-row .product-meta-grade.grade-tone-4 { color: #7651c9; background: #f6f0ff; border-color: #d9c9ff; }
.dash-meta-row .product-meta-grade.grade-tone-5 { color: #df2440; background: #fff0f3; border-color: #ffc4ce; }
.dash-meta-row .product-meta-grade.grade-tone-6,
.dash-meta-row .product-meta-grade.grade-tone-all { color: #078284; background: #effdfd; border-color: #b9ecec; }

.home-product-card .price-stack,
.store-card .price-stack {
  margin-right: auto;
}

.home-product-card .price-stack span,
.store-card .price-stack span {
  width: auto;
  max-width: none;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.home-product-card .price-stack .old-price,
.store-card .price-stack .old-price {
  color: #8291aa;
  font-size: 16.6px;
  font-weight: 800;
  text-decoration: line-through;
}

.home-product-card .price-stack .discount-badge,
.store-card .price-stack .discount-badge {
  width: max-content;
  padding: 3px 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #ff6b1a, #e11d48);
  border-radius: 999px;
  font-size: 15.2px;
  font-weight: 900;
}

.store-actions .price-stack strong {
  text-shadow: 0 8px 18px rgba(255, 122, 26, 0.22);
}

@media (max-width: 768px) {
  .store-card .dash-meta-row .product-meta,
  .worksheet-tile .dash-meta-row .product-meta {
    min-height: 28px;
    padding: 6px 11px;
    font-size: 18.6px;
  }
}

/* Mobile home refresh: compact hero + app-store style product tiles. */
@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) main {
    overflow-x: hidden;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero {
    min-height: 0;
    padding: 14px 12px 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f4fbff 100%);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero::before,
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero::after,
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-stars,
  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-visual,
  body:not(.auth-body):not(.app-body):not(.admin-body) .grade-badge {
    display: none !important;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-inner {
    display: block;
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-copy {
    display: block;
    padding: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 {
    max-width: 100%;
    margin: 0;
    font-size: clamp(30px, 9vw, 40px);
    line-height: 0.98;
    letter-spacing: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero h1 strong {
    display: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .hero-lead {
    margin: 8px 0 0;
    font-size: 17.9px;
    line-height: 1.42;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .products-featured {
    padding-top: 8px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .products-featured .section-heading {
    margin-bottom: 8px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .products-featured .section-heading h2 {
    font-size: 27.5px;
    line-height: 1.05;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-card {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 8px;
    min-height: 0;
    padding: 8px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #cfe0f4;
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(24, 52, 93, 0.08);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card img,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-card img,
  body:not(.auth-body):not(.app-body):not(.admin-body) .loading-card > div:first-child,
  body:not(.auth-body):not(.app-body):not(.admin-body) .cover-placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 11px;
    object-fit: cover;
    object-position: top center;
    box-shadow: 0 10px 18px rgba(20, 50, 90, 0.12);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 178px;
    padding: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-meta-row,
  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info h3 {
    margin-right: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-meta-row {
    gap: 4px;
    margin-bottom: 5px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-meta-row .product-meta {
    min-height: 23px;
    padding: 4px 8px;
    font-size: 15.9px;
    line-height: 1;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info h3 {
    display: -webkit-box;
    min-height: 42px;
    margin: 0 0 5px;
    overflow: hidden;
    color: #112149;
    font-size: 19.3px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .bundle-note {
    width: 100%;
    margin: 0 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15.2px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-foot {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 7px;
    margin-top: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .price-stack {
    min-width: 0;
    margin: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .price-stack strong {
    font-size: 29.9px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .price-stack .old-price {
    font-size: 15.2px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .price-stack .discount-badge {
    padding: 2px 7px;
    font-size: 14.5px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    width: 100%;
    gap: 6px;
    margin: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 17.9px;
    white-space: nowrap;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button[data-buy] {
    box-shadow: 0 10px 18px rgba(7, 88, 216, 0.2);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions .share-button {
    top: 8px;
    right: 8px;
    width: 31px;
    min-width: 31px;
    height: 31px;
    border-radius: 50%;
    font-size: 20.7px;
  }
}

@media (max-width: 380px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid {
    gap: 8px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-card {
    padding: 7px;
    border-radius: 12px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info {
    min-height: 170px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info h3 {
    font-size: 17.9px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button {
    height: 38px;
    font-size: 16.6px;
  }
}

/* Mobile worksheet catalog: prioritize products over the SEO hero copy. */
@media (max-width: 720px) {
  body.worksheet-page .breadcrumbs,
  body.worksheet-page .page-hero {
    display: none !important;
  }

  body.worksheet-page main {
    padding-top: 8px;
  }

  body.worksheet-page .worksheet-catalog {
    padding-top: 10px;
  }

  body.worksheet-page .worksheet-catalog .section-heading {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  body.worksheet-page .worksheet-catalog .section-heading h2 {
    font-size: 30.0px;
    line-height: 1.05;
  }

  body.worksheet-page .worksheet-catalog .section-heading a {
    font-size: 17.9px;
    white-space: nowrap;
  }

  body.worksheet-page .catalog-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 8px;
    padding: 10px;
    background: rgba(247, 251, 255, 0.82);
    border-color: #cfe6ff;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(23, 63, 120, 0.06);
  }

  body.worksheet-page .catalog-toolbar .catalog-search {
    grid-column: 1 / -1;
  }

  body.worksheet-page .catalog-toolbar label {
    gap: 4px;
  }

  body.worksheet-page .catalog-toolbar span {
    font-size: 16.6px;
    line-height: 1.1;
  }

  body.worksheet-page .catalog-toolbar select,
  body.worksheet-page .catalog-toolbar input {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 19.3px;
  }

  body.worksheet-page .catalog-result-count {
    margin: 0 0 8px;
    font-size: 17.9px;
  }

  body.worksheet-page #worksheet-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }
}

@media (max-width: 380px) {
  body.worksheet-page .catalog-toolbar {
    gap: 7px;
    padding: 8px;
  }

  body.worksheet-page .catalog-toolbar select,
  body.worksheet-page .catalog-toolbar input {
    min-height: 40px;
    font-size: 17.9px;
  }
}

/* Temporary contact route: keep the Facebook link in the mobile public dock's contact slot. */
@media (max-width: 720px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="facebook.com/kid.dd.lerning"] {
    position: relative;
    display: inline-flex !important;
    grid-column: 3;
    align-items: center;
    justify-content: center;
    justify-self: center;
    align-self: center;
    width: 100%;
    max-width: 96px;
    height: 56px;
    min-height: 56px;
    padding: 0;
    color: rgba(29, 58, 103, 0.7);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    transform: none;
    animation: none;
    pointer-events: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="facebook.com/kid.dd.lerning"]::before {
    display: none;
    content: none;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .main-nav a[href*="facebook.com/kid.dd.lerning"]::after {
    content: "ติดต่อเรา";
    position: static;
    display: inline;
    inset: auto;
    z-index: auto;
    color: inherit;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    font-size: 18.6px;
    animation: none;
  }
}

/* Desktop product cards: undo mobile-like crowding on wider screens. */
@media (min-width: 721px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    align-items: stretch;
  }

  body.worksheet-page #worksheet-product-grid,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid.product-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    min-height: 178px;
    padding: 12px;
    align-items: start;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card img,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-card img {
    width: 112px;
    height: 154px;
    max-width: 100%;
    object-fit: cover;
    object-position: top center;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info {
    display: flex;
    min-height: 154px;
    padding-right: 40px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-info h3 {
    display: -webkit-box;
    min-height: 44px;
    overflow: hidden;
    font-size: 23.5px;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    width: 100%;
    margin-top: auto;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .price-stack {
    min-width: 0;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: max-content;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button {
    width: auto;
    min-width: 62px;
    height: 40px;
    padding: 0 14px;
    white-space: nowrap;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button[data-preview] {
    min-width: 102px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions button[data-buy] {
    min-width: 58px;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid,
  body.worksheet-page #worksheet-product-grid,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-grid.product-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card img,
  body:not(.auth-body):not(.app-body):not(.admin-body) .product-card img {
    width: 96px;
    height: 132px;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-foot {
    grid-template-columns: 1fr;
  }

  body:not(.auth-body):not(.app-body):not(.admin-body) .home-product-card .product-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

/* DB Heavent is served locally so every page has the same Thai typeface. */
@font-face {
  font-family: "DB Heavent";
  src: url("assets/fonts/DBHeavent-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "DB Heavent";
  src: url("assets/fonts/DBHeavent-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
}

@font-face {
  font-family: "DB Heavent";
  src: url("assets/fonts/DBHeavent-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "DB Heavent";
  src: url("assets/fonts/DBHeavent-Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
}

html {
  font-synthesis: none;
}

/* Dashboard catalogue alignment: mirror the public worksheet cards and prevent
   price/actions from competing for the same narrow row. */
.app-body .app-topbar {
  background: #ffffff;
  border-color: #dbe9fb;
  isolation: isolate;
}

@media (min-width: 721px) {
  .app-body .store-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
  }

  .app-body .store-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 13px;
    min-height: 168px;
    padding: 12px;
    border-radius: 14px;
  }

  .app-body .store-card img {
    width: 96px;
    height: 128px;
    aspect-ratio: auto;
    border-radius: 10px;
  }

  .app-body .store-card > div {
    min-width: 0;
    min-height: 128px;
    gap: 6px;
  }

  .app-body .store-card h3 {
    min-height: 42px;
    margin: 0;
    font-size: 25px;
    line-height: 1.12;
  }

  .app-body .store-card .bundle-note {
    margin: 0;
  }

  .app-body .store-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    grid-template-rows: 38px 38px;
    gap: 8px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    margin-top: auto;
  }

  .app-body .store-actions .price-stack {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: end;
    min-width: 0;
    margin: 0;
  }

  .app-body .store-actions .price-stack strong {
    font-size: 34.5px;
    line-height: 0.95;
    white-space: nowrap;
  }

  .app-body .store-actions button,
  .app-body .store-actions button[data-preview-store],
  .app-body .store-actions .btn-buy {
    width: 96px;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 22.1px;
  }

  .app-body .store-actions button[data-preview-store] {
    grid-column: 2;
    grid-row: 1;
    order: initial;
  }

  .app-body .store-actions .btn-buy {
    grid-column: 2;
    grid-row: 2;
    order: initial;
  }
}

body,
body button,
body input,
body select,
body textarea,
body :is(h1, h2, h3, h4, p, a, span, b, strong, small, label, li) {
  font-family: "DB Heavent", "Noto Sans Thai", Tahoma, sans-serif !important;
}

/* Desktop worksheet catalogue: favour readable product cards over dense columns. */
@media (min-width: 721px) {
  body.worksheet-page #worksheet-product-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)) !important;
    gap: 16px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 13px;
    min-height: 168px;
    padding: 12px;
    border-radius: 14px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card img {
    width: 96px;
    height: 128px;
    border-radius: 10px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-info {
    min-height: 128px;
    padding-right: 42px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-meta-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-meta-row .product-meta {
    min-height: 26px;
    padding: 4px 10px;
    font-size: 22.1px;
    line-height: 1;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-info h3 {
    min-height: 42px;
    margin-bottom: 5px;
    font-size: 25.0px;
    line-height: 1.12;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .bundle-note {
    margin-bottom: 8px;
    font-size: 20.7px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-foot {
    grid-template-columns: minmax(0, 1fr) 96px;
    align-items: end;
    gap: 8px;
    width: calc(100% + 42px);
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .price-stack strong {
    font-size: 34.5px;
    white-space: nowrap;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .price-stack .old-price,
  body.worksheet-page #worksheet-product-grid .home-product-card .price-stack .discount-badge {
    font-size: 19.3px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-actions button,
  body.worksheet-page #worksheet-product-grid .home-product-card .product-actions button[data-preview],
  body.worksheet-page #worksheet-product-grid .home-product-card .product-actions button[data-buy] {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 22.1px;
  }

  body.worksheet-page #worksheet-product-grid .home-product-card .product-actions .share-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 23.5px;
  }
}

@media (min-width: 721px) and (max-width: 920px) {
  body.worksheet-page #worksheet-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Homepage featured cards use the same readable desktop structure as the catalogue. */
@media (min-width: 721px) {
  #home-product-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
  }

  #home-product-grid .home-product-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 13px;
    min-height: 168px;
    padding: 12px;
    border-radius: 14px;
  }

  #home-product-grid .home-product-card img {
    width: 96px;
    height: 128px;
    border-radius: 10px;
  }

  #home-product-grid .home-product-card .product-info {
    min-height: 128px;
    padding-right: 42px;
  }

  #home-product-grid .home-product-card .product-meta-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
  }

  #home-product-grid .home-product-card .product-meta-row .product-meta {
    min-height: 26px;
    padding: 4px 10px;
    font-size: 18.6px;
    line-height: 1;
  }

  #home-product-grid .home-product-card .product-info h3 {
    min-height: 42px;
    margin-bottom: 5px;
    font-size: 22.5px;
    line-height: 1.12;
  }

  #home-product-grid .home-product-card .product-foot {
    grid-template-columns: minmax(0, 1fr) 96px;
    align-items: end;
    gap: 8px;
    width: calc(100% + 42px);
  }

  #home-product-grid .home-product-card .price-stack strong {
    font-size: 30px;
    white-space: nowrap;
  }

  #home-product-grid .home-product-card .product-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  #home-product-grid .home-product-card .product-actions button,
  #home-product-grid .home-product-card .product-actions button[data-preview],
  #home-product-grid .home-product-card .product-actions button[data-buy] {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 19.3px;
  }

  #home-product-grid .home-product-card .product-actions .share-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 20px;
  }
}
