/* ── Тёмная тема ── */
:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #1c2333;
  --border:   #30363d;
  --accent:   #e85d2f;
  --accent2:  #ff8c5a;
  --text:     #e6edf3;
  --muted:    #7d8590;
  --success:  #3fb950;
  --warn:     #d29922;
  --blue:     #58a6ff;
}

/* ── Светлая тема ── */
html.light {
  --bg:       #f5f5f0;
  --surface:  #ffffff;
  --surface2: #eeede8;
  --border:   #d8d6cf;
  --accent:   #e85d2f;
  --accent2:  #c44a20;
  --text:     #1a1a18;
  --muted:    #6b6b65;
  --success:  #2a8a3a;
  --warn:     #a07010;
  --blue:     #1a6abf;
}

/* ── Сброс ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Виджеты ── */

/* Контейнеры */
#tracker-widget,
#social-widget {
  display: none;
  position: fixed;
  left: 20px;
  bottom: 20px; 
  z-index: 9999;
  max-width: 300px;
  width: 300px;
  transform-origin: left bottom;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  transition: bottom 360ms cubic-bezier(.2,.9,.2,1);
}

#social-widget { z-index: 9998; }

/* Общий стиль «блокнота» */
.notebook {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px 16px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(2,6,23,0.6);
  width: 100%;
  transform: rotate(-2deg);
  position: relative;
  overflow: visible;
}

/* Скоба сверху */
.notebook::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -10px;
  width: 36px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), rgba(255,255,255,0.03));
  border: 1px solid rgba(0,0,0,0.12);
  transform: rotate(-12deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Линии бумаги */
.notebook .lines {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background-image: linear-gradient(to bottom, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 100% 22px;
  opacity: 0.06;
  border-radius: 6px;
}

/* Заголовки и текст */
.notebook h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  gap: 8px;
  align-items: center;
}
.notebook p {
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Кнопки */
.notebook .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.notebook button,
.notebook a.button {
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 14px;
  border-radius: 7px;
  transition: transform .12s ease, opacity .12s ease;
  line-height: 1;
}
.notebook a.button {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(232,93,47,0.25);
}
.notebook button.primary {
  background: var(--accent);
  color: #fff;
}
.notebook button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.notebook button:hover,
.notebook a.button:hover { transform: translateY(-1px); }

/* Кнопка соцсети — полная ширина */
#social-widget .notebook a.button {
  width: 100%;
  text-align: center;
  font-weight: 600;
  padding: 10px 14px;
  font-size: 14px;
  background: linear-gradient(135deg, #00D4FF 0%, #7B68EE 50%, #8B00FF 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(139,0,255,0.12);
  border-radius: 8px;
  display: inline-block;
  text-decoration: none;
  transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}

#social-widget .notebook a.button:hover {
  transform: translateY(-2px);
  opacity: 0.98;
  box-shadow: 0 12px 30px rgba(139,0,255,0.16);
}
#social-widget .notebook a.button:active {
  transform: translateY(0);
  opacity: 0.95;
}

/* Кнопка «свернуть» */
.notebook .minimize {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.notebook .minimize:hover {
  background: var(--surface2);
  color: var(--text);
}

/* ── Мини-иконка (появляется после сворачивания соцвиджета) ── */
#social-mini {
  display: none;
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--accent2), var(--accent));
  color: #fff;
  box-shadow: 0 6px 20px rgba(232,93,47,0.4);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: rotate(-2deg);
  font-size: 20px;
  border: none;
  transition: bottom 360ms cubic-bezier(.2,.9,.2,1), opacity 200ms, transform .15s;
}
#social-mini:hover { transform: rotate(-2deg) scale(1.1); }

/* ── Анимации ── */
@keyframes notebookIn {
  from { transform: translateY(20px) rotate(-5deg); opacity: 0; }
  to   { transform: translateY(0)    rotate(-2deg); opacity: 1; }
}
.show .notebook { animation: notebookIn 380ms cubic-bezier(.2,.9,.2,1); }

/* ── Адаптив: Bottom Sheet на мобильных ── */
@media (max-width: 640px) {
  #tracker-widget,
  #social-widget {
    left: 0 !important;
    right: 0;
    bottom: 0 !important;
    max-width: 100%;
    width: 100%;
    transition: none;
  }

  /* Трекер поверх соцвиджета на мобильных */
  #tracker-widget { z-index: 10001; }
  #social-widget  { z-index: 10000; }

  .notebook {
    border-radius: 18px 18px 0 0;
    transform: none !important;
    padding: 20px 20px 28px;
    /* Убираем анимацию вращения на мобильных */
  }

  /* Скоба выглядит странно на bottom-sheet */
  .notebook::before { display: none; }

  /* Полоска-хэндл вместо скобы */
  .notebook::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
  }

  @keyframes notebookIn {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Крупнее тап-таргеты */
  .notebook .minimize {
    width: 44px;
    height: 40px;
    font-size: 18px;
    right: 12px;
    top: 12px;
  }

  .notebook h3    { font-size: 16px; margin-bottom: 10px; }
  .notebook p     { font-size: 14px; line-height: 1.5; }
  .notebook button,
  .notebook a.button {
    font-size: 14px;
    padding: 11px 16px;
  }

  /* Мини-иконка в правом нижнем углу на мобильных */
  #social-mini {
    left: auto !important;
    right: 16px;
    bottom: 16px !important;
    transform: none;
    z-index: 10002;
  }
  #social-mini:hover { transform: scale(1.1); }
}

@media (max-width: 360px) {
  .notebook { padding: 16px 16px 24px; }
}