@import url('https://fonts.googleapis.com/css2?family=Hachi+Maru+Pop&family=Nunito:wght@400;600;700;800&family=Playfair+Display:wght@400;600;700&display=swap');

:root {
  --bg: #fffefa;
  --bg2: #f2f2f2;
  --card: #fffefa;
  --card2: #ededed;
  --ink: #31302a;
  --text: #31302a;
  --muted: rgba(49, 48, 42, .62);
  --muted2: rgba(49, 48, 42, .42);
  --border: rgba(49, 48, 42, .18);
  --border-hover: rgba(49, 48, 42, .5);
  --accent: #31302a;
  --accent2: #d9d9d9;
  --success: #00a82d;
  --danger: #d34242;
  --warning: #ffca00;
  --radius: 9px;
  --radius-sm: 7px;
  --shadow: 0 5px 18px rgba(49, 48, 42, .12);
  --shadow-lg: 0 14px 34px rgba(49, 48, 42, .18);
  --font: 'Nunito', system-ui, sans-serif;
  --display: 'Playfair Display', Georgia, serif;
  --hand: 'Hachi Maru Pop', cursive;
}

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

html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
}

a { color: inherit; }

.bg-ambient,
.bg-orb,
.bg-grid { display: none !important; }

.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 254, 250, .94);
  border-bottom: 2px solid var(--ink);
}

.header-content {
  max-width: 1320px;
  height: 76px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}

.logo-word {
  font-family: var(--hand);
  font-size: 32px;
  line-height: 1;
  letter-spacing: .02em;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link,
.btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(237, 237, 237, .52);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color .18s, transform .18s, background .18s;
}

.nav-link:hover,
.nav-link.active,
.btn:hover {
  border-color: var(--ink);
  background: #fffefa;
  transform: translateY(-1px);
}

.btn-primary { background: var(--ink); color: #fffefa; border-color: var(--ink); }
.btn-primary:hover { background: #1f1e1a; }
.btn-secondary { background: var(--card2); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); color: #fffefa; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fffefa; border-color: var(--success); }
.btn-sm { min-height: 32px; padding: 6px 13px; font-size: 13px; }
.btn-lg { min-height: 46px; padding: 11px 24px; }

.user-menu { position: relative; }
.user-avatar-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--card2);
  cursor: pointer;
}
.user-avatar-btn:focus-visible {
  outline: 3px solid rgba(49, 48, 42, .22);
  outline-offset: 3px;
}
.user-avatar-btn img,
.avatar { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-xs { width: 24px; height: 24px; }
.avatar-sm { width: 34px; height: 34px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 80px; height: 80px; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  overflow: hidden;
}
.user-menu:not(.open):hover .user-dropdown { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.user-menu.open .user-dropdown { opacity: 1; transform: translateY(0); pointer-events: auto; }
.user-dropdown a {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--ink);
}
.user-dropdown a:hover { background: var(--card2); }
.user-dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
.danger-link { color: var(--danger) !important; }

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(49, 48, 42, .08); }
textarea { resize: vertical; min-height: 105px; }
label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.form-group { margin-bottom: 16px; }

.container { max-width: 1120px; margin: 0 auto; padding: 34px 24px; }
.container-wide { max-width: 1320px; margin: 0 auto; padding: 34px 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 34px 24px; }

.card,
.settings-section,
.settings-nav,
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.badge-success { color: var(--success); border-color: rgba(0, 168, 45, .35); }
.badge-muted { color: var(--muted); }


.drawn-star {
  display: inline-block;
  width: 60px;
  height: 60px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
  background-image: url('/project_helper/static/images/star-empty.gif');
  cursor: pointer;
  transition: transform 0.2s ease;
}
/* В карточках звезда только декоративная */
.project-card .drawn-star {
  cursor: default;
  pointer-events: none;
}

.project-card .drawn-star:hover {
  transform: none;
}

/* Звезды в комментариях */
.comment-star-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.comment-star-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.comment-star-btn .drawn-star {
  width: 28px;
  height: 28px;
}

.comment-stars-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* Маленькие звезды для комментариев */
.star-comment {
  width: 30px;
  height: 30px;
}

.star-comment.empty {
  background-image: url('/project_helper/static/images/star-empty.gif');
}

.star-comment.active {
  background-image: url('/project_helper/static/images/star-active.gif');
}
/* Эффект при наведении */
.drawn-star:hover {
  transform: scale(1.1);
  background-image: url('/project_helper/static/images/star-hover.gif');
}

/* Активная звезда (добавьте класс для JS) */
.drawn-star.active {
  background-image: url('/project_helper/static/images/star-active.gif');
}
.drawn-check {
  display: inline-block;
  width: 48px;
  height: 52px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
  background-image: url("data:image/svg+xml,%3Csvg width='64' height='72' viewBox='0 0 64 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 36l11 13 23-30' fill='none' stroke='%2331302a' stroke-width='12' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M18 37l10 11 21-27' fill='none' stroke='%2300c606' stroke-width='7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transform: rotate(-4deg);
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tab-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(217, 217, 217, .32);
  color: var(--muted);
  padding: 9px 15px;
  font-weight: 800;
  cursor: pointer;
}
.tab-btn.active { color: var(--ink); border-color: var(--ink); background: #fffefa; }

.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty-state h3 { color: var(--ink); }
.empty-state-icon { display: none; }

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 1000;
}
.toast {
  background: var(--bg);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
}

footer {
  text-align: center;
  border-top: 1px solid var(--border);
  padding: 24px;
  color: var(--ink);
  font-family: var(--display);
}
footer a { text-decoration: none; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #FFFEFA;
    --bg2: #FFFEFA;
    --card: #F3F3F3;
    --card2: #F3F3F3;
    --ink: #000000;
    --text: #000000;
    --muted: #8F8E8C;
    --muted2: rgba(245, 242, 233, .45);
    --border: rgba(245, 242, 233, .18);
    --border-hover: rgba(245, 242, 233, .52);
  }
  input, textarea, select { background: #F3F3F3; color: var(--ink); }
}

@media (max-width: 760px) {
  .header-content {
    height: 64px;
    min-height: 64px;
    padding: 0 10px;
    flex-wrap: nowrap;
    gap: 9px;
  }
  .logo { flex: 0 0 auto; }
  .logo-word { font-size: 24px; white-space: nowrap; }
  .header-nav {
    width: auto;
    min-width: 0;
    margin-left: auto;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .nav-link, .btn {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .user-menu { flex: 0 0 auto; }
  .user-avatar-btn { width: 38px; height: 38px; }
  .container, .container-wide, .container-narrow { padding: 22px 14px; }
}

@media (max-width: 380px) {
  .header-content { padding: 0 8px; gap: 6px; }
  .logo-word { font-size: 21px; }
  .header-nav { gap: 4px; }
  .nav-link, .btn {
    min-height: 33px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .user-avatar-btn { width: 36px; height: 36px; }
}
