/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #FF9A8B;
  --primary-light: #FFECD2;
  --secondary: #667EEA;
  --secondary-light: #E0E7FF;
  --accent: #F093FB;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text-primary: #374151;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --bg-white: #FFFFFF;
  --bg-light: #F9FAFB;
  --bg-warm: #FFF7ED;
  --bg-pink: #FFF5F5;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Domain colors */
  --domain-language: #E0F2FE;
  --domain-language-text: #0369A1;
  --domain-math: #F3E8FF;
  --domain-math-text: #9333EA;
  --domain-science: #DCFCE7;
  --domain-science-text: #15803D;
  --domain-art: #FCE7F3;
  --domain-art-text: #DB2777;
  --domain-health: #FEF3C7;
  --domain-health-text: #D97706;
  --domain-social: #FEF9C3;
  --domain-social-text: #CA8A04;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-light);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary);
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 2rem 0;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-logo {
  font-size: 1.5rem;
}

.header-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-link {
  color: white;
  opacity: 0.85;
  font-size: 0.9rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
  color: white;
}

.nav-link.active {
  background: rgba(255,255,255,0.3);
  font-weight: 600;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}

.footer-content {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-content p {
  margin-bottom: 0.5rem;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 154, 139, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 154, 139, 0.5);
  color: white;
}

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-white);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* ===== Tags ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tag-grade {
  background: var(--secondary-light);
  color: var(--secondary);
}

.tag-domain {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-hot {
  background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
  color: white;
}

.tag-new {
  background: linear-gradient(135deg, #10B981, #34D399);
  color: white;
}

.tag-material {
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tag-price {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  font-weight: 700;
}

/* Domain-specific tags */
.tag-language { background: var(--domain-language); color: var(--domain-language-text); }
.tag-math { background: var(--domain-math); color: var(--domain-math-text); }
.tag-science { background: var(--domain-science); color: var(--domain-science-text); }
.tag-art { background: var(--domain-art); color: var(--domain-art-text); }
.tag-health { background: var(--domain-health); color: var(--domain-health-text); }
.tag-social { background: var(--domain-social); color: var(--domain-social-text); }

/* ===== Domain Gradient Covers ===== */
.domain-cover {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: inherit;
}

.domain-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 1;
}

.domain-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,0.03) 10px,
    rgba(255,255,255,0.03) 20px
  );
}

.domain-cover .cover-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0.75rem;
}

.domain-cover .cover-icon {
  font-size: 2.25rem;
  margin-bottom: 0.375rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.domain-cover .cover-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(0,0,0,0.75);
  text-align: center;
  padding: 0 0.5rem;
  position: relative;
  z-index: 1;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

.domain-cover .cover-grade {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(0,0,0,0.7);
  background: rgba(255,255,255,0.85);
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Domain gradient backgrounds - soft and warm */
.domain-cover.language::before { background: linear-gradient(145deg, #E0F2FE 0%, #BAE6FD 60%, #7DD3FC 100%); }
.domain-cover.math::before { background: linear-gradient(145deg, #F3E8FF 0%, #E9D5FF 60%, #D8B4FE 100%); }
.domain-cover.science::before { background: linear-gradient(145deg, #DCFCE7 0%, #BBF7D0 60%, #86EFAC 100%); }
.domain-cover.art::before { background: linear-gradient(145deg, #FCE7F3 0%, #FBCFE8 60%, #F9A8D4 100%); }
.domain-cover.health::before { background: linear-gradient(145deg, #FEF3C7 0%, #FDE68A 60%, #FCD34D 100%); }
.domain-cover.social::before { background: linear-gradient(145deg, #FEF9C3 0%, #FEF08A 60%, #FDE047 100%); }

/* ===== Filter Bar ===== */
.filter-section {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 50px;
}

.filter-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  color: var(--text-primary);
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ===== Search Box ===== */
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 0.95rem;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 154, 139, 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1rem;
}

.search-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.search-btn:hover {
  background: var(--accent);
}

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

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

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

/* ===== Product Card ===== */
.product-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px);
  border-color: var(--primary-light);
}

.product-card-thumb {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: var(--bg-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.domain-cover {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.product-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  display: block;
}

.product-card:hover .product-card-thumb img {
  transform: scale(1.05);
}

.thumb-placeholder {
  display: none;
}

.product-card-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  gap: 0.25rem;
  z-index: 3;
}

.product-card-body {
  padding: 0.875rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.product-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.product-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.8em;
}

.product-card-summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 0.625rem;
  line-height: 1.5;
}

.product-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.product-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.product-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.product-card-footer .btn {
  padding: 0.4rem 0.875rem;
  font-size: 0.8rem;
}

/* ===== Section ===== */
.section {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title-icon {
  font-size: 1.3rem;
}

.section-more {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s;
}

.section-more:hover {
  color: var(--primary);
}

/* ===== Tab ===== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.tab-item {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-item:hover {
  color: var(--primary);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Topic Card ===== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.topic-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.topic-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topic-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.topic-content {
  flex: 1;
}

.topic-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.topic-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== Info Card ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.info-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.info-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.info-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.info-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== Notice ===== */
.notice-box {
  background: linear-gradient(135deg, #FFF7ED, #FFF5F5);
  border: 1px solid #FED7AA;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.notice-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notice-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 2rem;
}

.notice-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notice-item::before {
  content: '•';
  color: var(--primary);
  font-weight: bold;
}

/* ===== Grade Section ===== */
.grade-section {
  margin-bottom: 2rem;
}

.grade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.grade-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grade-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.grade-icon.small { background: #FEF3C7; }
.grade-icon.middle { background: #DBEAFE; }
.grade-icon.large { background: #FCE7F3; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 0.9rem;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid-6 { grid-template-columns: repeat(4, 1fr); }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .topic-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Tablet: 768px - 1023px ===== */
@media (max-width: 1023px) {
  .container { max-width: 100%; }
}

/* ===== Mobile: <= 767px ===== */
@media (max-width: 768px) {
  /* Prevent horizontal overflow */
  html, body {
    overflow-x: hidden;
  }

  /* Compact Header */
  .header {
    padding: 0.625rem 0;
  }

  .header-inner {
    gap: 0.5rem;
  }

  .header-title {
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
  }

  .header-title span:last-child {
    display: none; /* Hide text on mobile, show logo only */
  }

  .header-logo {
    font-size: 1.25rem;
  }

  .header-nav {
    display: flex;
    gap: 0.125rem;
    flex-shrink: 0;
  }

  .nav-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }

  .nav-link:not(.active):not(:first-child) {
    display: none; /* Only show active nav item on mobile */
  }

  /* Main Content */
  .main-content {
    padding: 0.875rem 0;
  }

  .container {
    padding: 0 0.75rem;
  }

  /* Product Grid - 2 columns on tablet, 1 on mobile */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

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

  /* Product Card - mobile compact */
  .product-card-thumb {
    height: 110px;
  }

  .product-card-body {
    padding: 0.625rem;
  }

  .product-card-title {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
    min-height: auto;
  }

  .product-card-summary {
    font-size: 0.7rem;
    -webkit-line-clamp: 1;
  }

  .product-card-meta {
    font-size: 0.65rem;
    gap: 0.25rem;
  }

  .product-card-price {
    font-size: 0.95rem;
  }

  .product-card-footer .btn {
    padding: 0.3rem 0.625rem;
    font-size: 0.75rem;
  }

  /* Filter Section - horizontal scroll chips */
  .filter-card {
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }

  .filter-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.375rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-label {
    min-width: 36px;
    font-size: 0.7rem;
    flex-shrink: 0;
    padding-top: 0.3rem;
  }

  .filter-btn {
    padding: 0.3rem 0.625rem;
    font-size: 0.7rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .filter-divider {
    display: none; /* Remove dividers on mobile for cleaner scroll */
  }

  /* Info Grid */
  .info-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .info-card {
    padding: 0.75rem 0.5rem;
  }

  .info-icon {
    font-size: 1.5rem;
  }

  .info-title {
    font-size: 0.75rem;
  }

  .info-desc {
    font-size: 0.65rem;
  }

  /* Notice Box */
  .notice-list {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }

  /* Tab Bar */
  .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tab-bar::-webkit-scrollbar {
    display: none;
  }

  .tab-item {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .tab-content {
    padding: 0.875rem;
  }

  /* Topic Grid */
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
  }

  /* Section */
  .section {
    margin-bottom: 1.5rem;
  }

  .section-header {
    margin-bottom: 0.875rem;
  }

  .section-title {
    font-size: 1rem;
  }

  .section-more {
    font-size: 0.75rem;
  }

  /* Grade Section */
  .grade-section {
    margin-bottom: 1rem;
    padding: 0.875rem;
  }

  .grade-title {
    font-size: 0.9rem;
  }

  /* Back Bar */
  .back-bar {
    padding: 0.75rem 0;
  }

  .back-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.875rem;
  }
}

/* ===== Small Mobile: <= 480px ===== */
@media (max-width: 480px) {
  .container {
    padding: 0 0.625rem;
  }

  /* Product Grid - single column */
  .product-grid,
  .product-grid-3,
  .product-grid-6 {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  /* Header - logo only */
  .header-title {
    font-size: 0.9rem;
  }

  .header-logo {
    font-size: 1.1rem;
  }

  .header-nav {
    gap: 0;
  }

  .nav-link {
    padding: 0.3rem 0.375rem;
    font-size: 0.7rem;
  }

  /* Info Grid - 2 columns on small mobile */
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Topic Grid - single column */
  .topic-grid {
    grid-template-columns: 1fr;
  }

  /* Notice Box */
  .notice-box {
    padding: 0.875rem;
  }

  /* Detail Page padding for fixed purchase bar */
  .detail-page {
    padding-bottom: 80px;
  }
}

/* ===== Detail Page Bottom Padding (for fixed purchase bar) ===== */
.detail-page {
  padding-bottom: 100px;
}

@media (max-width: 768px) {
  .detail-page {
    padding-bottom: 90px;
  }
}

@media (max-width: 480px) {
  .detail-page {
    padding-bottom: 80px;
  }
}

/* ===== Safe Area for Notched Phones ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .purchase-bar {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}