/* Бабка-гадалка — спокойная тема */

:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #2d3238;
    --muted: #6b7280;
    --line: #e3e6ea;
    --accent: #4a6fa5;
    --accent-hover: #3e5d8d;
    --accent-soft: #eef2f8;
    --green: #3e7d54;
    --green-soft: #e9f3ec;
    --danger: #a04b4b;
    --danger-soft: #f7ecec;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

/* ---------- Шапка ---------- */

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 2px;
    color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }

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

.nav-link {
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 6px;
}
.nav-link:hover { color: var(--text); text-decoration: none; background: var(--accent-soft); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.user-name {
    color: var(--muted);
    margin-left: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
    text-align: right;
}

.user-energy {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* ---------- Контейнер ---------- */

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 22px; }

/* ---------- Кнопки ---------- */

.btn {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--accent-soft); text-decoration: none; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--accent-soft); }

.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; text-align: center; margin-top: 8px; }

.inline-form { display: inline; margin: 0; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Сетка пророчеств ---------- */

.prophecy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}

/* Самое свежее пророчество — крупно поверх сетки */
.prophecy-grid .prophecy-card:first-child {
    grid-column: 1 / -1;
    padding: 24px 28px;
}
.prophecy-grid .prophecy-card:first-child .prophecy-title { font-size: 24px; }
.prophecy-grid .prophecy-card:first-child .outcome-name { font-size: 16px; }
.prophecy-grid .prophecy-card:first-child .outcome-pct { font-size: 18px; }
/* На мелких карточках описание не нужно — оно в карточке пророчества */
.prophecy-grid .prophecy-card:not(:first-child) .prophecy-desc { display: none; }

.prophecy-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
}

.prophecy-card-head { margin-bottom: 10px; }

.prophecy-card-titleline {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.prophecy-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}
.prophecy-title:hover { color: var(--accent); }

.prophecy-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.prophecy-desc { color: var(--text); margin: 8px 0; }

.prophecy-foot { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ---------- Исходы ---------- */

.outcomes { display: flex; flex-direction: column; gap: 10px; }

.outcome-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.outcome-name { font-size: 14px; }

.outcome-pct { color: var(--accent); font-weight: 600; white-space: nowrap; }

.bar {
    height: 8px;
    background: var(--accent-soft);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.fill-fulfilled { background: var(--green); }

.outcome-fulfilled { background: var(--green-soft); border-radius: 8px; padding: 8px; margin: -8px; }

.vote-hint { color: var(--muted); font-size: 13px; }

/* ---------- Диалог подтверждения веры ---------- */

.vote-dialog {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.vote-dialog::backdrop { background: rgba(45, 50, 56, 0.4); }
.vote-dialog-text { margin: 0 0 16px; }
.vote-dialog-actions { justify-content: flex-end; }

/* ---------- Карточка пророчества ---------- */

.prophecy-detail {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 760px;
}

.prophecy-title-lg { margin: 0 0 6px; font-size: 26px; }

.prophecy-head { margin-bottom: 18px; }

.notice {
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 12px 0;
}
.notice-fulfilled { background: var(--green-soft); }

.alert {
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 12px 0;
}

.voters { margin-top: 22px; }
.voters h2, .author-actions h2 { font-size: 16px; margin: 0 0 8px; }

.voter-list { margin: 0; padding-left: 20px; }
.voter-list li { padding: 2px 0; }
.voter-fulfilled { color: var(--green); font-weight: 600; }

.author-actions {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.row-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* ---------- Бейджи ---------- */

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.badge-open { background: var(--accent-soft); color: var(--accent); }
.badge-resolved { background: var(--green-soft); color: var(--green); }
.badge-cancelled { background: #ececef; color: var(--muted); }
.badge-fulfilled { background: var(--green); color: #fff; }
.badge-mine { background: var(--accent); color: #fff; }
.badge.on { background: var(--green-soft); color: var(--green); }
.badge.off { background: var(--danger-soft); color: var(--danger); }

/* ---------- Формы ---------- */

.form { display: flex; flex-direction: column; gap: 6px; }
.form label { color: var(--muted); font-size: 13px; margin-top: 8px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], textarea, select {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

.outcomes-fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.outcomes-fieldset legend { color: var(--muted); font-size: 13px; padding: 0 6px; }

/* ---------- Карточки-панели ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin: 0 0 10px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: 13px; font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.energy-value { font-variant-numeric: tabular-nums; white-space: nowrap; }

.auth-card {
    max-width: 420px;
    margin: 40px auto 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 28px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 16px; }
.auth-hint { color: var(--muted); margin-top: 14px; }

.empty, .muted { color: var(--muted); }

/* ---------- Адаптив ---------- */

@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; gap: 8px; }
    .nav { margin-left: 0; flex-wrap: wrap; justify-content: center; }
    .prophecy-grid { grid-template-columns: 1fr; }
    .user-name { align-items: center; text-align: center; }
}
