/* Luah — gaya asas. Pembolehubah (--aksen, --font, --fs, --radius, --lebar) disuntik dari Setting. */
:root {
  --bg: #ffffff; --fg: #0f1419; --muted: #536471; --line: #eff3f4; --card: #ffffff; --hover: #f7f9f9;
  --danger: #f4212e; --ok: #00ba7c; --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light dark;
}
html[data-theme="dark"] { --bg: #000000; --fg: #e7e9ea; --muted: #71767b; --line: #2f3336; --card: #0a0a0a; --hover: #16181c; --shadow: none; color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { --bg: #000000; --fg: #e7e9ea; --muted: #71767b; --line: #2f3336; --card: #0a0a0a; --hover: #16181c; --shadow: none; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: var(--fs); line-height: 1.5; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--aksen); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.25rem; margin: 0; }
.wrap { width: 100%; max-width: var(--lebar); margin: 0 auto; padding: 0 12px; }
.muted { color: var(--muted); } .faint { color: var(--muted); opacity: .7; } .center { text-align: center; }
.big { font-size: 4rem; margin: 0; line-height: 1; } .lead { font-size: 1.2rem; }

.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.brand { color: var(--fg); font-weight: 800; font-size: 1.2rem; display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-logo { max-height: 34px; width: auto; display: block; }
.admin-nav { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.admin-nav form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--aksen); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

main { padding-top: 8px; padding-bottom: 32px; min-height: 60vh; }
.foot { display: flex; gap: 16px; justify-content: center; color: var(--muted); font-size: .85rem; padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0; overflow: hidden; }
.card.center { padding: 32px 16px; } .card.narrow { max-width: 420px; margin-inline: auto; padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
label { font-size: .9rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: calc(var(--radius) / 2); padding: 10px 12px; width: 100%;
}
input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--aksen); outline-offset: 1px; }
textarea { resize: vertical; min-height: 5rem; }
fieldset { border: 1px solid var(--line); border-radius: calc(var(--radius) / 2); padding: 8px 12px; margin: 0; }
legend { color: var(--muted); font-size: .9rem; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; min-height: 40px; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--aksen); color: var(--aksen-teks); border-color: transparent; }
.btn.primary:hover { filter: brightness(.94); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.flash { padding: 10px 14px; border-radius: calc(var(--radius) / 2); margin: 10px 0; font-size: .95rem; }
.flash-ok { background: color-mix(in srgb, var(--ok) 15%, var(--bg)); border: 1px solid var(--ok); }
.flash-err { background: color-mix(in srgb, var(--danger) 12%, var(--bg)); border: 1px solid var(--danger); }

/* profil */
.profile { padding: 0; }
.banner { display: block; width: 100%; height: 130px; object-fit: cover; background: var(--aksen); }
.banner-empty { background: linear-gradient(135deg, var(--aksen), color-mix(in srgb, var(--aksen) 40%, var(--bg))); }
.profile-body { padding: 0 16px 16px; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; background: var(--aksen); color: var(--aksen-teks); display: grid; place-items: center; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.8rem; margin-top: -38px; border: 4px solid var(--card); }
.p-name { margin-top: 6px; font-size: 1.35rem; }
.bio { margin: 8px 0 0; white-space: normal; }
.filterbar { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.filterbar a { color: var(--fg); font-size: 1.3rem; padding: 4px 8px; border-radius: 999px; }

/* composer */
.composer { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.composer textarea { border: 0; padding: 4px; font-size: 1.1rem; background: transparent; min-height: 4.5rem; }
.composer textarea:focus { outline: none; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.composer-bar select { width: auto; padding: 6px 8px; font-size: .85rem; }
.composer-bar .btn { margin-left: auto; }
.count { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.warn { color: #d97706; } .count.over { color: var(--danger); font-weight: 700; }
.iconbtn { flex-direction: row; font-size: 1.3rem; cursor: pointer; padding: 4px 8px; border-radius: 999px; color: var(--fg); }
.iconbtn:hover { background: var(--hover); }
.moods { display: flex; gap: 4px; flex-wrap: wrap; }
.mood { flex-direction: row; cursor: pointer; }
.mood input { position: absolute; opacity: 0; pointer-events: none; }
.mood span { display: inline-grid; place-items: center; min-width: 38px; height: 38px; border-radius: 999px; border: 1px solid transparent; font-size: 1.2rem; color: var(--muted); }
.mood input:checked + span { border-color: var(--aksen); background: color-mix(in srgb, var(--aksen) 14%, var(--bg)); }
.mood input:focus-visible + span { outline: 2px solid var(--aksen); }
.preview, .cur-img { display: flex; align-items: center; gap: 10px; }
.preview[hidden] { display: none; }
.preview img, .cur-img img, .cur-img-s { max-height: 120px; border-radius: calc(var(--radius) / 2); border: 1px solid var(--line); }
.cur-img img { max-width: 160px; }

/* timeline */
.feed { border-top: 1px solid var(--line); margin-top: 8px; }
.post { display: flex; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.post:hover { background: color-mix(in srgb, var(--hover) 60%, transparent); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: .92rem; }
.author { font-weight: 700; }
.time { color: var(--muted); }
.badge, .chip-mood { font-size: .95rem; }
.chip-mood:hover { text-decoration: none; transform: scale(1.15); }
.post-body { margin: 2px 0 8px; overflow-wrap: anywhere; word-break: break-word; }
.post-body .tag { font-weight: 600; }
.media { display: block; margin: 6px 0 8px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--hover); }
.media img { display: block; width: 100%; max-height: 520px; object-fit: cover; }
.zoomable { cursor: zoom-in; }
.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rx { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 2px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; transition: transform .1s; }
.rx:hover { background: var(--hover); }
.rx:active { transform: scale(.94); }
.rx.on { border-color: var(--aksen); color: var(--aksen); background: color-mix(in srgb, var(--aksen) 12%, var(--bg)); font-weight: 700; }
.rx .em { font-size: 1.05rem; line-height: 1; }
.rx .n:empty { display: none; }
.rx.busy { opacity: .6; pointer-events: none; }
.more { padding: 16px 0; }
.empty { padding: 32px 0; }

/* menu admin */
.menu { margin-left: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 0 10px; border-radius: 999px; color: var(--muted); font-size: 1.2rem; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--hover); }
.menu-pop { position: absolute; right: 0; top: 100%; z-index: 10; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--radius) / 1.5); box-shadow: 0 8px 28px rgba(0,0,0,.2); padding: 4px; display: flex; flex-direction: column; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; font: inherit; font-size: .95rem; color: var(--fg); border-radius: 8px; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--hover); text-decoration: none; }
.menu-pop form { margin: 0; }
.menu-pop .danger { color: var(--danger); }

/* embed */
.embed { display: block; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); color: var(--fg); }
.embed small { color: var(--muted); font-size: .78rem; }
.embed strong { display: block; font-size: .95rem; line-height: 1.3; overflow-wrap: anywhere; }
.embed-link { display: flex; flex-direction: column; text-decoration: none; }
.embed-link:hover { background: var(--hover); text-decoration: none; }
.embed-thumb img { display: block; width: 100%; max-height: 260px; object-fit: cover; background: var(--hover); }
.embed-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.embed-desc { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.embed-play { position: relative; display: block; width: 100%; padding: 0; border: 0; background: #111; color: #fff; font: inherit; text-align: left; cursor: pointer; }
.embed-video { background: #000; }
.embed-video .embed-play { aspect-ratio: 16 / 9; }
.embed-video .embed-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.embed-btn { position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; padding-left: 4px; box-sizing: border-box; border: 2px solid rgba(255,255,255,.85); }
.embed-play:hover .embed-btn, .embed-play:focus-visible .embed-btn { background: var(--accent); }
.embed-video .embed-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; background: linear-gradient(to top, rgba(0,0,0,.8), transparent); }
.embed-video .embed-cap small { color: rgba(255,255,255,.8); }
.embed-audio .embed-play { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); color: var(--fg); min-height: 76px; }
.embed-audio .embed-art { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--hover); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.embed-audio .embed-art img { width: 100%; height: 100%; object-fit: cover; }
.embed-audio .embed-btn { position: static; margin: 0 0 0 auto; flex: 0 0 40px; width: 40px; height: 40px; font-size: 1rem; color: var(--fg); background: var(--hover); border-color: var(--line); order: 3; }
.embed-audio .embed-cap { order: 2; min-width: 0; }
.embed-frame { display: block; width: 100%; border: 0; }
.embed-video.is-live .embed-frame { aspect-ratio: 16 / 9; height: auto; }
.embed-h152.is-live .embed-frame { height: 152px; }
.embed-h166.is-live .embed-frame { height: 166px; }
.embed-h352.is-live .embed-frame { height: 352px; }
.embed-src { display: block; padding: 6px 12px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }
.embed-off { font-size: .85rem; color: var(--muted); }

/* setting */
.sec summary { cursor: pointer; font-weight: 700; padding: 14px 16px; }
.sec > .stack, .sec > form, .sec > table { padding: 0 16px 16px; }
.cur-img { margin-bottom: 6px; }
.cur-img img { max-height: 64px; max-width: 160px; background: var(--hover); }
.savebar { position: sticky; bottom: 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); text-align: center; z-index: 5; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.info { width: 100%; font-size: .9rem; border-collapse: collapse; }
.info th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 0; width: 45%; }
.info td { padding: 6px 0; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.lb img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; transform-origin: center center; will-change: transform; cursor: zoom-in; -webkit-user-drag: none; }
.lb.zoomed img { cursor: grab; }
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.4rem; cursor: pointer; z-index: 2; }
.lb-hint { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: .8rem; pointer-events: none; }

@media (min-width: 700px) { .banner { height: 170px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
