/* The Moon Behind My Eyes · layar kunci dan Fokus Tidur. Tanpa ilustrasi: hanya antarmuka.
   Wallpaper mengikuti tema situs; layar yang dimatikan selalu hitam. */
:root {
  --ui: var(--qm-ui); --serif: var(--qm-read); --size: 18px;
  --page: #e9e9ee; --wall-a: #dfe3ec; --wall-b: #c3c9d6; --ink: #0d0e12; --muted: rgba(13,14,18,.58); --glass: rgba(255,255,255,.55); --glass-line: rgba(255,255,255,.6); --accent: #5b5bd6;
  --blur: 0px; --dim: 1; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --page: #050506; --wall-a: #161a26; --wall-b: #05060a; --ink: #f4f5f8; --muted: rgba(244,245,248,.6); --glass: rgba(40,42,52,.5); --glass-line: rgba(255,255,255,.08); --accent: #a5a6ff; color-scheme: dark; } }
:root[data-theme="dark"] { --page: #050506; --wall-a: #161a26; --wall-b: #05060a; --ink: #f4f5f8; --muted: rgba(244,245,248,.6); --glass: rgba(40,42,52,.5); --glass-line: rgba(255,255,255,.08); --accent: #a5a6ff; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background-color: var(--bd-b); background-image: var(--qm-sky); color: var(--ink); }
body { font: 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Di luar ponsel (layar lebar) atau di sudut atas (ponsel) */
.outer { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 48px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: env(safe-area-inset-top) 8px 0 12px; pointer-events: none; }
.outer > * { pointer-events: auto; }
.outer-title { margin: 0; color: var(--muted); font-size: 13px; }
.outer-title i { font-family: var(--serif); }
.top-right { justify-self: end; }
.outer-mid { display: grid; justify-items: center; gap: 4px; min-width: 0; overflow: hidden; }
@media (max-width: 430px) { .outer-mid .jm-step i { display: none; } }
@media (max-width: 359px) { .outer-mid .jm-step { display: none; } }
:root { --jm-card: var(--page); --jm-ink: var(--ink); --jm-accent: var(--accent); --jm-chip: var(--glass); }
.feed .jm-next { margin: 0; }

/* Ponsel */
.phone { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; overflow: hidden; background-color: var(--bd-b); background-image: var(--qm-sky); }
/* kecerahan yang diturunkan: tirai. Layar yang dimatikan tidak ikut redup. */
.screen::before { content: ''; position: absolute; inset: 0; background: #000; opacity: calc((1 - var(--dim)) * .9); pointer-events: none; transition: opacity .4s ease; }
.glass { position: absolute; inset: 0; overflow-y: auto; padding: calc(56px + env(safe-area-inset-top)) 14px 150px; filter: blur(var(--blur)) brightness(calc(.5 + var(--dim) * .5)); transition: filter .25s ease; touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: none; }
.glass::-webkit-scrollbar { display: none; }
.status { display: none; }
.lock { text-align: center; }
.padlock { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .85; }
.date { margin: 2px 0 0; font-size: 17px; font-weight: 500; opacity: .85; }
.clock { margin: -4px 0 0; font: 300 clamp(78px, 24vw, 104px)/1 var(--ui); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.widgets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 360px; margin: 10px auto 14px; }
.widget { display: grid; gap: 1px; padding: 9px 10px; border-radius: 16px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); border: 1px solid var(--glass-line); min-height: 64px; }
.widget small { color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.widget b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.widget span { color: var(--muted); font-size: 11px; line-height: 1.25; }
.widget.lit { box-shadow: 0 0 0 1.5px var(--accent), 0 0 24px -4px var(--accent); }
.live { max-width: 400px; margin: 0 auto 10px; padding: 12px 14px; border-radius: 20px; background: rgba(0,0,0,.82); color: #fff; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.live small { color: rgba(255,255,255,.6); font-size: 11.5px; grid-column: 1 / -1; }
.live b { font-size: 16px; font-weight: 600; }
.live .count { font-size: 26px; font-weight: 300; font-variant-numeric: tabular-nums; }
.live .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; margin-top: 6px; }
.live .bar i { display: block; height: 100%; width: calc(var(--k, 0) * 100%); background: #fff; }

/* Notifikasi dan catatan */
.feed { list-style: none; max-width: 400px; margin: 0 auto; padding: 0; display: grid; gap: 8px; }
.note { padding: 12px 14px; border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); border: 1px solid var(--glass-line); }
.note.fresh { animation: drop .5s cubic-bezier(.3,1.3,.5,1); }
@keyframes drop { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.note-head b { color: var(--ink); font-weight: 600; }
.note-head .ago { margin-left: auto; }
.app-ico { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: #fff; background: #1c1c2e; flex: none; }
.app-ico.notes { background: #f5c400; color: #000; }
.app-ico.sky { background: #2b3a8f; }
.line { display: block; margin: 0; font: 400 var(--size)/1.5 var(--serif); text-wrap: pretty; overflow-wrap: anywhere; }
.line + .line { margin-top: .1em; }
.note.old .line { display: none; }
.note.old .line:first-child { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.note.old[data-open] .line { display: block; white-space: normal; color: inherit; }
.note.old { cursor: pointer; }
.note .acts { display: flex; gap: 8px; margin-top: 10px; }
.note .acts button { flex: 1; min-height: 36px; border: 0; border-radius: 12px; background: rgba(127,127,140,.18); font-weight: 500; font-size: 14px; }
.note.small { padding: 10px 14px; }
.note.small p { margin: 0; font-size: 14px; }
.note.lost p { margin: 0; color: var(--muted); font-size: 13px; }
.stack-more { text-align: center; color: var(--muted); font-size: 12px; margin: -2px 0 0; }
html[data-focus] .note.sky { display: none; }

/* Petunjuk dan tombol bawah */
.screen::after { content: ''; position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 170px; background: linear-gradient(transparent, color-mix(in srgb, var(--wall-b) 92%, transparent) 70%); filter: brightness(calc(.5 + var(--dim) * .5)); pointer-events: none; }
.hint { position: absolute; z-index: 6; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); translate: -50% 0; margin: 0; max-width: calc(100% - 28px); padding: 7px 14px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--glass-line); font-size: 13px; text-align: center; }
.hint:empty { display: none; }
.hint button { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0 0 0 6px; }
.bottom { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 0 40px calc(26px + env(safe-area-inset-bottom)); pointer-events: none; }
.round { pointer-events: auto; position: relative; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: grid; place-items: center; }
.round svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.round.cue { box-shadow: 0 0 0 2px var(--accent); animation: cue 1.6s ease-in-out infinite; }
@keyframes cue { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent); } }
.lockbtn { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.lockbtn .ring { position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--hold, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.lockbtn:disabled { opacity: .45; cursor: default; }

/* Pusat kontrol: tirainya */
.cc { position: absolute; z-index: 10; inset: 0; padding: calc(64px + env(safe-area-inset-top)) 18px 20px; background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(30px) saturate(1.3); backdrop-filter: blur(30px) saturate(1.3); color: #fff; display: grid; align-content: start; justify-items: center; gap: 18px; animation: cc .35s cubic-bezier(.3,1,.4,1); }
@keyframes cc { from { opacity: 0; transform: translateY(-24px); } }
.cc-grid { width: min(360px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-tile { display: grid; gap: 8px; align-content: center; padding: 14px; border: 0; border-radius: 22px; background: rgba(255,255,255,.14); color: #fff; text-align: left; min-height: 120px; }
.cc-tile.bright { grid-column: 1 / -1; min-height: 0; }
.cc-tile input { width: 100%; accent-color: #fff; }
.cc-tile b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cc-tile small { display: block; opacity: .7; }
.cc-tile.focus { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.moon-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); font-size: 20px; }
.cc-tile.focus[aria-pressed="true"] { background: #fff; color: #000; }
.cc-tile.focus[aria-pressed="true"] .moon-ico { background: #5e5ce6; color: #fff; }
.cc-close { min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; }

/* Layar dimatikan: yang tersisa hanya cahaya dari dalam */
.aod { position: absolute; z-index: 20; inset: 0; background: #000; color: rgba(236,238,246,.86); display: grid; align-content: center; justify-items: center; gap: 14px; padding: 40px 26px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
html[data-off] .aod { opacity: calc(var(--hold, 0)); }
html[data-eyes-closed] .aod { opacity: 1; }
.aod-clock { margin: 0; font: 300 54px/1 var(--ui); color: rgba(236,238,246,.32); font-variant-numeric: tabular-nums; }
.aod-moon { margin: 0; font-size: 13px; letter-spacing: .02em; color: rgba(236,238,246,.5); }
.aod-moon b { color: #e9ecff; font-weight: 600; }
.aod-lines { max-width: 30em; }
.aod-lines .line { color: rgba(240,242,250,.9); font-style: italic; }
.aod-lines .line.new { animation: rise 1.2s ease; }
.aod-lines .gap { display: block; height: .8em; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

/* Dialog */
dialog { width: min(420px, calc(100% - 28px)); padding: 0; border: 1px solid rgba(127,127,140,.25); border-radius: 16px; background: var(--page); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.dialog-head h2 { margin: 0; font: 600 18px var(--ui); }
.close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font: 300 22px var(--ui); }
.settings-body { padding: 0 18px 16px; }
.setting-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(127,127,140,.25); }
.setting-button { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); font-weight: 600; }
.setting-button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
.setting-button:disabled { opacity: .4; }

@media (max-width: 699px) { .outer-title { display: none; } }
/* Layar lebar: ponsel di tengah meja */
@media (min-width: 700px) {
  .outer { position: static; height: 56px; }
  .phone { position: relative; inset: auto; width: 400px; height: min(860px, calc(100svh - 76px)); margin: 0 auto; border-radius: 48px; box-shadow: 0 0 0 10px #111, 0 0 0 11px #333, 0 40px 80px -30px rgba(0,0,0,.6); }
  .glass { padding-top: 46px; }
  .status { display: flex; justify-content: space-between; margin: 0 6px 10px; font-size: 13px; font-weight: 600; }
  .status-right { display: inline-flex; gap: 10px; }
  .clock { font-size: 96px; }
}
html[data-calm] *, html[data-calm] *::before, html[data-calm] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
