/* Christian Cosmos — candlelit sanctuary UI (warm navy + candle gold) */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --ink: #f3ecdc; --dim: #b0a58a; --gold: #e8a54f; --candle: #c8904a;
    --panel: rgba(20, 15, 9, .88); --line: rgba(216, 190, 140, .18);
    --accent: #e0aa54; --deep: #160a06;
}
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink); background: var(--deep);
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent; -webkit-app-region: no-drag;
}
body.transparent { background: transparent; }
#app { position: relative; width: 100vw; height: 100vh; }
#bgimg { position: absolute; inset: -4%; background-size: cover; background-position: center; display: none; transition: filter .3s; }
#bg { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* ---------- top bar ---------- */
#topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: linear-gradient(180deg, rgba(10,7,3,.75), rgba(10,7,3,0));
    pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-orb {
    width: 15px; height: 15px; border-radius: 50%;
    background: radial-gradient(circle at 60% 40%, transparent 38%, #f2d98a 42%, #f2d98a 55%, #7a5f14);
    box-shadow: 0 0 14px 3px rgba(240, 215, 130, .4);
}
.brand-t { font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.brand-t b { color: var(--ink); font-weight: 600; }
.lit-chip, .verse-chip {
    font-size: 11.5px; font-weight: 600; letter-spacing: .04em; padding: 7px 13px;
    border-radius: 20px; border: 1px solid var(--line); white-space: nowrap;
    background: rgba(18, 14, 8, .55); backdrop-filter: blur(8px);
}
.lit-chip { color: var(--gold); }
.verse-chip { color: var(--accent); max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.topbtns { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
    background: rgba(20, 15, 8, .6); color: #e8dcc8; display: flex; align-items: center;
    justify-content: center; cursor: pointer; backdrop-filter: blur(8px);
    transition: transform .15s, background .2s, box-shadow .2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#btnMoments svg path { fill: currentColor; stroke: none; }
.icon-btn:hover { background: rgba(70, 50, 24, .8); transform: scale(1.07); box-shadow: 0 0 16px rgba(224,170,84,.3); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 17px; }

/* ---------- rail ---------- */
#rail {
    position: fixed; left: 10px; top: 50%; transform: translateY(-50%); z-index: 25;
    display: flex; flex-direction: column; gap: 5px; max-height: 86vh; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
    padding: 8px 6px; backdrop-filter: blur(10px); box-shadow: 0 8px 30px rgba(0,0,0,.4);
    scrollbar-width: none;
}
#rail::-webkit-scrollbar { display: none; }
#rail button {
    width: 56px; padding: 7px 2px 6px; border: 0; border-radius: 12px; cursor: pointer;
    background: transparent; color: var(--dim);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    transition: background .2s, color .2s;
}
#rail .g { font-size: 16px; line-height: 1; }
#rail i { font-style: normal; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
#rail button:hover { background: rgba(46, 168, 122, .2); color: var(--ink); }
#rail button.on { background: linear-gradient(160deg, rgba(210,160,90,.4), rgba(140,95,40,.35)); color: #fff; box-shadow: inset 0 0 0 1px rgba(235,200,140,.35), 0 0 14px rgba(220,170,90,.25); }

/* ---------- DOM panel (content views) ---------- */
#panel {
    position: fixed; top: 62px; right: 10px; bottom: 96px; left: 84px; z-index: 20;
    overflow-y: auto; display: none; padding: 6px 4px 20px;
    scrollbar-width: thin;
}
#panel.open { display: block; }
#panel::-webkit-scrollbar { width: 8px; }
#panel::-webkit-scrollbar-thumb { background: rgba(170,140,100,.3); border-radius: 4px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pcard {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    padding: 14px 16px; backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0,0,0,.35);
    transition: transform .15s, border-color .2s;
}
.pcard:hover { transform: translateY(-2px); border-color: rgba(220,190,150,.4); }
.pcard h3 { font-size: 14px; font-weight: 600; color: var(--gold); margin-bottom: 5px; }
.pcard .ar { font-size: 19px; font-family: 'Segoe UI', Georgia, serif; direction: rtl; text-align: right; color: #f0e8d8; margin: 6px 0; line-height: 1.7; }
.pcard .en { font-size: 12px; color: var(--dim); line-height: 1.45; }
.pcard .ref { font-size: 10px; color: rgba(190,170,135,.55); margin-top: 6px; letter-spacing: .05em; }
.pcard .big { font-size: 22px; font-weight: 700; color: var(--ink); }
.pcard .sub { font-size: 11px; color: var(--dim); }
.pcard.click { cursor: pointer; }
.catrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 4px 14px; }
.catrow button {
    border: 1px solid var(--line); background: rgba(24,18,10,.6); color: var(--dim);
    font: 600 11px 'Segoe UI'; letter-spacing: .04em; padding: 7px 12px; border-radius: 16px; cursor: pointer;
}
.catrow button.on { background: linear-gradient(135deg, #c8904a, #8a5a26); color: #fff; border-color: transparent; }
.meter { height: 8px; background: rgba(255,255,255,.08); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, #c8904a, #e8a54f); border-radius: 5px; transition: width .4s; }
.tasbih-ring { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; }
.tcount { font-size: 52px; font-weight: 800; color: var(--gold); text-shadow: 0 0 24px rgba(232,208,136,.35); font-variant-numeric: tabular-nums; }
.tapbtn {
    width: 150px; height: 150px; border-radius: 50%; border: 2px solid rgba(232,208,136,.5);
    background: radial-gradient(circle at 35% 30%, #4a2e14, #1c1108);
    color: var(--gold); font-size: 15px; letter-spacing: .1em; cursor: pointer;
    box-shadow: 0 0 34px rgba(220,140,70,.35), inset 0 0 30px rgba(0,0,0,.5);
    transition: transform .07s; user-select: none;
}
.tapbtn:active { transform: scale(.94); }
.tapbtn small { display: block; font-size: 10px; color: var(--dim); letter-spacing: .2em; margin-top: 4px; }
.dhrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dhrow button {
    border: 1px solid var(--line); border-radius: 14px; padding: 8px 11px; cursor: pointer;
    background: rgba(24,18,10,.6); color: var(--dim); font-size: 12px;
}
.dhrow button.on { background: rgba(220,140,70,.35); color: #fff; border-color: var(--accent); }
.namecard { text-align: center; padding: 16px 10px; }
.namecard .num { font-size: 9px; color: rgba(190,170,135,.5); letter-spacing: .15em; }
.namecard .nar { font-size: 26px; font-family: Georgia, serif; color: var(--gold); margin: 6px 0 3px; }
.namecard .ntr { font-size: 13px; font-weight: 700; color: var(--ink); }
.namecard .nmn { font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.namecard .fav { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 15px; cursor: pointer; color: rgba(232,208,136,.4); }
.namecard .fav.on { color: var(--gold); }
.namecard { position: relative; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calday {
    background: rgba(20, 15, 9, .7); border: 1px solid var(--line); border-radius: 10px;
    padding: 7px 6px; min-height: 56px; text-align: center; cursor: pointer; position: relative;
}
.calday:hover { background: rgba(70, 50, 24, .5); }
.calday .hd { font-size: 15px; font-weight: 700; color: var(--ink); }
.calday .gd { font-size: 9px; color: var(--dim); }
.calday .ev { position: absolute; bottom: 4px; left: 0; right: 0; font-size: 11px; }
.calday.today { border-color: var(--gold); background: rgba(70, 50, 18, .5); box-shadow: 0 0 12px rgba(232,208,136,.2); }
.calhead { text-align: center; font-size: 10px; letter-spacing: .1em; color: var(--dim); padding: 4px 0; }
.calnav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; }
.calnav button { border: 1px solid var(--line); background: rgba(24,18,10,.7); color: var(--ink); border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 15px; }
.calnav .caltitle { font-size: 16px; font-weight: 600; color: var(--gold); min-width: 200px; text-align: center; }
.fastdots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.fastdots .fd {
    width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
    background: rgba(10,24,18,.7); color: var(--dim); font-size: 11px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.fd.done { background: linear-gradient(150deg, #c8904a, #8a5a26); color: #fff; border-color: transparent; }
.fd.today { border-color: var(--gold); box-shadow: 0 0 10px rgba(232,208,136,.35); }
.zrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.zrow label { font-size: 12px; color: var(--dim); flex: 1; }
.zrow input { width: 130px; background: #16110a; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--ink); font: 13px 'Segoe UI'; color-scheme: dark; }
.zrow input:focus { outline: none; border-color: var(--accent); }
.ztotal { font-size: 24px; font-weight: 800; color: var(--gold); text-align: center; margin: 12px 0 4px; }
.note { font-size: 10.5px; color: rgba(232,200,150,.6); line-height: 1.5; margin-top: 10px; padding: 9px 11px; background: rgba(232,208,136,.07); border-left: 3px solid rgba(232,208,136,.4); border-radius: 6px; }

/* ---------- drawers ---------- */
#moments, #detail {
    position: fixed; top: 60px; right: 10px; bottom: 96px; z-index: 26;
    width: 310px; max-width: calc(100vw - 90px);
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
    backdrop-filter: blur(12px); box-shadow: 0 12px 40px rgba(0,0,0,.5);
    transform: translateX(340px); transition: transform .3s cubic-bezier(.2,.8,.2,1);
    display: flex; flex-direction: column; overflow: hidden;
}
#moments.open, #detail.open { transform: translateX(0); }
.ins-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.ins-head .icon-btn { margin-left: auto; }
#dtBody, #momList { flex: 1; overflow-y: auto; padding: 12px 14px; }
.dt-ar { font-size: 26px; direction: rtl; text-align: right; font-family: Georgia, serif; color: var(--gold); line-height: 1.7; margin: 8px 0; }
.dt-en { font-size: 13.5px; line-height: 1.55; color: #ece0cc; }
.dt-sub { font-size: 11px; color: var(--dim); margin-top: 8px; letter-spacing: .06em; }
.ins-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed rgba(220,190,150,.12); }
.ins-row span:first-child { color: var(--dim); }
.mom { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-bottom: 6px; background: rgba(220,140,70,.14); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.mom:hover { background: rgba(220,140,70,.26); }
.mom .ic { font-size: 18px; }
.mom .inf { flex: 1; min-width: 0; }
.mom .lb { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mom .dt { font-size: 11px; color: var(--dim); }
.mom .del { border: 0; background: none; color: var(--dim); font-size: 15px; cursor: pointer; padding: 4px; }

/* ---------- dock ---------- */
#dock {
    position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 30;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
    background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
    padding: 9px 14px; backdrop-filter: blur(12px); box-shadow: 0 10px 34px rgba(0,0,0,.5);
    max-width: calc(100vw - 20px);
}
.dt { border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; display: flex; flex-direction: column; line-height: 1.15; padding: 2px 6px; border-radius: 10px; }
.dt:hover { background: rgba(220,140,70,.18); }
#dtBig { font-size: 14.5px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
#dtSmall { font-size: 10px; color: var(--dim); letter-spacing: .06em; text-transform: uppercase; }
.units { display: flex; gap: 3px; background: rgba(24,10,4,.6); border-radius: 12px; padding: 3px; }
.units button { border: 0; background: transparent; color: var(--dim); font: 600 11px 'Segoe UI'; padding: 6px 9px; border-radius: 9px; cursor: pointer; }
.units button.on { background: rgba(220,140,70,.4); color: #fff; }
.steppers { display: flex; align-items: center; gap: 6px; }
.stbtn, .speed { border: 1px solid var(--line); background: rgba(30,14,6,.6); color: var(--ink); border-radius: 12px; cursor: pointer; font-size: 17px; padding: 7px 13px; transition: background .15s, transform .1s; }
.stbtn:hover { background: rgba(220,140,70,.4); }
.stbtn:active { transform: scale(.94); }
.speed { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 9px 11px; min-width: 74px; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, #d8a04f, #7a4a1e); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 18px rgba(220,170,90,.4); transition: transform .15s, box-shadow .2s; }
.play:hover { transform: scale(1.08); box-shadow: 0 0 26px rgba(220,170,90,.6); }
.play svg { width: 20px; height: 20px; fill: currentColor; }
.quick { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: rgba(30,14,6,.55); color: var(--dim); font: 700 10px 'Segoe UI'; letter-spacing: .08em; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.chip:hover { color: #fff; background: rgba(220,140,70,.4); }

/* ---------- sheets ---------- */
#sheetWrap { position: fixed; inset: 0; z-index: 40; display: none; align-items: flex-end; justify-content: center; background: rgba(6,4,2,.65); backdrop-filter: blur(4px); }
#sheetWrap.open { display: flex; }
.sheet { display: none; width: 100%; max-width: 460px; max-height: 84vh; overflow-y: auto; background: #181209; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 16px 18px 28px; animation: rise .28s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet.open { display: block; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; margin-bottom: 6px; }
.lbl { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--dim); margin: 14px 0 7px; }
.sheet input, .sheet select { width: 100%; background: #16110a; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; font: 14px 'Segoe UI'; margin-bottom: 8px; color-scheme: dark; }
.sheet input:focus, .sheet select:focus { outline: none; border-color: rgba(220,170,110,.6); }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; min-width: 0; }
.btn { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; border-radius: 14px; cursor: pointer; background: linear-gradient(135deg, #d8a04f, #7a4a1e); color: #fff; font: 600 13.5px 'Segoe UI'; letter-spacing: .05em; transition: transform .12s, filter .2s; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn.ghost { background: rgba(220,140,70,.18); border: 1px solid var(--line); color: var(--ink); }
.btn.ghost.on { border-color: var(--accent); color: #fff; box-shadow: 0 0 12px rgba(224,170,84,.25); }
.btn.danger { color: #ff9a92; }
.bgrow { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-bottom: 8px; }
.bgsel { border: 1px solid var(--line); border-radius: 12px; padding: 18px 4px 8px; cursor: pointer; color: var(--dim); font: 600 10.5px 'Segoe UI'; letter-spacing: .05em; position: relative; background: rgba(7,18,12,.7); }
.bgsel::before { content: ''; position: absolute; top: 5px; left: 8px; right: 8px; height: 8px; border-radius: 4px; }
.bgsel[data-bg="cosmic"]::before { background: linear-gradient(90deg, #1a2440, #3a2a10, #5a4520); }
.bgsel[data-bg="aurora"]::before { background: linear-gradient(90deg, #3a2a5e, #6a4a8a, #2a4a6e); }
.bgsel[data-bg="image"]::before { background: linear-gradient(90deg, #6b5426, #8f7b3a, #3a5a6e); }
.bgsel[data-bg="glass"]::before { background: linear-gradient(90deg, rgba(255,255,255,.15), rgba(255,255,255,.45)); }
.bgsel[data-snd="off"]::before { background: linear-gradient(90deg, #3a4152, #4a5170); }
.bgsel[data-snd="chapel"]::before { background: linear-gradient(90deg, #5e4a1d, #8f7b2b); }
.bgsel[data-snd="pad"]::before { background: linear-gradient(90deg, #1d5e4a, #2b8f6e); }
.bgsel[data-snd="morning"]::before { background: linear-gradient(90deg, #2a5e4a, #5aa88f); }
.bgsel[data-snd="custom"]::before { background: linear-gradient(90deg, #5e1d4a, #8f2b5e); }
.bgsel.on { border-color: var(--accent); color: #fff; box-shadow: 0 0 12px rgba(224,170,84,.3); }
.sliders label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); }
.sliders input[type="range"] { flex: 1; margin: 0; padding: 0; }
.emojirow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.emojirow button { border: 1px solid var(--line); background: rgba(7,18,12,.7); border-radius: 10px; font-size: 17px; padding: 7px 9px; cursor: pointer; }
.emojirow button.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(232,208,136,.35); }

/* ---------- hint / status ---------- */
#hint { position: fixed; top: 62px; left: 50%; transform: translate(-50%, -10px); z-index: 35; font-size: 12.5px; color: #f0e8d8; background: rgba(18,14,8,.92); padding: 8px 16px; border-radius: 20px; border: 1px solid rgba(220,190,150,.3); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; max-width: 88vw; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#hint.show { opacity: 1; transform: translate(-50%, 0); }
#statusline { position: fixed; left: 14px; bottom: 12px; z-index: 8; font-size: 11px; letter-spacing: .05em; color: rgba(225,205,165,.5); text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none; }

@media (max-width: 720px) {
    #rail { left: 6px; gap: 3px; padding: 5px 4px; }
    #rail button { width: 44px; }
    #rail i { display: none; }
    #panel { left: 56px; }
    #moments, #detail { top: 56px; right: 6px; bottom: 132px; width: min(320px, calc(100vw - 60px)); }
    #dock { gap: 6px; padding: 8px 10px; bottom: 6px; }
    #dtBig { font-size: 12.5px; }
    .brand-t { display: none; }
    .lit-chip, .verse-chip { font-size: 10px; padding: 6px 9px; }
}
/* live-wallpaper window mode (#live) — pure sky, no chrome */
body.wpchrome #topbar, body.wpchrome #rail, body.wpchrome #dock, body.wpchrome #panel,
body.wpchrome #moments, body.wpchrome #detail, body.wpchrome #sheetWrap,
body.wpchrome #statusline, body.wpchrome #hint, body.wpchrome .verse-chip,
body.wpchrome .lit-chip { display: none !important; }

@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
