@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --card-radius: 18px;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--page-bg), var(--page-bg-alt));
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.app-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 24px 18px 90px;
  box-sizing: border-box;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--card-radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-soft));
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 24px;
}

.brand-text h1 {
  margin: 0;
  font-size: 22px;
  color: var(--text-strong);
}

.brand-text .eyebrow {
  margin: 0;
  font-size: 13px;
  color: var(--muted-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.ghost-button:hover {
  border-color: var(--primary);
  background: var(--highlight);
  transform: translateY(-1px);
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 16px;
}

.hero-card {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  padding: 26px 24px;
  border-radius: var(--card-radius);
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: var(--primary-text);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.hero-text h2 {
  margin: 6px 0 10px;
  font-size: clamp(22px, 4vw, 30px);
}

.hero-text .muted {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
}

.hero-chip {
  align-self: center;
  justify-self: end;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--primary-text);
  padding: 14px 16px;
  border-radius: 14px;
  display: grid;
  gap: 6px;
  min-width: 160px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.chip-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.chip-value {
  font-size: 20px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px 16px;
  background: var(--surface);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 6px;
}

.stat-card.goal-card {
  background: linear-gradient(135deg, var(--highlight), var(--highlight-strong));
  border-color: rgba(0, 0, 0, 0.05);
}

.stat-label {
  margin: 0;
  font-size: 13px;
  color: var(--muted-text);
  letter-spacing: 0.02em;
}

.stat-value {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
}

.goal-card .stat-value {
  color: var(--primary-dark);
}

.list-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.list-header h3 {
  margin: 4px 0 0;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  color: var(--muted-text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.helper-text {
  margin: 0;
  color: var(--muted-text);
  font-size: 13px;
}

.list-body {
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px;
}

.submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.submenu li {
  margin: 0;
}

.section-title {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-weight: 600;
}

.bb {
  margin: 0;
  padding: 14px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg), var(--surface));
  border: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

.bb::after {
  content: '\f054';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--muted-text);
}

.bb:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.bb.current-mesechet {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.perek-header-title {
  font-size: 18px;
  font-weight: 700;
}

.perek-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

.side-nav-container {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  z-index: 12;
}

.side-nav {
  width: min(480px, 100%);
  background: var(--bg);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  max-height: 70vh;
  overflow-y: auto;
  padding: 16px;
}

.bottom-nav {
  background-color: var(--surface);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.bottom-nav a {
  text-align: center;
  text-decoration: none;
  color: var(--nav-color);
  font-weight: 600;
  padding: 14px 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--primary);
  background: var(--highlight);
}

#result {
  margin: 0;
}

.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;
}

@media (max-width: 900px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-chip {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .top-bar {
    padding: 12px;
  }

  .brand-text h1 {
    font-size: 18px;
  }

  .hero-card {
    padding: 22px 18px;
  }

  .bottom-nav {
    height: 58px;
  }

  .bottom-nav a {
    font-size: 14px;
  }
}
