/* ===== SOVMESTNYJ CHELLENDZH: kartochka v soobschenii + modalka sozdaniya ===== */
/* Palitra iz base.css: --accent, --text, --text-secondary, --border, --bubble-other, --bg. */

.aya-chal-host { display: block; margin: 2px 0; }
.aya-chal {
    box-sizing: border-box;
    max-width: min(360px, 86vw);
    background: var(--bubble-other, #fff);
    border: 1px solid var(--border, rgba(0,56,65,.1));
    border-radius: 16px;
    padding: 12px;
    color: var(--text, #1A1D21);
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.aya-chal.done { opacity: .82; }
.aya-chal-loading { color: var(--text-secondary, #65676B); font-size: 14px; text-align: center; padding: 16px 8px; }

/* --- zagolovok --- */
.aya-chal-head { margin-bottom: 10px; }
.aya-chal-title { font-weight: 700; font-size: 15px; line-height: 1.3; word-break: break-word; }
.aya-chal-target-str { font-size: 12px; color: var(--text-secondary, #65676B); margin-top: 2px; }

/* --- moya seriya + otmetka --- */
.aya-chal-me { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.aya-chal-streak { font-size: 14px; }
.aya-chal-streak b { font-size: 18px; color: var(--accent, #ff8c42); }
.aya-chal-streak span { color: var(--text-secondary, #65676B); font-size: 12px; }

.aya-chal-checkin { display: flex; align-items: center; gap: 6px; }
.aya-chal-val {
    width: 64px; box-sizing: border-box; flex: 0 0 auto;
    border: 1px solid var(--border, rgba(0,56,65,.14)); border-radius: 10px;
    padding: 8px 8px; font-size: 14px; font-family: inherit;
    background: var(--bg, #fff); color: var(--text, #1A1D21); text-align: center;
}
.aya-chal-val:focus { outline: none; border-color: var(--accent, #ff8c42); }
.aya-chal-unit { font-size: 13px; color: var(--text-secondary, #65676B); flex: 0 0 auto; }
.aya-chal-btn {
    appearance: none; border: none; border-radius: 10px; padding: 9px 12px;
    font-size: 13px; font-weight: 600; cursor: pointer; flex: 1 1 auto;
    background: var(--accent, #ff8c42); color: #fff; line-height: 1;
}
.aya-chal-btn:active { transform: scale(.97); }
.aya-chal-btn.done { background: #2e9e5b; }
.aya-chal-finished { font-size: 13px; color: var(--text-secondary, #65676B); }

/* --- grafik: CSS-stolbiki --- */
.aya-chal-graph { margin: 10px 0 12px; }
.aya-chal-graph-title { font-size: 11px; color: var(--text-secondary, #65676B); margin-bottom: 6px; }
.aya-chal-bars {
    position: relative; display: flex; align-items: flex-end; gap: 3px;
    height: 78px; padding-top: 2px;
}
.aya-chal-bar-col {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center;
    height: 100%; justify-content: flex-end; gap: 2px;
}
.aya-chal-bar {
    width: 100%; max-width: 16px; min-height: 0; border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent, #ff8c42), rgba(255,140,66,.55));
    transition: height .25s ease;
}
.aya-chal-bar-col.today .aya-chal-bar { background: linear-gradient(180deg, #2e9e5b, rgba(46,158,91,.6)); }
.aya-chal-bar-lbl { font-size: 8px; color: var(--text-secondary, #65676B); line-height: 1; }
.aya-chal-bar-col.today .aya-chal-bar-lbl { color: #2e9e5b; font-weight: 700; }
/* celevaya liniya (dnevnaya cel na vseh) */
.aya-chal-target {
    position: absolute; left: 0; right: 0; height: 0;
    border-top: 1px dashed var(--accent, #ff8c42); opacity: .55; pointer-events: none;
}

/* --- obschaya cel --- */
.aya-chal-goal { margin-bottom: 12px; }
.aya-chal-goal-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-secondary, #65676B); }
.aya-chal-goal-bar { height: 8px; border-radius: 6px; background: var(--border, rgba(0,0,0,.08)); overflow: hidden; }
.aya-chal-goal-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent, #ff8c42), #2e9e5b); transition: width .3s ease; }

/* --- uchastniki --- */
.aya-chal-parts { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.aya-chal-part { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; border-radius: 8px; font-size: 13px; }
.aya-chal-part.active { background: rgba(46,158,91,.1); }
.aya-chal-part-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aya-chal-part-streak { flex: 0 0 auto; font-size: 12px; color: var(--text-secondary, #65676B); margin-left: 8px; }

/* --- motivacionnaya stroka --- */
.aya-chal-motiv {
    margin-top: 4px; padding: 8px 10px; border-radius: 10px;
    background: rgba(255,140,66,.12); color: var(--text, #1A1D21);
    font-size: 13px; font-weight: 600; text-align: center; line-height: 1.35;
}

/* --- zavershit --- */
.aya-chal-del {
    appearance: none; border: none; background: transparent; cursor: pointer;
    margin-top: 8px; width: 100%; padding: 6px; font-size: 12px;
    color: var(--text-secondary, #65676B); text-decoration: underline; opacity: .8;
}
.aya-chal-del:active { opacity: 1; }

/* ===== modalka sozdaniya (v duhe aya-list-modal) ===== */
.aya-chal-modal-ov { position: fixed; inset: 0; z-index: 4000; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.aya-chal-modal {
    width: 100%; max-width: 480px; box-sizing: border-box;
    background: var(--bg, #fff); color: var(--text, #1A1D21);
    border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(0,0,0,.2);
    max-height: 88vh; overflow-y: auto;
}
.aya-chal-modal-title { font-weight: 700; font-size: 16px; text-align: center; margin-bottom: 14px; }
.aya-chal-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.aya-chal-field > span { font-size: 12px; color: var(--text-secondary, #65676B); }
.aya-chal-in {
    box-sizing: border-box; width: 100%; border: 1px solid var(--border, rgba(0,56,65,.14));
    border-radius: 12px; padding: 11px 12px; font-size: 15px; font-family: inherit;
    background: var(--bubble-other, #fff); color: var(--text, #1A1D21);
}
.aya-chal-in:focus { outline: none; border-color: var(--accent, #ff8c42); }
.aya-chal-row { display: flex; gap: 10px; }
.aya-chal-f-target { flex: 0 0 40%; }
.aya-chal-f-unit { flex: 1 1 auto; }
.aya-chal-modal-btns { display: flex; gap: 10px; margin-top: 6px; }
.aya-chal-cancel, .aya-chal-create {
    flex: 1 1 0; appearance: none; border: none; border-radius: 12px; padding: 13px;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.aya-chal-cancel { background: var(--border, rgba(0,0,0,.08)); color: var(--text, #1A1D21); }
.aya-chal-create { background: var(--accent, #ff8c42); color: #fff; }
.aya-chal-create:active, .aya-chal-cancel:active { transform: scale(.98); }
.aya-chal-create:disabled { opacity: .6; }

/* --- tyomnaya tema --- */
body.dark-theme .aya-chal-modal { background: #161D27; }
body.dark-theme .aya-chal-in { background: #222b35; }
body.dark-theme .aya-chal-val { background: #1c2530; }
body.dark-theme .aya-chal-cancel { background: #222b35; color: #e7edf3; }
body.dark-theme .aya-chal-goal-bar { background: rgba(255,255,255,.1); }
body.dark-theme .aya-chal-motiv { background: rgba(255,140,66,.16); }
