/* ═══════════════════════════════════════════════════════════════
   hayati.css — Feuille de styles HAYATI
   Architecture uniquement : layout, composants, états
   Le visuel (couleurs, typographie, images) sera appliqué en phase 2
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables de base (neutres — seront remplacées en phase 2) ── */
:root {
  --hay-bg:          #faf9f7;
  --hay-surface:     #ffffff;
  --hay-surface-2:   #f4f2ee;
  --hay-border:      #e8e4de;
  --hay-text:        #1a1816;
  --hay-text-2:      #6b6560;
  --hay-text-3:      #9e9892;
  --hay-accent:      #7c6a58;
  --hay-accent-soft: #c4b5a5;
  --hay-danger:      #c0392b;
  --hay-success:     #27ae60;
  --hay-warning:     #e67e22;

  /* Tabbar */
  --hay-tabbar-h:     60px;
  --hay-tabbar-bg:    var(--hay-surface);
  --hay-tab-active:   var(--hay-accent);
  --hay-tab-inactive: var(--hay-text-3);

  /* Sheets */
  --hay-sheet-radius: 20px;

  /* Cards */
  --hay-card-radius:  14px;

  /* Transition */
  --hay-ease:         cubic-bezier(.4, 0, .2, 1);
  --hay-dur:          180ms;
}

/* ══════════════════════════════════════════════════════════════ */
/* 1. RESET & BASE                                               */
/* ══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hay-text);
  background: var(--hay-bg);
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: var(--hay-accent); text-decoration: none; }

/* ══════════════════════════════════════════════════════════════ */
/* 2. LAYOUT PRINCIPAL                                           */
/* ══════════════════════════════════════════════════════════════ */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* Zone de contenu scrollable */
.hay-views {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--hay-tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* Chaque vue */
[id^="v-"] {
  display: none;
  min-height: 100%;
}
[id^="v-"].active {
  display: block;
}

/* ══════════════════════════════════════════════════════════════ */
/* 3. BARRE DE NAVIGATION (TABBAR)                              */
/* ══════════════════════════════════════════════════════════════ */

.hay-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--hay-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--hay-tabbar-bg);
  border-top: 1px solid var(--hay-border);
  z-index: 100;
}

.hay-tabbar-inner {
  display: flex;
  height: var(--hay-tabbar-h);
  align-items: stretch;
}

.hay-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--hay-tab-inactive);
  transition: color var(--hay-dur) var(--hay-ease);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.hay-tab.active {
  color: var(--hay-tab-active);
}

.hay-tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hay-tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Bouton Tout — central, légèrement surélevé */
.hay-tab-tout {
  position: relative;
}

.hay-tab-tout .hay-tab-icon {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: var(--hay-accent);
  color: #fff;
  margin-bottom: 2px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transition: transform var(--hay-dur) var(--hay-ease), background var(--hay-dur);
}

.hay-tab-tout.active .hay-tab-icon,
.hay-tab-tout:active .hay-tab-icon {
  transform: scale(.95);
}

/* ══════════════════════════════════════════════════════════════ */
/* 4. CARDS                                                      */
/* ══════════════════════════════════════════════════════════════ */

.hay-card {
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  overflow: hidden;
}

.hay-card-pad {
  padding: 16px;
}

.hay-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hay-text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.hay-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════ */
/* 5. BOUTONS                                                    */
/* ══════════════════════════════════════════════════════════════ */

.hay-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 50px;
  background: var(--hay-accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: opacity var(--hay-dur), transform var(--hay-dur);
  -webkit-tap-highlight-color: transparent;
}

.hay-btn-primary:active { opacity: .8; transform: scale(.97); }

.hay-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 50px;
  background: var(--hay-surface-2);
  color: var(--hay-text);
  font-weight: 500;
  font-size: 15px;
  border: 1px solid var(--hay-border);
  transition: opacity var(--hay-dur);
}

.hay-btn-secondary:active { opacity: .7; }

.hay-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 50px;
  background: transparent;
  color: var(--hay-danger);
  font-weight: 500;
  font-size: 15px;
  border: 1px solid var(--hay-danger);
  transition: opacity var(--hay-dur);
}

.hay-btn-danger:active { opacity: .7; }

.hay-btn-full {
  width: 100%;
  display: flex;
}

.hay-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hay-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background var(--hay-dur);
  -webkit-tap-highlight-color: transparent;
}

.hay-icon-btn:active { background: var(--hay-border); }

/* ══════════════════════════════════════════════════════════════ */
/* 6. SOUS-PAGES (header avec retour)                           */
/* ══════════════════════════════════════════════════════════════ */

.hay-subpage-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--hay-bg);
  border-bottom: 1px solid var(--hay-border);
}

.hay-subpage-header.hay-subpage-back {
  justify-content: flex-start;
  gap: 12px;
}

.hay-subpage-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.hay-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--hay-accent);
  flex-shrink: 0;
}

.hay-back-btn svg {
  width: 20px;
  height: 20px;
}

.hay-subpage-header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════ */
/* 7. BOTTOM SHEET                                              */
/* ══════════════════════════════════════════════════════════════ */

.hay-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--hay-dur) var(--hay-ease);
  pointer-events: none;
}

.hay-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.hay-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  background: var(--hay-surface);
  border-radius: var(--hay-sheet-radius) var(--hay-sheet-radius) 0 0;
  padding: 0 20px calc(env(safe-area-inset-bottom, 12px) + 12px);
  z-index: 201;
  transition: transform var(--hay-dur) var(--hay-ease);
  max-height: 90dvh;
  overflow-y: auto;
}

.hay-sheet.open {
  transform: translateX(-50%) translateY(0);
}

.hay-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--hay-border);
  margin: 12px auto 20px;
}

.hay-sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.hay-sheet-msg {
  font-size: 14px;
  color: var(--hay-text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.hay-sheet-confirm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.hay-sheet-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--hay-border);
  border-radius: 10px;
  background: var(--hay-surface-2);
  font-size: 15px;
  outline: none;
  transition: border-color var(--hay-dur);
}

.hay-sheet-input:focus {
  border-color: var(--hay-accent);
}

.hay-sheet-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hay-text-2);
  margin-bottom: 6px;
  display: block;
}

/* ══════════════════════════════════════════════════════════════ */
/* 8. PROGRESS BAR                                              */
/* ══════════════════════════════════════════════════════════════ */

.hay-progress-bar {
  height: 4px;
  background: var(--hay-surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.hay-progress-fill {
  height: 100%;
  background: var(--hay-accent);
  border-radius: 2px;
  transition: width .3s var(--hay-ease);
}

/* ══════════════════════════════════════════════════════════════ */
/* 9. GRILLE CATÉGORIES (TOUT)                                  */
/* ══════════════════════════════════════════════════════════════ */

.hay-tout {
  padding: 20px 16px;
}

.hay-tout-header {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 20px;
}

.hay-tout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.hay-tout-card {
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
  border-radius: var(--hay-card-radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--hay-dur), box-shadow var(--hay-dur);
  -webkit-tap-highlight-color: transparent;
  min-height: 120px;
}

.hay-tout-card:active {
  transform: scale(.97);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.hay-tout-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hay-tout-card-icon svg {
  width: 100%;
  height: 100%;
}

.hay-tout-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.hay-tout-card-desc {
  font-size: 12px;
  color: var(--hay-text-2);
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════ */
/* 10. ACCUEIL                                                   */
/* ══════════════════════════════════════════════════════════════ */

.hay-accueil {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hay-accueil-greeting {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.hay-accueil-date {
  font-size: 14px;
  color: var(--hay-text-2);
  margin-top: 2px;
}

.hay-accueil-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hay-accueil-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--hay-text-3);
}

.hay-accueil-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.hay-accueil-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--hay-surface);
  border-radius: 12px;
  border: 1px solid var(--hay-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--hay-dur);
}

.hay-accueil-shortcut:active { transform: scale(.93); }

.hay-accueil-shortcut-icon {
  font-size: 22px;
}

.hay-accueil-shortcut-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--hay-text-2);
  text-align: center;
}

/* Streak widget */
.hay-streak-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
}

.hay-streak-num {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--hay-accent);
}

.hay-streak-label {
  font-size: 14px;
  font-weight: 600;
}

.hay-streak-sub {
  font-size: 12px;
  color: var(--hay-text-2);
}

/* Book mini */
.hay-accueil-book {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hay-accueil-book-cover {
  width: 44px;
  height: 60px;
  border-radius: 4px;
  background: var(--hay-surface-2);
  object-fit: cover;
  flex-shrink: 0;
}

.hay-accueil-book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.hay-accueil-book-title {
  font-size: 14px;
  font-weight: 700;
}

.hay-accueil-book-author {
  font-size: 12px;
  color: var(--hay-text-2);
}

/* ══════════════════════════════════════════════════════════════ */
/* 11. PLANNER                                                   */
/* ══════════════════════════════════════════════════════════════ */

.hay-planner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.hay-planner-tabs {
  display: flex;
  border-bottom: 1px solid var(--hay-border);
  background: var(--hay-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.hay-planner-tab {
  flex: 1;
  padding: 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--hay-text-3);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: color var(--hay-dur), border-color var(--hay-dur);
  -webkit-tap-highlight-color: transparent;
}

.hay-planner-tab.active {
  color: var(--hay-accent);
  border-bottom-color: var(--hay-accent);
}

.hay-planner-view {
  display: none;
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.hay-planner-view.active {
  display: block;
}

/* Agenda */
.hay-agenda-week {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.hay-agenda-week::-webkit-scrollbar { display: none; }

.hay-agenda-day-col {
  flex: 0 0 auto;
  width: 120px;
}

.hay-agenda-day-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--hay-text-3);
  margin-bottom: 8px;
  text-align: center;
}

.hay-agenda-day-label.today-label {
  color: var(--hay-accent);
}

.hay-agenda-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Todo */
.hay-todo-add {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.hay-todo-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--hay-border);
  border-radius: 10px;
  background: var(--hay-surface);
  outline: none;
  font-size: 15px;
}

.hay-todo-input:focus { border-color: var(--hay-accent); }

.hay-todo-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--hay-text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 12px 0 8px;
}

.hay-task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--hay-surface);
  border-radius: 10px;
  border: 1px solid var(--hay-border);
  margin-bottom: 6px;
}

.hay-task-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--hay-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--hay-dur), border-color var(--hay-dur);
}

.hay-task-check.done {
  background: var(--hay-accent);
  border-color: var(--hay-accent);
}

.hay-task-check.done::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.hay-task-label {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.hay-task-label.done {
  text-decoration: line-through;
  color: var(--hay-text-3);
}

.hay-task-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

/* Focus timer */
.hay-focus-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.hay-focus-mode-btn {
  flex: 1;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  background: var(--hay-surface-2);
  color: var(--hay-text-2);
  text-align: center;
  border: 1px solid var(--hay-border);
  transition: all var(--hay-dur);
}

.hay-focus-mode-btn.active {
  background: var(--hay-accent);
  color: #fff;
  border-color: var(--hay-accent);
}

.hay-focus-ring-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.hay-focus-time-display {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -.04em;
  text-align: center;
  color: var(--hay-accent);
}

.hay-focus-controls {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Bullet journal */
.hay-bj-date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hay-bj-date-label {
  font-size: 16px;
  font-weight: 700;
}

.hay-bj-textarea {
  width: 100%;
  min-height: 200px;
  padding: 14px;
  border: 1px solid var(--hay-border);
  border-radius: 12px;
  background: var(--hay-surface);
  font-size: 15px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.hay-bj-textarea:focus { border-color: var(--hay-accent); }

/* ══════════════════════════════════════════════════════════════ */
/* 12. MADRASSA                                                  */
/* ══════════════════════════════════════════════════════════════ */

.hay-madrassa {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hay-madrassa-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.hay-madrassa-banner {
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  cursor: pointer;
}

.hay-madrassa-banner-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--hay-text-3);
  margin-bottom: 4px;
}

.hay-madrassa-banner-count {
  font-size: 24px;
  font-weight: 800;
  color: var(--hay-accent);
}

.hay-madrassa-banner-sub {
  font-size: 13px;
  color: var(--hay-text-2);
}

.hay-madrassa-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.hay-madrassa-card {
  padding: 16px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--hay-dur);
}

.hay-madrassa-card:active { transform: scale(.96); }

.hay-madrassa-card-icon { font-size: 24px; margin-bottom: 8px; }
.hay-madrassa-card-name { font-size: 14px; font-weight: 700; }
.hay-madrassa-card-desc { font-size: 12px; color: var(--hay-text-2); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════ */
/* 13. BOOK TRACK (BIBLIO)                                      */
/* ══════════════════════════════════════════════════════════════ */

.hay-bt { padding: 0; }

/* Profile banner */
.hay-bt-banner {
  position: relative;
  height: 160px;
  background: var(--hay-surface-2);
  overflow: hidden;
}

.hay-bt-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hay-bt-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}

.hay-bt-profile-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 16px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
  margin-bottom: 12px;
}

.hay-bt-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--hay-surface);
  border: 3px solid var(--hay-bg);
  object-fit: cover;
  flex-shrink: 0;
}

.hay-bt-profile-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--hay-text);
  margin-bottom: 2px;
}

/* Stats */
.hay-bt-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hay-border);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 16px 20px;
}

.hay-bt-stat {
  background: var(--hay-surface);
  padding: 12px 8px;
  text-align: center;
}

.hay-bt-stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--hay-accent);
}

.hay-bt-stat-label {
  font-size: 10px;
  color: var(--hay-text-2);
  font-weight: 500;
}

/* Rayons */
.hay-bt-section {
  padding: 0 16px 24px;
}

.hay-bt-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.hay-bt-section-title {
  font-size: 16px;
  font-weight: 700;
}

.hay-bt-section-more {
  font-size: 13px;
  color: var(--hay-accent);
  font-weight: 500;
}

/* Cartes livres */
.hay-bt-books-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.hay-bt-books-row::-webkit-scrollbar { display: none; }

.hay-bt-book-card {
  flex: 0 0 auto;
  width: 120px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hay-bt-book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 8px;
  background: var(--hay-surface-2);
  object-fit: cover;
  display: block;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.hay-bt-book-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hay-bt-book-author {
  font-size: 11px;
  color: var(--hay-text-2);
  margin-top: 2px;
}

/* Reading progress card */
.hay-bt-reading-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  margin-bottom: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hay-bt-reading-cover {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  background: var(--hay-surface-2);
  object-fit: cover;
  flex-shrink: 0;
}

.hay-bt-reading-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hay-bt-reading-title {
  font-size: 14px;
  font-weight: 700;
}

.hay-bt-reading-author {
  font-size: 12px;
  color: var(--hay-text-2);
  margin-top: 2px;
}

.hay-bt-reading-progress {
  margin-top: 8px;
}

.hay-bt-reading-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--hay-accent);
  margin-bottom: 4px;
}

/* Detail livre */
.hay-bt-detail { padding: 20px 16px; }

.hay-bt-detail-hero {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.hay-bt-detail-cover {
  width: 100px;
  aspect-ratio: 2/3;
  border-radius: 8px;
  background: var(--hay-surface-2);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.hay-bt-detail-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}

.hay-bt-detail-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.hay-bt-detail-author {
  font-size: 14px;
  color: var(--hay-text-2);
}

.hay-bt-detail-pages {
  font-size: 13px;
  color: var(--hay-text-3);
}

/* Stars */
.hay-stars {
  display: flex;
  gap: 4px;
}

.hay-star {
  font-size: 24px;
  cursor: pointer;
  opacity: .3;
  transition: opacity .15s, transform .15s;
}

.hay-star.active { opacity: 1; }
.hay-star:active { transform: scale(1.3); }

/* ISBN search */
.hay-bt-isbn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* Citation */
.hay-bt-citation {
  padding: 12px;
  background: var(--hay-surface-2);
  border-left: 3px solid var(--hay-accent);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  position: relative;
}

.hay-bt-citation-del {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--hay-text-3);
  font-size: 16px;
}

/* ══════════════════════════════════════════════════════════════ */
/* 14. SUDOKU                                                    */
/* ══════════════════════════════════════════════════════════════ */

.hay-sdk { padding: 16px; }

.hay-sdk-home-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-align: center;
  margin-bottom: 20px;
}

.hay-sdk-levels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.hay-sdk-level-btn {
  padding: 18px 10px;
  border-radius: var(--hay-card-radius);
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--hay-dur);
}

.hay-sdk-level-btn:active { transform: scale(.96); }

.hay-sdk-level-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hay-sdk-level-best {
  font-size: 11px;
  color: var(--hay-text-3);
}

/* Grille 9x9 */
.hay-sdk-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  background: var(--hay-text);
  border: 2px solid var(--hay-text);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 16px;
  max-width: 340px;
  touch-action: manipulation;
}

.hay-sdk-cell {
  aspect-ratio: 1;
  background: var(--hay-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--hay-dur);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Séparateurs de boîtes 3x3 */
.hay-sdk-cell:nth-child(3n):not(:nth-child(9n))  { border-right:  2px solid var(--hay-text); }
.hay-sdk-cell:nth-child(n+19):nth-child(-n+27)   { border-bottom: 2px solid var(--hay-text); }
.hay-sdk-cell:nth-child(n+46):nth-child(-n+54)   { border-bottom: 2px solid var(--hay-text); }

.hay-sdk-cell.selected  { background: rgba(124, 106, 88, .25); }
.hay-sdk-cell.related   { background: rgba(124, 106, 88, .08); }
.hay-sdk-cell.same-num  { background: rgba(124, 106, 88, .15); }
.hay-sdk-cell.fixed     { font-weight: 800; color: var(--hay-text); }
.hay-sdk-cell.user-val  { color: var(--hay-accent); }
.hay-sdk-cell.error     { color: var(--hay-danger); background: rgba(192, 57, 43, .1); }
.hay-sdk-cell.hint      { color: var(--hay-success); }

/* Numpad */
.hay-sdk-numpad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 340px;
  margin: 0 auto 16px;
}

.hay-sdk-num-btn {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--hay-dur), transform var(--hay-dur);
}

.hay-sdk-num-btn:active {
  background: var(--hay-accent);
  color: #fff;
  transform: scale(.93);
}

/* Infos jeu */
.hay-sdk-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 340px;
  margin: 0 auto 10px;
}

.hay-sdk-errors {
  display: flex;
  gap: 4px;
}

.hay-sdk-error-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--hay-border);
  transition: background .2s;
}

.hay-sdk-error-dot.used { background: var(--hay-danger); }

.hay-sdk-timer {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
}

/* Badges */
.hay-sdk-badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.hay-sdk-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 10px;
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
}

.hay-sdk-badge.unlocked { border-color: var(--hay-accent); }
.hay-sdk-badge.locked   { opacity: .45; }

.hay-sdk-badge-icon  { font-size: 24px; }
.hay-sdk-badge-label { font-size: 10px; font-weight: 600; text-align: center; color: var(--hay-text-2); }

/* ══════════════════════════════════════════════════════════════ */
/* 15. RELAXATION                                                */
/* ══════════════════════════════════════════════════════════════ */

.hay-rlx { padding: 20px 16px; display: flex; flex-direction: column; gap: 20px; }

.hay-rlx-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.hay-rlx-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--hay-text-2);
  margin-bottom: 10px;
}

/* Exercices */
.hay-rlx-exercises {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hay-rlx-exercise-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--hay-dur);
}

.hay-rlx-exercise-btn:active { transform: scale(.97); }

.hay-rlx-exercise-icon  { font-size: 24px; flex-shrink: 0; }
.hay-rlx-exercise-name  { font-size: 14px; font-weight: 600; }
.hay-rlx-exercise-desc  { font-size: 12px; color: var(--hay-text-2); margin-top: 2px; }

/* Sons */
.hay-rlx-sounds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.hay-rlx-sound-btn {
  padding: 14px 8px;
  border-radius: 12px;
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--hay-dur);
}

.hay-rlx-sound-btn.active {
  background: var(--hay-accent);
  border-color: var(--hay-accent);
  color: #fff;
}

.hay-rlx-sound-icon  { font-size: 24px; display: block; margin-bottom: 4px; }
.hay-rlx-sound-label { font-size: 11px; font-weight: 600; }

/* Volume */
.hay-rlx-volume {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hay-rlx-volume input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--hay-border);
  outline: none;
}

.hay-rlx-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hay-accent);
}

/* Bubble breathing */
.hay-rlx-breathe-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 32px;
}

.hay-rlx-bubble-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hay-rlx-bubble {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.4), var(--hay-accent));
  box-shadow: 0 0 40px rgba(124,106,88,.3);
  transition: transform 1s var(--hay-ease), opacity 1s;
}

.hay-rlx-bubble.inhale  { transform: scale(1.4); }
.hay-rlx-bubble.hold    { transform: scale(1.4); opacity: .9; }
.hay-rlx-bubble.exhale  { transform: scale(0.8); opacity: .7; }
.hay-rlx-bubble.empty   { transform: scale(0.8); opacity: .6; }

.hay-rlx-phase-label {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-align: center;
}

.hay-rlx-countdown {
  font-size: 48px;
  font-weight: 800;
  color: var(--hay-accent);
  letter-spacing: -.04em;
}

/* ══════════════════════════════════════════════════════════════ */
/* 16. SUDUR (cycle)                                             */
/* ══════════════════════════════════════════════════════════════ */

.hay-cym { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.hay-cym-header-actions { display: flex; gap: 8px; }

/* Prédiction */
.hay-cym-pred {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
}

.hay-cym-pred-active {
  border-color: var(--hay-accent);
  background: rgba(124, 106, 88, .06);
}

.hay-cym-pred-icon { font-size: 28px; flex-shrink: 0; }
.hay-cym-pred-label { font-size: 14px; font-weight: 700; }
.hay-cym-pred-note  { font-size: 11px; color: var(--hay-text-3); margin-top: 2px; }

/* Onboarding */
.hay-cym-onboard {
  text-align: center;
  padding: 24px 16px;
}

.hay-cym-ob-icon { font-size: 48px; margin-bottom: 12px; }
.hay-cym-ob-msg  { font-size: 14px; color: var(--hay-text-2); line-height: 1.6; }

/* Calendrier */
.hay-cym-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hay-cym-cal-title { font-size: 16px; font-weight: 700; }

.hay-cym-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.hay-cym-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--hay-text-3);
  padding: 4px 0;
}

.hay-cym-cell { text-align: center; }

.hay-cym-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--hay-dur);
}

.hay-cym-day.today    { font-weight: 800; }
.hay-cym-day.period   { background: #c0392b; color: #fff; border-radius: 50%; }
.hay-cym-day.pred     { background: rgba(192, 57, 43, .18); border-radius: 50%; }
.hay-cym-day.ovul     { background: rgba(100, 130, 80, .2); border-radius: 50%; }

.hay-cym-day-n { line-height: 1; }

.hay-cym-dot-sym {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--hay-accent);
  position: absolute;
  bottom: 2px;
}

/* Légende */
.hay-cym-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hay-cym-leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--hay-text-2);
}

.hay-cym-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.hay-cym-dot.red   { background: #c0392b; }
.hay-cym-dot.pink  { background: rgba(192, 57, 43, .35); border: 1px solid #c0392b; }
.hay-cym-dot.olive { background: rgba(100, 130, 80, .4); }

/* Actions */
.hay-cym-actions { display: flex; gap: 10px; }

/* Confidentialité */
.hay-cym-privacy {
  font-size: 11px;
  color: var(--hay-text-3);
  text-align: center;
  padding: 8px;
}

/* Log */
.hay-cym-log-section { display: flex; flex-direction: column; gap: 8px; }
.hay-cym-log-title   { font-size: 14px; font-weight: 700; }

.hay-cym-flow-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hay-cym-flow-btn {
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--hay-surface-2);
  border: 1px solid var(--hay-border);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--hay-dur);
}

.hay-cym-flow-btn.active {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

.hay-cym-sym-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.hay-cym-sym-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 10px;
  background: var(--hay-surface);
  border: 1px solid var(--hay-border);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--hay-dur);
}

.hay-cym-sym-btn span:first-child { font-size: 20px; }

.hay-cym-sym-btn.active {
  background: var(--hay-accent);
  border-color: var(--hay-accent);
  color: #fff;
}

.hay-cym-notes {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--hay-border);
  border-radius: 10px;
  background: var(--hay-surface);
  font-size: 14px;
  outline: none;
  resize: vertical;
}

.hay-cym-notes:focus { border-color: var(--hay-accent); }

/* Historique */
.hay-cym-hist-list { display: flex; flex-direction: column; gap: 8px; }

.hay-cym-hist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
}

.hay-cym-hist-date { font-size: 15px; font-weight: 700; }
.hay-cym-hist-dur  { font-size: 13px; color: var(--hay-text-2); }
.hay-cym-hist-logs { font-size: 12px; color: var(--hay-text-3); }

/* Préférences */
.hay-cym-pref-note {
  font-size: 13px;
  color: var(--hay-text-2);
  line-height: 1.6;
  padding: 12px;
  background: var(--hay-surface-2);
  border-radius: 10px;
  border: 1px solid var(--hay-border);
}

.hay-cym-pref-group { display: flex; flex-direction: column; gap: 6px; }
.hay-cym-pref-label { font-size: 14px; font-weight: 600; }
.hay-cym-pref-sep   { height: 1px; background: var(--hay-border); margin: 8px 0; }

.hay-cym-empty {
  text-align: center;
  color: var(--hay-text-3);
  font-size: 14px;
  padding: 40px 16px;
}

/* ══════════════════════════════════════════════════════════════ */
/* 17. MAKTABA                                                   */
/* ══════════════════════════════════════════════════════════════ */

.hay-mkt { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }

.hay-mkt-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.hay-mkt-cats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hay-mkt-cat-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--hay-surface);
  border-radius: var(--hay-card-radius);
  border: 1px solid var(--hay-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--hay-dur);
}

.hay-mkt-cat-btn:active { transform: scale(.97); }

.hay-mkt-cat-icon  { font-size: 28px; flex-shrink: 0; }
.hay-mkt-cat-name  { font-size: 15px; font-weight: 700; }
.hay-mkt-cat-desc  { font-size: 12px; color: var(--hay-text-2); margin-top: 2px; }
.hay-mkt-cat-arrow { margin-left: auto; color: var(--hay-text-3); font-size: 18px; }

/* ══════════════════════════════════════════════════════════════ */
/* 18. ÉTATS VIDES                                              */
/* ══════════════════════════════════════════════════════════════ */

.hay-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.hay-empty-icon  { font-size: 48px; }
.hay-empty-label { font-size: 15px; font-weight: 600; }
.hay-empty-sub   { font-size: 13px; color: var(--hay-text-2); line-height: 1.6; }

/* ══════════════════════════════════════════════════════════════ */
/* 19. LOADER                                                    */
/* ══════════════════════════════════════════════════════════════ */

.hay-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.hay-loader::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid var(--hay-border);
  border-top-color: var(--hay-accent);
  border-radius: 50%;
  animation: hay-spin .7s linear infinite;
}

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

/* ══════════════════════════════════════════════════════════════ */
/* 20. TOAST                                                     */
/* ══════════════════════════════════════════════════════════════ */

.hay-toast {
  position: fixed;
  bottom: calc(var(--hay-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--hay-text);
  color: var(--hay-bg);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}

.hay-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ══════════════════════════════════════════════════════════════ */
/* 21. UTILITAIRES                                              */
/* ══════════════════════════════════════════════════════════════ */

.hay-sep {
  height: 1px;
  background: var(--hay-border);
  margin: 4px 0;
}

.hay-gap-8  { gap: 8px; }
.hay-gap-12 { gap: 12px; }
.hay-gap-16 { gap: 16px; }
.hay-mt-8   { margin-top: 8px; }
.hay-mt-16  { margin-top: 16px; }
.hay-mb-8   { margin-bottom: 8px; }
.hay-mb-16  { margin-bottom: 16px; }
.hay-p-16   { padding: 16px; }
.hay-flex   { display: flex; }
.hay-col    { flex-direction: column; }
.hay-center { align-items: center; justify-content: center; }
.hay-between{ justify-content: space-between; }
.hay-wrap   { flex-wrap: wrap; }

.hay-text-accent   { color: var(--hay-accent); }
.hay-text-muted    { color: var(--hay-text-2); }
.hay-text-sm       { font-size: 13px; }
.hay-text-xs       { font-size: 11px; }
.hay-font-bold     { font-weight: 700; }
.hay-font-800      { font-weight: 800; }
.hay-text-center   { text-align: center; }

/* ══════════════════════════════════════════════════════════════ */
/* 22. ACCESSIBILITÉ & FOCUS                                    */
/* ══════════════════════════════════════════════════════════════ */

:focus-visible {
  outline: 2px solid var(--hay-accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) { outline: none; }

/* Préférence reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════ */
/* 23. RESPONSIVE DESKTOP (> 430px)                             */
/* ══════════════════════════════════════════════════════════════ */

@media (min-width: 430px) {
  #app {
    border-left:  1px solid var(--hay-border);
    border-right: 1px solid var(--hay-border);
  }
}
