/* The Room · aplikasi Rumah. Tanpa ilustrasi: kartu aksesori, sensor, adegan, dan riwayat. Tema mengikuti situs. */
:root {
  --ui: var(--qm-ui); --serif: var(--qm-read); --size: 18px;
  --bg: var(--qm-sky); --page: var(--bd-b); --ink: #121214; --muted: #77746e; --tile: rgba(255,255,255,.62); --tile-on: #ffffff; --line: rgba(0,0,0,.08);
  --accent: #f29d0c; --warn: #d4371e; --cold: #2f7fd8; --chip: rgba(255,255,255,.55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: var(--qm-sky); --page: var(--bd-b); --ink: #f2f2f5; --muted: #9a9aa2; --tile: rgba(58,58,64,.55); --tile-on: #f2f2f5; --line: rgba(255,255,255,.08); --accent: #ffb340; --warn: #ff6b55; --cold: #64a8ff; --chip: rgba(60,60,68,.55); color-scheme: dark; } }
:root[data-theme="dark"] { --bg: var(--qm-sky); --page: var(--bd-b); --ink: #f2f2f5; --muted: #9a9aa2; --tile: rgba(58,58,64,.55); --tile-on: #f2f2f5; --line: rgba(255,255,255,.08); --accent: #ffb340; --warn: #ff6b55; --cold: #64a8ff; --chip: rgba(60,60,68,.55); color-scheme: dark; }
* { box-sizing: border-box; }
html { background: var(--page); }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--bg); }
body { margin: 0; min-height: 100svh; color: var(--ink); background: transparent; font: 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; overflow-x: 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; }

.app { width: min(640px, 100%); margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 10; height: 50px; display: flex; align-items: center; justify-content: space-between; padding-top: env(safe-area-inset-top); }
.step-row { margin: 0 0 10px; }
:root { --jm-card: var(--page); --jm-ink: var(--ink); --jm-accent: var(--accent); --jm-chip: var(--chip); }
.now .jm-next { margin-top: 12px; }
.kicker { margin: 4px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.room-title { margin: 2px 0 0; font: 700 32px/1.1 var(--ui); letter-spacing: -.02em; }
.room-name { color: var(--muted); font-weight: 600; }
.poem-title { margin: 2px 0 10px; color: var(--muted); font: italic 16px var(--serif); }
.summary { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.summary li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--chip); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.summary li svg { width: 15px; height: 15px; }
.summary li.cold { color: var(--cold); }
.summary li.warn { color: var(--warn); }
.lost { margin: 0 0 12px; padding: 9px 12px; border-radius: 12px; background: var(--chip); color: var(--muted); font-size: 13px; }

/* Bait yang sedang terjadi */
.now { padding: 14px 16px 16px; border-radius: 20px; background: var(--tile); -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3); border: 1px solid var(--line); }
.event { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.event b { color: var(--ink); font-weight: 600; }
.event .when { margin-left: auto; font-weight: 400; }
.ev-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.ev-ico svg { width: 14px; height: 14px; }
.text { font: 400 var(--size)/1.6 var(--serif); text-wrap: pretty; overflow-wrap: anywhere; margin: 0; }
.now .text.fresh { animation: rise .6s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.next { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.next::before { content: '↓'; color: var(--accent); font-weight: 700; }

.invite { margin-top: 10px; padding: 12px 14px; border-radius: 20px; background: var(--tile-on); color: #111; box-shadow: 0 16px 36px -18px rgba(0,0,0,.45); animation: rise .5s ease; }
.invite p { margin: 0 0 10px; font-size: 14px; }
.invite small { display: block; color: #777; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.invite .acts { display: flex; gap: 8px; }
.invite button { flex: 1; min-height: 38px; border: 0; border-radius: 12px; background: #ececf0; color: #111; font-weight: 600; }
.invite button.yes { background: var(--accent); color: #fff; }

/* Kartu aksesori */
.section { margin: 20px 2px 8px; font: 600 17px var(--ui); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; display: grid; gap: 8px; align-content: start; min-height: 108px; padding: 12px; border-radius: 18px; background: var(--tile); -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3); border: 1px solid var(--line); animation: rise .5s ease; }
.tile.wide { grid-column: 1 / -1; }
.tile.on { background: var(--tile-on); color: #111; }
.tile.on .t-status { color: #6b6b70; }
.tile.dim { opacity: .55; }
.tile.dashed { background: none; border: 1.5px dashed var(--line); }
.tile.cue { box-shadow: 0 0 0 2px var(--accent); }
.tile.cue::after { content: ''; position: absolute; inset: -2px; border-radius: 20px; box-shadow: 0 0 0 2px var(--accent); animation: cue 1.6s ease-out infinite; pointer-events: none; }
@keyframes cue { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.04); } }
.t-head { display: flex; align-items: center; gap: 10px; }
.t-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(127,127,135,.18); flex: none; }
.tile.on .t-ico { background: var(--accent); color: #fff; }
.t-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.t-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.t-status { color: var(--muted); font-size: 12.5px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.t-status.warn { color: var(--warn); font-weight: 600; }
.t-status.cold { color: var(--cold); font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: rgba(127,127,135,.22); overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--c, var(--accent)); transition: width .4s ease; }
.t-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.t-acts button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(127,127,135,.2); font-size: 13px; font-weight: 600; }
.tile.on .t-acts button { background: #ececf0; color: #111; }
.t-acts button.main { background: var(--accent); color: #fff; }
.t-acts button:disabled { opacity: .45; cursor: default; }
.tile input[type="range"] { width: 100%; accent-color: var(--accent); }
.tile.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Riwayat */
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history li { border-radius: 16px; background: var(--tile); border: 1px solid var(--line); }
.history button { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 0; background: none; text-align: left; font-size: 13.5px; }
.history button b { font-weight: 600; }
.history button span { color: var(--muted); margin-left: auto; font-size: 12px; }
.history .text { display: none; padding: 0 14px 14px; font-size: calc(var(--size) * .92); }
.history li[data-open] .text { display: block; }
.history .empty { padding: 12px 14px; color: var(--muted); font-size: 13px; background: none; border: 0; }
.end { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.end a, .end button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--chip); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; font-weight: 500; }

.toast { position: fixed; z-index: 40; left: 50%; top: calc(10px + env(safe-area-inset-top)); translate: -50% 0; width: min(380px, calc(100% - 24px)); padding: 12px 14px; border-radius: 16px; background: var(--tile-on); color: #111; box-shadow: 0 16px 40px -14px rgba(0,0,0,.5); font-size: 14px; animation: drop .45s cubic-bezier(.3,1.4,.5,1); }
.toast small { display: block; color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }

dialog { width: min(420px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); 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 var(--line); }
.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 (min-width: 900px) {
  .app { width: min(1040px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 26px; }
  .top { grid-column: 1 / -1; }
  .home { display: contents; }
  .home > .kicker, .home > .room-title, .home > .poem-title, .home > .summary, .home > .lost, .home > .now, .home > .invite { grid-column: 1; }
  .home > .section, .home > .tiles, .home > .history { grid-column: 2; }
  .home > .section:first-of-type { grid-row: 2; margin-top: 4px; }
  .home > .tiles { grid-row: 3 / span 6; align-self: start; }
  .home > .section ~ .section, .home > .history { grid-column: 1; }
}
@media (max-width: 360px) { .app { padding: 0 12px 30px; } .tiles { gap: 8px; } .tile { padding: 10px; } }
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; } }
