/* ==========================================================================
   Kron English · Unified Product Shell & Navigation (Studio · Learn · Word)
   ========================================================================== */

:root {
  --ke-studio-color: #8b5cf6;
  --ke-studio-accent: #7c3aed;
  --ke-studio-bg: #f5f3ff;
  --ke-studio-border: rgba(124, 58, 237, 0.2);

  --ke-learn-color: #0071e3;
  --ke-learn-accent: #0284c7;
  --ke-learn-bg: #eff6ff;
  --ke-learn-border: rgba(0, 113, 227, 0.2);

  --ke-word-color: #059669;
  --ke-word-accent: #10b981;
  --ke-word-bg: #ecfdf5;
  --ke-word-border: rgba(16, 185, 129, 0.2);

  --ke-bg-subtle: #f5f5f7;
  --ke-card-border: rgba(0, 0, 0, 0.08);
  --ke-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --ke-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   1. Unified Top Header (Shared by Studio, Learn, Word)
   ========================================================================== */
.ke-unified-header {
  position: sticky;
  top: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ke-unified-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ke-back-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
  transition: all 160ms ease;
}

.ke-back-home-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateX(-1px);
}

/* Book & Unit Picker Dropdown */
.ke-book-unit-picker {
  position: relative;
}

.ke-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 180ms ease;
}

.ke-picker-trigger:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ke-picker-book {
  color: #6e6e73;
}

.ke-picker-sep {
  color: #c7c7cc;
}

.ke-picker-unit {
  color: #1d1d1f;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ke-picker-arrow {
  color: #86868b;
  transition: transform 200ms ease;
}

.ke-picker-arrow.is-open {
  transform: rotate(180deg);
}

.ke-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-height: 480px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
  padding: 16px;
  z-index: 200;
  animation: keFadeIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes keFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ke-dropdown-section {
  margin-bottom: 16px;
}

.ke-dropdown-section:last-child {
  margin-bottom: 0;
}

.ke-dropdown-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #86868b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ke-book-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ke-book-chip {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 160ms ease;
}

.ke-book-chip:hover {
  background: #e5e5ea;
}

.ke-book-chip.is-active {
  background: #1d1d1f;
  color: #ffffff;
  border-color: #1d1d1f;
}

.ke-unit-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.ke-unit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.ke-unit-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.ke-unit-item.is-active {
  background: var(--ke-learn-bg);
  color: var(--ke-learn-color);
  font-weight: 700;
}

.ke-unit-item-name {
  font-size: 13px;
  font-weight: 600;
  margin-right: 8px;
}

.ke-unit-item-title {
  font-size: 12px;
  color: #86868b;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ke-unit-current-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ke-learn-color);
  margin-left: 8px;
}

/* Center: 3 Equal Products Switcher */
.ke-unified-product-nav {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}

.ke-product-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  color: #6e6e73;
  transition: all 180ms ease;
}

.ke-product-nav-item:hover {
  color: #1d1d1f;
}

.ke-product-nav-item.is-active {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ke-product-nav-item--studio.is-active {
  color: var(--ke-studio-color);
}

.ke-product-nav-item--learn.is-active {
  color: var(--ke-learn-color);
}

.ke-product-nav-item--word.is-active {
  color: var(--ke-word-color);
}

.ke-unified-header-right {
  display: flex;
  align-items: center;
}

/* Submodule Navigation Bar */
.ke-submodule-bar-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ke-submodule-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 999px;
  overflow-x: auto;
  max-width: 100%;
}

.ke-submodule-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #6e6e73;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 160ms ease;
}

.ke-submodule-btn:hover:not(:disabled) {
  color: #1d1d1f;
}

.ke-submodule-btn.is-active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.ke-submodule-btn--studio.is-active {
  color: var(--ke-studio-color);
}

.ke-submodule-btn--learn.is-active {
  color: var(--ke-learn-color);
}

.ke-submodule-btn--word.is-active {
  color: var(--ke-word-color);
}

.ke-submodule-btn.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.ke-lock-badge {
  font-size: 11px;
}

/* ==========================================================================
   2. Simplified 3-Product Home Page
   ========================================================================== */
.ke-home-shell {
  min-height: 100vh;
  background: #f5f5f7;
  color: #1d1d1f;
  display: flex;
  flex-direction: column;
}

.ke-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

.ke-home-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ke-home-main {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ke-home-context-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 24px 28px;
  border: 1px solid var(--ke-card-border);
  box-shadow: var(--ke-shadow-sm);
}

.ke-home-context-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.ke-home-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.ke-home-unit-name {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.ke-home-unit-title {
  font-weight: 600;
  color: #6e6e73;
}

.ke-home-unit-desc {
  font-size: 14px;
  color: #6e6e73;
  margin: 0;
  line-height: 1.5;
}

.ke-home-unit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ke-home-select-label {
  font-size: 13px;
  font-weight: 600;
  color: #6e6e73;
}

.ke-home-select {
  min-height: 38px;
  padding: 0 14px;
  background: #f5f5f7;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  outline: none;
}

.ke-home-book-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
}

.ke-home-book-label {
  font-size: 13px;
  font-weight: 700;
  color: #86868b;
}

.ke-home-book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ke-home-book-tab {
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 160ms ease;
}

.ke-home-book-tab:hover {
  background: #e5e5ea;
}

.ke-home-book-tab.is-active {
  background: #1d1d1f;
  color: #ffffff;
  border-color: #1d1d1f;
}

/* 3 Equal Products Grid */
.ke-home-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.ke-home-product-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 28px;
  border: 1px solid var(--ke-card-border);
  box-shadow: var(--ke-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

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

.ke-home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ke-home-card-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.ke-home-card-badge--studio {
  background: var(--ke-studio-bg);
  color: var(--ke-studio-color);
  border: 1px solid var(--ke-studio-border);
}

.ke-home-card-badge--learn {
  background: var(--ke-learn-bg);
  color: var(--ke-learn-color);
  border: 1px solid var(--ke-learn-border);
}

.ke-home-card-badge--word {
  background: var(--ke-word-bg);
  color: var(--ke-word-color);
  border: 1px solid var(--ke-word-border);
}

.ke-home-card-icon {
  font-size: 28px;
}

.ke-home-card-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.ke-home-card-flow {
  font-size: 13px;
  font-weight: 700;
  color: #86868b;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.ke-home-card-desc {
  font-size: 14px;
  color: #6e6e73;
  line-height: 1.55;
  margin: 0 0 24px;
  flex: 1;
}

.ke-home-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: all 160ms ease;
}

.ke-home-card-action--studio {
  background: var(--ke-studio-bg);
  color: var(--ke-studio-color);
  border: 1px solid var(--ke-studio-border);
}

.ke-home-card-action--studio:hover {
  background: var(--ke-studio-color);
  color: #ffffff;
}

.ke-home-card-action--learn {
  background: var(--ke-learn-bg);
  color: var(--ke-learn-color);
  border: 1px solid var(--ke-learn-border);
}

.ke-home-card-action--learn:hover {
  background: var(--ke-learn-color);
  color: #ffffff;
}

.ke-home-card-action--word {
  background: var(--ke-word-bg);
  color: var(--ke-word-color);
  border: 1px solid var(--ke-word-border);
}

.ke-home-card-action--word:hover {
  background: var(--ke-word-color);
  color: #ffffff;
}

/* ==========================================================================
   3. Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
  .ke-unified-header {
    flex-wrap: wrap;
    padding: 8px 12px;
    min-height: auto;
  }

  .ke-picker-unit {
    max-width: 140px;
  }

  .ke-unified-product-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .ke-product-nav-item {
    flex: 1;
    justify-content: center;
    padding: 0 10px;
  }

  .ke-home-products-grid {
    grid-template-columns: 1fr;
  }

  .ke-home-context-top {
    flex-direction: column;
    align-items: stretch;
  }
}
