/* ---------- font (di-host sendiri, lisensi OFL) ---------- */
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }

:root {
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --bg: #f7f2ee;
  --surface: #ffffff;
  --surface-2: #f1e9e6;
  --ink: #2b1a2c;
  --muted: #8b7b88;
  --line: #ece2de;
  --primary: #5b2a5c;
  --primary-2: #8a3f7a;
  --rose: #ea6f8f;
  --rose-soft: #fde4ea;
  --danger: #d1435b;
  --ok: #1f8a5b;
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(255, 255, 255, .6);
  --chat-bg: #f4eee9;
  --plain-mine: linear-gradient(135deg, #7a5574 0%, #684863 100%);
  --shadow: 0 10px 30px rgba(60, 25, 60, .10);
  --shadow-lg: 0 24px 60px rgba(60, 25, 60, .18);
  --radius: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --tabbar-h: 76px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141015;
    --surface: #1f1820;
    --surface-2: #2a2129;
    --ink: #f5ecf2;
    --muted: #a8979f;
    --line: #342a33;
    --primary: #c98bd0;
    --primary-2: #e2a3c9;
    --rose-soft: #3a2230;
    --glass: rgba(30, 22, 31, .72);
    --glass-line: rgba(255, 255, 255, .08);
    --chat-bg: #17121a;
    --plain-mine: linear-gradient(135deg, #7a5f80 0%, #69526f 100%);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: progress; }
.icon { flex: none; }

.loading { margin: auto; color: var(--muted); }
.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.center-text { text-align: center; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .btn { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .5px; }
.display { font-family: var(--display); font-weight: 600; letter-spacing: -.5px; margin: 0; }

/* ---------- tombol & input ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 13px 20px; font-weight: 600; font-size: 15px;
  text-decoration: none; transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(91, 42, 92, .28);
}
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn.small { padding: 9px 14px; font-size: 14px; }
.btn.glass-btn { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .35); backdrop-filter: blur(12px); }
.link { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 0; }

.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 16px; padding: 14px 16px; font: inherit; transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(138, 63, 122, .12); }
textarea.input { resize: vertical; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 8px; }
.code-input { text-transform: uppercase; letter-spacing: 6px; font: 700 24px/1 ui-monospace, Menlo, monospace; text-align: center; padding: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  border: 0; background: transparent; width: 42px; height: 42px; border-radius: 14px; color: inherit;
  transition: background .2s, transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.glass { background: rgba(255, 255, 255, .22); color: #fff; backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, .3); }
.icon-btn.soft { background: var(--rose-soft); color: var(--rose); }
.icon-btn.ghosty { width: 36px; height: 36px; color: var(--muted); }

.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--glass-line); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

.chip { margin-left: auto; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.chip.ok { background: #dff5e9; color: var(--ok); }
.chip.warn { background: #fff0d9; color: #9a5b00; }

/* ---------- animasi ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slide-out { to { transform: translateX(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translate(20px, -30px) scale(1.08); } }
@keyframes drift { 50% { transform: translateY(-24px) rotate(8deg); } }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .6; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }

.tab-enter { animation: fade-up .35s var(--ease); }
.pop { animation: pop .28s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- login ---------- */
.login {
  flex: 1; min-height: 100dvh; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: max(48px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 70% at 0% 0%, #ff9ac1 0%, transparent 55%),
              radial-gradient(90% 60% at 100% 20%, #8b6cf6 0%, transparent 60%),
              linear-gradient(180deg, #4a1d4f 0%, #1c0f24 100%);
  color: #fff;
}
.login-orbs span {
  position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55;
  animation: float 12s ease-in-out infinite;
}
.login-orbs span:nth-child(1) { width: 220px; height: 220px; background: #ff7aa8; top: 8%; left: -60px; }
.login-orbs span:nth-child(2) { width: 260px; height: 260px; background: #7c5cff; top: 30%; right: -90px; animation-delay: -4s; }
.login-orbs span:nth-child(3) { width: 180px; height: 180px; background: #ffb38a; bottom: 22%; left: 30%; animation-delay: -8s; }
.login-brand { position: relative; text-align: center; margin-top: 6vh; animation: fade-up .6s var(--ease); }
.login-logo { width: 76px; height: 76px; border-radius: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.login-brand h1 { font: 600 56px/1 var(--display); letter-spacing: -1.5px; margin: 18px 0 6px; }
.login-brand p { margin: 0; font: italic 500 19px var(--display); opacity: .85; }
.login-card {
  position: relative; width: 100%; max-width: 420px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: 28px;
  background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: var(--shadow-lg);
  animation: fade-up .6s .1s var(--ease) both;
}
@media (prefers-color-scheme: dark) { .login-card { background: rgba(31, 24, 32, .9); } }
.login-card h2 { margin: 0 0 4px; font: 600 24px var(--display); }

/* ---------- onboarding (undang / gabung / verifikasi) ---------- */
.onboard {
  flex: 1; width: 100%; max-width: 460px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  padding: max(32px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  text-align: center; animation: fade-up .45s var(--ease);
}
.onboard.page { min-height: 100dvh; background: var(--bg); }
.onboard .display { font-size: 32px; line-height: 1.15; }
.onboard form { text-align: left; }
.connect-art { display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.connect-art > span:not(.connect-line) {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 40px;
  background: var(--surface); box-shadow: var(--shadow); border: 4px solid var(--surface);
}
.connect-art .bubble-a { background: linear-gradient(135deg, #fde4ea, #f5d0ff); }
.connect-art .bubble-b { background: linear-gradient(135deg, #e0e7ff, #fde4ea); }
.connect-line { width: 64px; border-top: 3px dashed var(--rose); margin: 0 -4px; }
.pulse-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--rose); animation: pulse 1.4s ease-in-out infinite; }
.verify-icon { width: 84px; height: 84px; margin: 0 auto; border-radius: 28px; display: grid; place-items: center; background: var(--rose-soft); color: var(--primary); }
.verify-icon.warn { background: #fff0d9; color: #9a5b00; }
.safety { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.safety span { font: 600 20px ui-monospace, Menlo, monospace; padding: 12px 0; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }

.invite-card { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px 18px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--muted); }
.kv-row b { text-align: right; word-break: break-all; }
.kv-row .code { font-size: 18px; letter-spacing: 2px; color: var(--primary); }

/* ---------- kerangka tab ---------- */
.shell { flex: 1; height: 100dvh; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.tab-view { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.tab-view > * { flex: 1; min-height: 0; }
.tabbar {
  position: absolute; z-index: 5; left: 16px; right: 16px; bottom: max(14px, env(safe-area-inset-bottom));
  max-width: 420px; margin: 0 auto; height: 64px; border-radius: 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; padding: 6px;
  box-shadow: var(--shadow-lg);
}
.shell[data-tab="home"] .tabbar { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .28); color: #fff; }
.tab {
  height: 100%; border: 0; background: transparent; border-radius: 18px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600; transition: color .2s, background .25s var(--ease);
}
.shell[data-tab="home"] .tab { color: rgba(255, 255, 255, .75); }
.tab.active { color: var(--primary); background: var(--rose-soft); }
.shell[data-tab="home"] .tab.active { color: #fff; background: rgba(255, 255, 255, .22); }
.tab-icon { position: relative; display: grid; }
.tab.active .icon { animation: beat 1s var(--ease) 1; }

/* ---------- beranda ---------- */
.home { position: relative; color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.home-wall { position: absolute; inset: 0; transition: background .4s; background-size: cover !important; background-position: center !important; }
.home-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .28) 0%, transparent 30%, transparent 55%, rgba(0, 0, 0, .45) 100%); }
.home-top {
  position: relative; display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(20px, env(safe-area-inset-top)) 20px 0;
}
.home-hello { margin: 0; opacity: .85; font-weight: 500; }
.home-welcome {
  margin: 0 0 4px; max-width: 320px; font: italic 500 clamp(26px, 8vw, 34px)/1.15 var(--display);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35); animation: fade-up .6s var(--ease);
}
.home-top .row { gap: 8px; }
.home-name { margin: 0; font: 600 30px/1.1 var(--display); letter-spacing: -.5px; }
.home-center { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 0 20px; text-align: center; }
.home-couple { display: flex; align-items: center; }
.home-couple .avatar { box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.home-heart {
  width: 40px; height: 40px; margin: 0 -10px; z-index: 1; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--rose); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); animation: beat 2.4s ease-in-out infinite;
}
.home-heart .icon { fill: currentColor; }
.home-days { display: flex; flex-direction: column; align-items: center; gap: 4px; text-shadow: 0 2px 20px rgba(0, 0, 0, .25); }
.days-num { font: 600 clamp(64px, 22vw, 104px)/1 var(--display); letter-spacing: -3px; }
.days-label { font: italic 500 22px var(--display); }
.days-since { font-size: 13px; opacity: .85; margin-top: 4px; }
.home-days .btn { margin-top: 10px; }
.home-cards {
  position: relative; display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px;
  padding: 0 16px calc(var(--tabbar-h) + max(24px, env(safe-area-inset-bottom)));
}
.home-card {
  position: relative; display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0;
  padding: 14px; border-radius: 20px; color: #fff;
  background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25);
  transition: transform .15s var(--ease);
}
.home-card:active { transform: scale(.97); }
.home-card-icon { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .22); }
.home-card-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.home-card-text b { font-size: 14px; }
.home-card-text span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card-time { position: absolute; top: 10px; right: 12px; font-size: 11px; opacity: .7; }
@media (max-width: 360px) { .home-cards { grid-template-columns: 1fr; } }

/* ---------- halaman umum ---------- */
.page { display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: max(24px, env(safe-area-inset-top)) 20px 16px;
}
.page-head .display { font-size: 36px; line-height: 1; }
.page-head .btn { white-space: nowrap; flex: none; }
.page-head .muted { font-size: 14px; margin-top: 6px; }
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px; background: var(--glass); backdrop-filter: blur(18px);
}
.bar h2 { margin: 0; font-size: 17px; }

/* ---------- daftar ruang ---------- */
.rooms { padding-bottom: calc(var(--tabbar-h) + 32px); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 12px; padding: 0 16px; }
.room-card {
  position: relative; min-height: 172px; border-radius: 24px; padding: 16px; text-align: left; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  background: var(--room-bg); color: var(--room-text); font-family: var(--room-font);
  border: 0; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s;
  animation: pop .35s var(--ease) both;
}
.room-card:nth-child(2) { animation-delay: .04s; }
.room-card:nth-child(3) { animation-delay: .08s; }
.room-card:nth-child(4) { animation-delay: .12s; }
.room-card:active { transform: scale(.97); }
.room-card .room-emoji { position: absolute; top: 14px; left: 14px; width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; line-height: 1; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(8px); }
.room-lock { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .25); backdrop-filter: blur(8px); }
.room-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.room-brief { font-size: 12px; opacity: .8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room-card.broken { justify-content: center; color: var(--muted); background: var(--surface); }
.empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-art { font-size: 56px; margin-bottom: 8px; }

/* ---------- form buat ruang ---------- */
.form-page .form { padding: 8px 16px max(32px, env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }
.room-preview {
  border-radius: 24px; padding: 18px; min-height: 170px; display: flex; flex-direction: column; gap: 8px;
  background: var(--room-bg); color: var(--room-text); font-family: var(--room-font); box-shadow: var(--shadow);
}
.room-preview .room-emoji { font-size: 32px; }
.preview-bubble { max-width: 75%; padding: 8px 12px; border-radius: 16px; font-size: 13px; }
.preview-bubble.theirs { background: var(--theirs); color: var(--theirs-text); align-self: flex-start; border-bottom-left-radius: 6px; }
.preview-bubble.mine { background: var(--mine); color: var(--mine-text); align-self: flex-end; border-bottom-right-radius: 6px; }
.theme-grid { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.theme-opt {
  flex: 0 0 128px; scroll-snap-align: start; border: 2px solid transparent; border-radius: 18px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; min-height: 100px;
  background: var(--room-bg); color: var(--room-text); font-family: var(--room-font); font-size: 13px; font-weight: 600;
  transition: transform .15s var(--ease), border-color .2s;
}
.theme-opt.selected { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 0 0 4px rgba(138, 63, 122, .18); }
.theme-emoji { font-size: 26px; }
.colors .field { flex: 1; }
.colors input[type=color] { width: 100%; height: 44px; border: 0; background: none; padding: 0; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.switch-row > span { display: flex; flex-direction: column; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .2s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }

.avatar-picker { display: flex; gap: 14px; align-items: flex-start; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-opt { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; display: grid; place-items: center; }
.avatar-opt.photo { color: var(--primary); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; font-size: 20px; line-height: 1;
  background: var(--rose-soft);
}
.avatar.lg { width: 76px; height: 76px; font-size: 42px; }
.avatar.xl { width: 88px; height: 88px; font-size: 50px; }
.avatar.ring { border: 3px solid rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .25); backdrop-filter: blur(8px); }

/* ---------- sheet & overlay ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(20, 8, 20, .45); display: grid; place-items: end center; animation: fade-in .2s; }
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto;
  background: var(--bg); color: var(--ink); border-radius: 28px 28px 0 0;
  padding: 8px 18px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; animation: sheet-up .3s var(--ease);
}
.sheet-bg.closing { animation: fade-in .2s reverse forwards; }
.sheet-bg.closing .sheet { animation: sheet-up .2s reverse forwards; }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h3 { margin: 0; font: 600 21px var(--display); }
@media (min-width: 600px) {
  .sheet-bg { place-items: center; }
  .sheet { border-radius: 28px; }
}
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); animation: slide-in .32s var(--ease); }
.overlay > * { flex: 1; min-height: 0; }
.overlay.closing { animation: slide-out .22s ease-in forwards; }

.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: var(--surface); border-radius: 16px; padding: 15px 16px; font-weight: 500;
}
.menu-item .icon:last-child:not(:first-child) { margin-left: auto; color: var(--muted); }
.menu-item.danger { color: var(--danger); }
.brief-box { background: var(--surface); border-radius: 16px; padding: 14px; }
.brief-box p { margin: 6px 0 0; color: var(--muted); }
.raw { background: #120c14; color: #a7f3c0; border-radius: 16px; padding: 14px; font-size: 12px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 30px); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: pop .25s var(--ease); transition: opacity .3s;
}
.toast.out { opacity: 0; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 16px; animation: fade-in .2s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.lightbox-x { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; background: rgba(255, 255, 255, .16); }

/* ---------- pengaturan ---------- */
.settings { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 20px 20px; text-align: center; }
.profile-head h2 { margin: 10px 0 0; font: 600 26px var(--display); }
.avatar-edit { position: relative; border: 0; background: none; padding: 0; }
.avatar-edit > span:last-child { position: absolute; right: 0; bottom: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; border: 3px solid var(--bg); }
.role-badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.role-badge.admin { background: linear-gradient(135deg, #fde68a, #f9a8d4); color: #5b2a00; }
.group { margin: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.group h3 { margin: 6px 4px 0; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.group.list { gap: 2px; }
.group.list .menu-item { border-radius: 6px; }
.group.list .menu-item:first-of-type { border-radius: 18px 18px 6px 6px; }
.group.list .menu-item:last-of-type { border-radius: 6px 6px 18px 18px; }
.group.list .menu-item:only-of-type { border-radius: 18px; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.wall-opt {
  aspect-ratio: 3 / 4; border-radius: 16px; border: 3px solid transparent; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 8px;
  color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.wall-opt.selected { border-color: var(--primary); }
.wall-opt.upload { background: var(--surface); color: var(--primary); text-shadow: none; justify-content: center; border: 2px dashed var(--line); }
.wall-opt.upload.selected { border: 3px solid var(--primary); }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: var(--surface); }
.user-initial { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; background: var(--rose-soft); color: var(--primary); flex: none; }
.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 14px; }
.user-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- chat ---------- */
.chat {
  position: relative; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
  background: var(--room-bg); color: var(--room-text); font-family: var(--font);
}
/* Cahaya lembut tema yang bergerak pelan (pengganti hiasan emoji). */
.orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orbs span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .22; animation: float 22s ease-in-out infinite; }
.orbs span:nth-child(1) { background: var(--orb1); top: -25vmax; left: -20vmax; }
.orbs span:nth-child(2) { background: var(--orb2); top: 20%; right: -30vmax; animation-delay: -7s; }
.orbs span:nth-child(3) { background: var(--orb3); bottom: -30vmax; left: 10%; animation-delay: -14s; opacity: .16; }
.chat.plain:not(.paletted) .orbs { display: none; }
/* Di layar chat tab bar disembunyikan supaya ruang layar lega; kembali lewat tombol Beranda di header. */
.shell[data-tab="chat"] .tabbar { display: none; }

.chat-bar {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px; background: var(--room-bar);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-bottom: 1px solid rgba(127, 127, 127, .14);
}
.chat.plain .chat-bar { padding-left: 16px; }
.chat-bar .icon-btn { color: var(--room-text); }
.chat-head-avatar .avatar { width: 42px; height: 42px; font-size: 24px; }
.room-badge { background: rgba(255, 255, 255, .16); border-radius: 14px; border: 1px solid rgba(255, 255, 255, .22); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-weight: 700; font-size: 16px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat.plain .chat-sub::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; vertical-align: 1px; }

.messages {
  position: relative; z-index: 1; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 2px;
}

.intro {
  align-self: center; width: 100%; max-width: 400px; margin: 6px auto 14px; padding: 22px 18px 18px;
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
  border-radius: 28px; background: var(--theirs); color: var(--theirs-text);
  border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
}
.intro-badge {
  width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; font-size: 34px;
  background: var(--mine); box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}
.intro h2 { margin: 0; font: 700 22px/1.2 var(--font); letter-spacing: -.4px; }
.intro-brief { margin: 0; font-size: 14px; line-height: 1.5; opacity: .82; }
.intro-people { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; font-weight: 600; font-size: 14px; }
.intro-amp { color: var(--room-accent); display: grid; }
.intro-amp .icon { fill: currentColor; }
.person { display: inline-flex; gap: 8px; align-items: center; }
.e2e-pill { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; opacity: .7; }
.intro.plain { padding: 10px 16px; border-radius: 999px; box-shadow: none; margin-top: 2px; }
.intro.plain .e2e-pill { opacity: .8; }

.day { align-self: center; margin: 14px 0 8px; }
.day span { font-size: 11px; font-weight: 600; letter-spacing: .3px; padding: 4px 12px; border-radius: 99px; background: rgba(127, 127, 127, .14); opacity: .85; }

.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 82%; margin-top: 10px; }
.msg.grouped { margin-top: 3px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar, .avatar-space { width: 30px; height: 30px; font-size: 17px; flex: none; }
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .msg-col { align-items: flex-end; }
.nick { font-size: 12px; font-weight: 600; opacity: .7; margin: 0 0 4px 14px; }
.bubble {
  position: relative; padding: 10px 14px 8px; border-radius: 22px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 15.5px; line-height: 1.45;
  background: var(--theirs); color: var(--theirs-text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .06);
  display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 10px;
}
.chat.themed .msg.theirs .bubble { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.msg.theirs:not(.grouped) .bubble { border-bottom-left-radius: 8px; }
.msg.theirs.grouped .bubble { border-top-left-radius: 10px; }
.msg.mine .bubble { background: var(--mine); color: var(--mine-text); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.msg.mine:not(.grouped) .bubble { border-bottom-right-radius: 8px; }
.msg.mine.grouped .bubble { border-top-right-radius: 10px; }
.bubble .time { font-size: 10.5px; opacity: .6; margin-left: auto; line-height: 1.7; font-variant-numeric: tabular-nums; }
.bubble.big { background: transparent !important; box-shadow: none; backdrop-filter: none; font-size: 48px; line-height: 1.1; padding: 0 2px; }
.bubble.big .time { font-size: 10.5px; color: var(--room-text); }
.bubble.has-photo { padding: 4px; }
.bubble.has-photo .time { position: absolute; right: 12px; bottom: 10px; color: #fff; opacity: .95; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.photo { display: block; max-width: min(260px, 62vw); max-height: 340px; border-radius: 18px; cursor: zoom-in; }

/* panel emoji & baki lampiran */
.emoji-panel, .attach-tray {
  position: relative; z-index: 2; margin: 0 10px 8px; border-radius: 24px;
  background: var(--room-bar); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(127, 127, 127, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  animation: pop .22s var(--ease);
}
.emoji-panel { padding: 8px 10px 10px; max-height: 240px; overflow-y: auto; }
.emoji-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; opacity: .6; margin: 8px 6px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 2px; }
.emoji-opt { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 8px 0; border-radius: 14px; transition: transform .12s var(--ease), background .15s; }
.emoji-opt:hover { background: rgba(127, 127, 127, .14); }
.emoji-opt:active { transform: scale(1.25); }
.attach-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.tray-btn {
  border: 0; background: transparent; color: var(--room-text); border-radius: 18px; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px;
}
.tray-btn small { font-size: 11px; opacity: .6; }
.tray-btn:active { background: rgba(127, 127, 127, .14); }
.tray-icon { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .15); }
.tray-image .tray-icon { background: linear-gradient(135deg, #a49bb8, #8a81a1); }
.tray-camera .tray-icon { background: linear-gradient(135deg, #c4a0a6, #a9808a); }
.tray-video .tray-icon { background: linear-gradient(135deg, #95aab8, #7b8fa0); }

/* kolom ketik: satu "pill" berisi lampiran, teks, emoji; tombol kirim bulat di kanan */
.composer {
  position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom)); background: var(--room-bar);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-top: 1px solid rgba(127, 127, 127, .14);
}
.composer-pill {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; min-height: 48px;
  border-radius: 26px; padding: 4px; background: #fff; border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: dark) { .chat.plain:not(.paletted) .composer-pill { background: var(--surface); border-color: var(--line); } }
.attach-btn, .emoji-btn {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center;
  transition: transform .2s var(--ease), background .2s;
}
.attach-btn { background: var(--rose-soft); color: var(--primary); }
.chat.themed .attach-btn, .chat.paletted .attach-btn { background: var(--mine); color: var(--mine-text); }
.attach-btn.open { transform: rotate(45deg); }
.emoji-btn { background: transparent; color: #8a8090; }
.composer-input {
  flex: 1; min-width: 0; resize: none; border: 0; background: transparent; padding: 10px 6px;
  font: 16px/1.4 var(--font); color: #1d1d1f; max-height: 140px; outline: none;
}
@media (prefers-color-scheme: dark) { .chat.plain:not(.paletted) .composer-input { color: var(--ink); } }
.composer-input::placeholder { color: #9a919c; }
.send-btn {
  width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--mine); color: var(--mine-text); box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
  transition: transform .18s var(--ease), opacity .2s, filter .2s;
}
.send-btn:disabled { opacity: .45; cursor: default; box-shadow: none; filter: saturate(.6); }
.send-btn:not(:disabled):active { transform: scale(.9); }
.send-btn .icon { margin-left: -2px; }

/* pop-up avatar */
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; display: inline-grid; cursor: zoom-in; }
.avatar-btn:active { transform: scale(.94); }
.avatar-pop-bg { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 24px; background: rgba(15, 8, 20, .55); backdrop-filter: blur(10px); animation: fade-in .2s; }
.avatar-pop-bg.closing { animation: fade-in .18s reverse forwards; }
.avatar-pop {
  /* Kira-kira 3/4 layar: foto/emoji memenuhi sebagian besar kartu. */
  position: relative; width: min(90vw, 560px); height: min(75dvh, 760px); padding: 12px 12px 18px; border-radius: 34px;
  display: flex; flex-direction: column; text-align: center;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); animation: pop .28s var(--ease);
}
.avatar-pop h3 { margin: 14px 0 2px; font: 600 26px var(--display); }
.avatar-pop p { margin: 0; }
.avatar-pop-close {
  position: absolute; top: 22px; right: 22px; z-index: 1; color: #fff;
  background: rgba(0, 0, 0, .32); backdrop-filter: blur(10px); border-radius: 50%;
}
.avatar-pop-img { flex: 1; min-height: 0; width: 100%; object-fit: cover; border-radius: 26px; display: block; box-shadow: 0 16px 40px rgba(0, 0, 0, .2); }
.avatar-pop-emoji {
  flex: 1; min-height: 0; width: 100%; border-radius: 26px; display: grid; place-items: center; font-size: clamp(120px, 42vw, 240px);
  background: radial-gradient(80% 80% at 30% 20%, #f3e4e8 0%, transparent 70%), linear-gradient(135deg, #e9dcea, #d9dbe8);
}

/* zona berbahaya */
.warn-box { padding: 14px 16px; border-radius: 18px; background: #fdecee; color: #8a1630; }
.warn-box p { margin: 6px 0 0; font-size: 14px; }
@media (prefers-color-scheme: dark) { .warn-box { background: #3a1520; color: #ffc9d3; } }
.danger-zone h3 { color: var(--danger); }

/* ---------- video & wallpaper ruang ---------- */
.video-card {
  position: relative; display: block; border: 0; padding: 0; border-radius: 18px; overflow: hidden;
  width: min(260px, 62vw); min-height: 150px; background: #1b1320; cursor: pointer;
}
.video-card img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.video-blank { display: block; height: 150px; background: linear-gradient(135deg, #3b1f4a, #1b1320); }
.video-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; padding-left: 4px; font-size: 22px; color: #fff;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); border: 2px solid rgba(255, 255, 255, .7);
}
.video-card.loading .video-play { animation: pulse 1s ease-in-out infinite; }
.video-meta { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 600; color: #fff; padding: 3px 8px; border-radius: 99px; background: rgba(0, 0, 0, .5); }
.video { display: block; width: min(280px, 66vw); max-height: 420px; border-radius: 18px; background: #000; }
.bubble.has-photo .video-card ~ .time, .bubble.has-photo .video ~ .time { bottom: auto; top: 10px; }
.chat.has-wall .day span, .chat.has-wall .nick { background: rgba(0, 0, 0, .38); color: #fff; opacity: 1; padding: 3px 10px; border-radius: 99px; }
.chat.has-wall .nick { display: inline-block; padding: 2px 8px; font-size: 11px; }
.chat.has-wall .intro h2, .chat.has-wall .intro-people { text-shadow: 0 1px 8px rgba(0, 0, 0, .45); }

/* pilihan palet warna */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.palette-opt {
  border: 3px solid transparent; border-radius: 20px; padding: 12px; min-height: 112px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; background: var(--room-bg); color: var(--room-text);
  box-shadow: var(--shadow); transition: transform .15s var(--ease);
}
.palette-opt:active { transform: scale(.97); }
.palette-opt.selected { border-color: var(--primary); }
.palette-opt b { margin-top: auto; font-size: 13px; }
.pal-bubble { font-size: 12px; padding: 5px 10px; border-radius: 12px; max-width: 80%; }
.pal-bubble.theirs { background: var(--theirs); color: var(--theirs-text); align-self: flex-start; border-bottom-left-radius: 4px; }
.pal-bubble.mine { background: var(--mine); color: var(--mine-text); align-self: flex-end; border-bottom-right-radius: 4px; }
.custom-pal { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); }
.custom-pal.selected { border-color: var(--primary); }

/* ---------- badge pesan baru ---------- */
.count-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: #d9534f; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 4px 10px rgba(217, 83, 79, .35); animation: pop .3s var(--ease);
}
.tab-badge {
  position: absolute; top: -7px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: #d9534f; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1;
  border: 2px solid var(--surface); animation: pop .3s var(--ease);
}
.shell[data-tab="home"] .tab-badge { border-color: rgba(0, 0, 0, .25); }
.room-flags { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; align-items: center; }
.room-flags .room-lock { position: static; }
.room-card.has-new { box-shadow: 0 0 0 2px rgba(217, 83, 79, .55), var(--shadow); }
.home-card .count-badge { position: absolute; top: -8px; right: -4px; }
.home-card:has(.count-badge) .home-card-time { display: none; }
.count-badge.star-count { gap: 2px; padding: 0 7px; }
.star-badge {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  color: #d9534f; background: #fff; font-size: 15px; line-height: 1;
  box-shadow: 0 0 0 1.5px rgba(217, 83, 79, .35), 0 4px 10px rgba(217, 83, 79, .25); animation: pop .3s var(--ease);
}
.push-prompt {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 0 16px 10px; padding: 12px 10px 12px 14px;
  border-radius: 20px; color: #fff; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25);
}
.push-prompt .home-card-text { flex: 1; }
.push-prompt .icon-btn { color: #fff; width: 32px; height: 32px; }

/* ---------- Truth or Dare ---------- */
/* Tombol roulette: hanya di ruang Truth or Dare. */
.tod-fab {
  position: absolute; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 3;
  width: 54px; height: 54px; border-radius: 50%; border: 3px solid #ffd36b; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #5a2266, #2a0c33); box-shadow: 0 10px 24px rgba(90, 20, 90, .45), 0 0 0 4px rgba(255, 211, 107, .25);
  animation: tod-bob 3.2s ease-in-out 3;
}
.tod-fab svg { animation: tod-idle-spin 8s linear infinite; }
.tod-fab:active { transform: scale(.92); }
@keyframes tod-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes tod-idle-spin { to { transform: rotate(360deg); } }

.tod-layer {
  position: absolute; inset: 0; z-index: 6; display: flex; align-items: flex-end;
  background: rgba(15, 4, 20, .55); animation: fade-in .2s;
}
.tod-layer.closing { animation: fade-in .22s reverse forwards; }
.tod-panel {
  position: relative; width: 100%; height: min(94%, 820px); overflow: hidden;
  display: flex; flex-direction: column;
  color: #fff; border-radius: 28px 28px 0 0; padding: 14px 16px 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .28) 0 1px, transparent 1.6px) 0 0 / 120px 120px,
    radial-gradient(120% 80% at 50% 0%, #6a2a8c 0%, #3a1257 45%, #1d0a2e 100%);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); animation: sheet-up .32s var(--ease); font-family: var(--font);
}
.tod-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tod-title { display: flex; flex-direction: column; }
.tod-title b { font: 600 22px var(--display); text-shadow: 0 2px 10px rgba(255, 120, 200, .45); }
.tod-title small { color: rgba(255, 255, 255, .72); font-size: 13px; }
.tod-x { color: #fff; }
.tod-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 0; flex: 1; }

/* Roda 3D */
.tod-wheel { position: relative; width: min(72vw, 290px, 42vh); aspect-ratio: 1; flex: none; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .45)); }
.tod-wheel-svg { width: 100%; height: 100%; display: block; }
.tod-rotor { transform-origin: 0 0; }
.tod-seg { transition: filter .3s; }
.tod-seg.hit { filter: brightness(1.25) saturate(1.2); animation: tod-hit .5s ease-in-out 4 alternate; }
@keyframes tod-hit { to { filter: brightness(1.55) saturate(1.4); } }
.tod-seg-emoji { font-size: 20px; }
.tod-seg-name { font: 800 10px var(--font); fill: #fff; paint-order: stroke; stroke: rgba(40, 10, 40, .55); stroke-width: 2.6px; letter-spacing: .3px; text-transform: uppercase; }
.tod-bulb { animation: tod-blink .9s steps(2) infinite; }
.tod-bulb:nth-child(odd) { animation-delay: .45s; }
.tod-wheel.spinning .tod-bulb { animation-duration: .22s; }
@keyframes tod-blink { 50% { opacity: .45; } }
.tod-needle {
  position: absolute; top: -12px; left: 50%; z-index: 2; width: 34px; height: 42px; transform: translateX(-50%);
  background: linear-gradient(160deg, #ff9ccc, #ff3d8b 55%, #c2185b); border-radius: 8px 8px 0 0;
  clip-path: polygon(50% 100%, 2% 22%, 14% 0, 86% 0, 98% 22%);
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .45)); transform-origin: 50% 18%;
}
.tod-needle::after { content: ""; position: absolute; left: 30%; top: 12%; width: 40%; height: 22%; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.tod-wheel.spinning .tod-needle { animation: tod-tick .1s ease-in-out infinite alternate; }
@keyframes tod-tick { from { transform: translateX(-50%) rotate(-12deg); } to { transform: translateX(-50%) rotate(8deg); } }
.tod-hub {
  position: absolute; top: 50%; left: 50%; width: 27%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; display: grid; place-items: center; border: 4px solid #ffd36b; padding: 0; cursor: pointer;
  font: 900 clamp(11px, 3.4vw, 15px) var(--font); color: #fff; letter-spacing: .5px; text-shadow: 0 2px 3px rgba(120, 0, 60, .6);
  background: radial-gradient(circle at 35% 28%, #ffd1ea 0%, #ff6fb1 30%, #e0257a 70%, #9c0f52 100%);
  box-shadow: inset 0 -6px 10px rgba(90, 0, 40, .45), inset 0 5px 8px rgba(255, 255, 255, .5), 0 6px 14px rgba(0, 0, 0, .45);
}
.tod-hub:active { transform: translate(-50%, -50%) scale(.95); }
.tod-wheel.spinning .tod-hub { animation: tod-hub-pulse .6s ease-in-out infinite alternate; }
@keyframes tod-hub-pulse { to { box-shadow: inset 0 -6px 10px rgba(90, 0, 40, .45), inset 0 5px 8px rgba(255, 255, 255, .5), 0 0 22px 6px rgba(255, 111, 177, .75); } }

.tod-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.tod-choices.nudge { animation: tod-nudge .5s ease-in-out; }
@keyframes tod-nudge { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.tod-choice {
  border: 0; border-radius: 20px; padding: 14px 10px; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .22), inset 0 3px 0 rgba(255, 255, 255, .25), 0 10px 20px rgba(0, 0, 0, .3);
  transition: transform .15s var(--ease), opacity .2s;
}
.tod-choice b { font: 700 24px var(--display); letter-spacing: .3px; text-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.tod-choice small { opacity: .9; font-size: 12px; }
.tod-choice.truth { background: linear-gradient(160deg, #a18bff, #6a4bf0 60%, #4b2fc4); }
.tod-choice.dare { background: linear-gradient(160deg, #ffb07a, #ff6a6a 55%, #e0306f); }
.tod-choice:active { transform: translateY(2px) scale(.97); }
.tod-choice:disabled { opacity: .5; }
.tod-note { margin: 0; color: rgba(255, 255, 255, .78); font-size: 13px; text-align: center; }
.spin-note { animation: pulse 1s ease-in-out infinite; }

.tod-card-area { width: 100%; display: flex; justify-content: center; }
.tod-card-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: pop .35s var(--ease); }
.tod-card { width: min(88%, 330px); min-height: 150px; border: 0; padding: 0; background: none; perspective: 1000px; cursor: pointer; }
.tod-card-inner { position: relative; width: 100%; min-height: 150px; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.3, 1.4, .5, 1); }
.tod-card.flipped .tod-card-inner { transform: rotateY(180deg); }
.tod-card.flipped { cursor: default; }
.tod-card-back, .tod-card-front {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px; text-align: center;
}
.tod-card-back {
  color: #fff; border: 3px solid #ffd36b; background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .2) 0 5px, transparent 6px) 0 0 / 26px 26px,
    linear-gradient(135deg, #ff3d8b, #8f3fd1 60%, #4b2fc4);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4), inset 0 0 0 3px rgba(255, 255, 255, .2);
}
.tod-card-back small { opacity: .9; font-size: 12px; }
.tod-q { font: 600 50px/1 var(--display); animation: beat 1.4s ease-in-out infinite; text-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.tod-card.opening .tod-card-inner { animation: tod-shake .9s ease-in-out; }
.tod-card.opening .tod-card-back { box-shadow: 0 0 0 4px #ffd36b, 0 0 40px rgba(255, 211, 107, .9); }
@keyframes tod-shake {
  0%, 100% { transform: none; } 15% { transform: rotate(-4deg) scale(1.03); } 30% { transform: rotate(4deg) scale(1.05); }
  45% { transform: rotate(-3deg) scale(1.06); } 60% { transform: rotate(3deg) scale(1.07); } 80% { transform: scale(1.08); }
}
.tod-card-front { transform: rotateY(180deg); background: #fff; color: #2b1a2c; box-shadow: 0 14px 30px rgba(0, 0, 0, .35); border: 4px solid #8f7bff; }
.tod-card-front.dare { border-color: #ff7a6a; }
.tod-card-front p { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; }
.tod-front-tag { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #8b7b88; }
/* Tombol aksi selalu terlihat di bawah panel (tidak terkubur). */
.tod-actions {
  position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; width: calc(100% + 32px);
  margin: 4px -16px 0; padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(29, 10, 46, 0), #1d0a2e 30%);
}
.tod-actions:empty { display: none; }
.tod-actions .btn { flex: 1; max-width: 200px; }
.tod-actions .btn.ghost { color: rgba(255, 255, 255, .85); border-color: rgba(255, 255, 255, .25); }
.tod-respond { background: linear-gradient(135deg, #ff6fb1, #e0257a) !important; color: #fff !important; border: 0 !important; box-shadow: 0 8px 18px rgba(224, 37, 122, .45); }

.tod-consent { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 4px 0 14px; padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); }
.tod-consent > span { display: flex; flex-direction: column; }
.tod-consent small { color: rgba(255, 255, 255, .7); font-size: 12px; }

.tod-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.tod-confetti i { position: absolute; top: 30%; width: 8px; height: 12px; border-radius: 2px; animation: tod-confetti 1.7s cubic-bezier(.2, .6, .3, 1) forwards; }
@keyframes tod-confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), 420px) rotate(var(--r)); opacity: 0; }
}

/* ruang Truth or Dare */
.tod-intro-icon { width: 76px; height: 76px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #5a2266, #2a0c33); border: 3px solid #ffd36b; }
.tod-badge { display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #5a2266, #2a0c33) !important; }
.room-card.tod-room { background: radial-gradient(120% 90% at 30% 0%, #6a2a8c, #2a0c33) !important; color: #fff; border: 2px solid rgba(255, 211, 107, .6); }
.room-card.tod-room .room-brief { color: rgba(255, 255, 255, .78); }

/* kartu permainan di chat */
.tod-msg { align-self: center; width: min(88%, 360px); margin: 8px 0; }
.tod-chatcard {
  width: 100%; border: 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px; border-radius: 18px; color: #2b1a2c; background: rgba(255, 255, 255, .94);
  box-shadow: 0 6px 18px rgba(60, 20, 60, .14); border-left: 5px solid #8f7bff;
}
.tod-chatcard.dare { border-left-color: #ff7a6a; }
.tod-chatcard.fresh { animation: tod-glow 1.6s ease-in-out infinite; }
@keyframes tod-glow { 50% { box-shadow: 0 0 0 3px rgba(255, 211, 107, .8), 0 6px 18px rgba(60, 20, 60, .14); } }
.tod-chat-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.tod-chat-head b { display: inline-flex; align-items: center; gap: 4px; }
.tod-chat-cat { color: #8b7b88; white-space: nowrap; }
.tod-chat-text { font-size: 15px; font-weight: 600; line-height: 1.4; }
.tod-chat-closed { color: #8b7b88; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.tod-chat-result { font-size: 12px; font-weight: 700; color: var(--ok); }
.tod-chat-result.skip { color: #c2185b; }

/* hapus pesan: pilih beberapa */
.select-bar {
  position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.select-bar[hidden] { display: none; }
.messages [data-mid] { -webkit-touch-callout: none; }
.chat .selected { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 18px; background: rgba(234, 111, 143, .12); }

/* editor kartu (admin) */
.tod-editor > .muted { padding: 0 18px; }
.tod-cat { margin: 0 16px 12px; }
.tod-cat summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; padding: 6px 0; }
.tod-cat summary small { color: var(--muted); font-weight: 500; }
.tod-cat .field { margin-top: 10px; }
.tod-cat-row { display: flex; gap: 10px; }
.tod-cat-row .grow { flex: 1; }
.tod-emoji-in { width: 70px; text-align: center; }
.tod-editor > .btn { margin: 6px 16px; width: calc(100% - 32px); }
.danger-text { color: var(--danger); }
.menu-emoji { width: 20px; text-align: center; font-size: 17px; }
@media (prefers-reduced-motion: reduce) { .tod-fab, .tod-fab svg, .tod-q, .tod-bulb { animation: none; } }
.btn.ghost.danger-text { color: var(--danger); }
.recovery-prompt { width: calc(100% - 32px); border: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.onboard.unlock .stack { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.onboard.unlock textarea { resize: none; }
.recovery-chip { display: block; white-space: normal; line-height: 1.4; padding: 8px 12px; }
.unlock-reset { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 360px; }

/* Panel game: ukuran tetap, isi berganti dengan memudar; tutup dengan turun halus. */
.tod-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.tod-fade { animation: tod-fade .3s ease both; }
@keyframes tod-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tod-layer.closing { animation: fade-in .28s ease reverse forwards; }
.tod-layer.closing .tod-panel { animation: tod-down .28s ease-in forwards; }
@keyframes tod-down { to { transform: translateY(105%); } }
.tod-mode {
  align-self: center; padding: 6px 22px; border-radius: 999px; font: 900 20px/1.2 var(--font); letter-spacing: 2px; color: #fff;
  border: 2px solid rgba(255, 255, 255, .7); text-shadow: 0 2px 6px rgba(0, 0, 0, .35); animation: pop .35s var(--ease);
}
.tod-mode.truth { background: linear-gradient(135deg, #a18bff, #5a3fd8); box-shadow: 0 0 22px rgba(143, 123, 255, .75); }
.tod-mode.dare { background: linear-gradient(135deg, #ffb07a, #e0306f); box-shadow: 0 0 22px rgba(255, 106, 106, .75); }
.tod-wheel.mode-truth { filter: drop-shadow(0 0 18px rgba(143, 123, 255, .7)) drop-shadow(0 16px 24px rgba(0, 0, 0, .45)); }
.tod-wheel.mode-dare { filter: drop-shadow(0 0 18px rgba(255, 106, 106, .7)) drop-shadow(0 16px 24px rgba(0, 0, 0, .45)); }
.tod-wheel { width: min(70vw, 280px, 36vh); }
.tod-fab { touch-action: none; transition: transform .2s var(--ease), box-shadow .2s; }
.tod-fab.dragging { transform: scale(1.12); box-shadow: 0 16px 30px rgba(90, 20, 90, .55), 0 0 0 6px rgba(255, 211, 107, .35); animation: none; cursor: grabbing; }
.btn, .tod-choice, .tod-hub, .menu-item, .icon-btn { transition: transform .18s var(--ease), opacity .2s, background .2s, box-shadow .2s; }
.lightbox-del { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
.photo { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.avatar-upload { width: 100%; justify-content: center; padding: 14px; font-size: 16px; font-weight: 700; margin: 8px 0 12px; border: 2px dashed var(--primary-2); background: var(--rose-soft); color: var(--primary); }
.sheet-bg { z-index: 80; }
.tod-card-area { flex: 1; }
.tod-card-wrap { min-height: 100%; }
.tod-actions { margin-top: auto; }
.tod-stage > .tod-consent { margin-top: auto; }
/* Beranda: kartu chat terakhir di atas, lalu 3 petak: Truth or Dare · Wallpaper · Ruang. */
.home-cards { grid-template-columns: 1fr; }
.home-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.home-card.tile { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
.home-card.tile .home-card-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.home-card.tile .home-card-text span { font-size: 12px; }
.page.rooms .page-head { display: flex; align-items: center; gap: 8px; }
.rooms-back { flex: none; }
@media (max-width: 360px) { .home-tiles { grid-template-columns: repeat(3, 1fr); } }
/* Foto sampul ruang & pemilih ikon */
.room-cover { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.room-emoji.has-cover { width: 76px; height: 76px; padding: 0; overflow: hidden; border-radius: 20px; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.room-badge .room-cover, .intro-badge .room-cover { border-radius: inherit; }
.intro-badge:has(.room-cover) { overflow: hidden; padding: 0; }
.room-badge:has(.room-cover) { overflow: hidden; padding: 0; }
.room-icon-head { display: flex; align-items: center; gap: 12px; }
.room-icon-head .stack { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.room-icon-preview { width: 76px; height: 76px; flex: none; border-radius: 20px; display: grid; place-items: center; font-size: 40px; background: var(--surface-2); overflow: hidden; }
.room-icon-grid { max-height: 168px; overflow-y: auto; margin-top: 10px; }
.avatar-opt.selected { outline: 3px solid var(--primary-2); outline-offset: 1px; }
.pin-reveal { font: 700 34px var(--font); letter-spacing: 8px; text-align: center; margin: 8px 0 16px; }

/* ---------- Studio wallpaper beranda ---------- */
.home-wall { overflow: hidden; }
.wall-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease; transform: scale(1.04); }
.wall-slide.on { opacity: 1; animation: wall-kb 14s ease-in-out infinite alternate; }
@keyframes wall-kb { from { transform: scale(1.04); } to { transform: scale(1.12) translate(-1%, -1%); } }
.wall-stickers { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.wall-sticker { position: absolute; transform: translate(-50%, -50%); line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .3)); user-select: none; }
.home-center { transform: translateY(var(--text-y, 0)) scale(var(--text-scale, 1)); transition: transform .35s var(--ease); }
.home-couple { transform: scale(var(--avatar-scale, 1)); transition: transform .35s var(--ease); }
.home-center.no-avatars .home-couple { display: none; }

/* animasi */
.fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.fx i { position: absolute; left: var(--x); display: block; font-style: normal; }
.fx-glitter i { top: var(--y); width: var(--s); height: var(--s); background: #fff; border-radius: 50%; box-shadow: 0 0 6px 2px rgba(255, 240, 200, .9); animation: fx-twinkle var(--t) ease-in-out infinite; animation-delay: calc(var(--d) * -4s); }
@keyframes fx-twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1.2); } }
.fx-snow i { top: -10px; width: var(--s); height: var(--s); background: #fff; border-radius: 50%; opacity: .9; animation: fx-fall var(--t) linear infinite; animation-delay: calc(var(--d) * -16s); }
@keyframes fx-fall { to { transform: translate(var(--sway), 110vh); } }
.fx-rain i { top: -30px; width: 1.5px; height: var(--h); background: linear-gradient(transparent, rgba(220, 235, 255, .85)); animation: fx-rain var(--t) linear infinite; animation-delay: calc(var(--d) * -1.2s); }
@keyframes fx-rain { to { transform: translate(-40px, 110vh); } }
.fx-clouds i { top: var(--y); left: -40%; width: var(--s); height: calc(var(--s) * .45); border-radius: 50%; background: rgba(255, 255, 255, .55); filter: blur(18px); animation: fx-drift var(--t) linear infinite; animation-delay: calc(var(--d) * -80s); }
@keyframes fx-drift { to { transform: translateX(180vw); } }
.fx-embers::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: radial-gradient(70% 100% at 50% 100%, rgba(255, 120, 40, .45), transparent 70%); animation: fx-glow 3s ease-in-out infinite alternate; }
@keyframes fx-glow { to { opacity: .6; } }
.fx-embers i { bottom: -10px; width: var(--s); height: var(--s); border-radius: 50%; background: radial-gradient(circle, #fff3c4, #ff9a3c 45%, rgba(255, 80, 20, 0) 70%); animation: fx-rise var(--t) ease-in infinite; animation-delay: calc(var(--d) * -9s); }
@keyframes fx-rise { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--sway), -55vh); opacity: 0; } }
.fx-hearts i { bottom: -40px; font-size: var(--s); animation: fx-float var(--t) ease-in-out infinite; animation-delay: calc(var(--d) * -16s); opacity: .85; }
@keyframes fx-float { 0% { transform: translate(0, 0) rotate(-10deg); opacity: 0; } 15% { opacity: .9; } 100% { transform: translate(var(--sway), -110vh) rotate(12deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fx i, .wall-slide.on { animation: none !important; } }

/* panel studio: ukuran sama dengan panel roda */
.studio-layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; background: rgba(15, 4, 20, .5); animation: fade-in .2s; }
.studio-layer.closing { animation: fade-in .28s ease reverse forwards; }
.studio-layer.closing .studio-panel { animation: tod-down .28s ease-in forwards; }
.studio-panel {
  width: 100%; height: min(94%, 820px); display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0; padding: 14px 16px 0;
  box-shadow: var(--shadow-lg); animation: sheet-up .32s var(--ease); font-family: var(--font);
}
.studio-top { display: flex; align-items: center; justify-content: space-between; }
.studio-top b { font: 600 21px var(--display); }
.studio-preview { position: relative; align-self: center; height: min(32vh, 290px); aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); flex: none; touch-action: none; }
.studio-wall { position: absolute; inset: 0; background-size: cover !important; background-position: center !important; }
.studio-wall .wall-sticker { pointer-events: auto; cursor: grab; padding: 4px; }
.studio-wall .wall-sticker.selected { outline: 2px dashed #fff; border-radius: 8px; }
.studio-wall .fx i { transform-origin: center; }
.studio-mock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); pointer-events: none; z-index: 2; transform: translateY(var(--text-y, 0)) scale(var(--text-scale, 1)); transition: transform .3s var(--ease); }
.studio-mock .mock-avatars { display: flex; align-items: center; gap: 2px; font-size: 22px; transform: scale(var(--avatar-scale, 1)); transition: transform .3s; }
.studio-mock.no-avatars .mock-avatars { display: none; }
.mock-heart { font-size: 12px; color: #ff6f9f; }
.mock-days { font: 600 30px var(--display); line-height: 1; }
.studio-mock small { font-size: 10px; }
.studio-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: none; }
.studio-tab { border: 0; border-radius: 12px; padding: 9px 4px; font: 600 12px var(--font); background: var(--surface-2); color: var(--ink); }
.studio-tab.on { background: var(--primary); color: #fff; }
.studio-body { flex: 1; min-height: 0; overflow-y: auto; }
.studio-pane { display: flex; flex-direction: column; gap: 12px; animation: tod-fade .25s ease both; }
.studio-hint { margin: 0; color: var(--muted); font-size: 13px; }
.studio-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.studio-slot { position: relative; aspect-ratio: 9 / 16; border-radius: 14px; border: 2px dashed var(--line); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); background-size: cover; background-position: center; }
.studio-slot.filled { border: 0; box-shadow: var(--shadow); }
.studio-slot:disabled { opacity: .4; }
.slot-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.slot-edit { position: absolute; bottom: 4px; left: 4px; right: 4px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 11px; padding: 4px; }
.studio-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.studio-chips .chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: 600 12px var(--font); color: var(--ink); }
.studio-chips .chip.on { background: var(--primary); color: #fff; border-color: transparent; }
.studio-fx { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fx-opt { border: 2px solid var(--line); border-radius: 16px; background: var(--surface-2); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); }
.fx-opt span { font-size: 24px; }
.fx-opt small { font: 600 11px var(--font); }
.fx-opt.on { border-color: var(--primary-2); background: var(--rose-soft); }
.studio-slider { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.studio-slider input { width: 100%; accent-color: var(--primary-2); }
.studio-switch { padding: 10px 14px; }
.studio-stickers { max-height: 150px; overflow-y: auto; }
.studio-selected { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.studio-foot { flex: none; padding: 10px 0 max(14px, env(safe-area-inset-bottom)); }

/* potong foto */
.crop-layer { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; padding: 12px; animation: fade-in .2s; }
.crop-panel { width: min(100%, 420px); background: var(--surface); color: var(--ink); border-radius: 24px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.crop-frame { position: relative; align-self: center; height: min(56vh, 520px); aspect-ratio: 9 / 16; overflow: hidden; border-radius: 16px; background: #111; touch-action: none; cursor: grab; }
.crop-frame img { position: absolute; top: 0; left: 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.crop-grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(90deg, transparent calc(33.3% - .5px), rgba(255, 255, 255, .35) 33.3%, transparent calc(33.3% + .5px), transparent calc(66.6% - .5px), rgba(255, 255, 255, .35) 66.6%, transparent calc(66.6% + .5px)),
  linear-gradient(transparent calc(33.3% - .5px), rgba(255, 255, 255, .35) 33.3%, transparent calc(33.3% + .5px), transparent calc(66.6% - .5px), rgba(255, 255, 255, .35) 66.6%, transparent calc(66.6% + .5px)); }
/* Panduan giliran besar di panel Truth or Dare */
.tod-guide {
  margin: 8px 0 4px; padding: 10px 14px; border-radius: 16px; text-align: center;
  font: 800 17px/1.3 var(--font); letter-spacing: .2px; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  animation: tod-fade .3s ease both;
}
.tod-guide.me { background: linear-gradient(135deg, #ff6fb1, #e0257a); border-color: #ffd36b; box-shadow: 0 0 18px rgba(255, 111, 177, .55); animation: tod-fade .3s ease both, tod-guide-pulse 1.6s ease-in-out .3s infinite; }
.tod-guide b.tod-guide-name { display: block; font: 900 30px/1.1 var(--font); letter-spacing: .5px; text-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.tod-guide span { display: block; margin-top: 3px; font-size: 15px; font-weight: 700; }
.tod-card.locked { cursor: default; }
.tod-card.locked .tod-card-back { opacity: .85; }
.tod-guide.wait { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .9); }
.tod-guide.done { background: linear-gradient(135deg, #5fd68b, #22a65a); }
@keyframes tod-guide-pulse { 50% { box-shadow: 0 0 28px rgba(255, 111, 177, .85); } }
.tod-wheel { width: min(66vw, 260px, 32vh); }

/* Truth or Dare v3: roda jadi bintang saat berputar, kartu jadi bintang setelahnya; panduan di zona aksi. */
.sheet-bg.closing, .overlay.closing, .tod-layer.closing, .studio-layer.closing { pointer-events: none; }
.tod-body { overflow: hidden; }
.tod-title small.tod-by { font: 800 16px var(--font); color: #fff; letter-spacing: .2px; }
.tod-title small.tod-by.truth { color: #cfc4ff; }
.tod-title small.tod-by.dare { color: #ffc2a8; }
.tod-stage { gap: 10px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.tod-wheel { transition: width .55s var(--ease), opacity .45s ease, margin .55s var(--ease); }
.tod-stage.carded .tod-wheel { width: 0; opacity: 0; margin: -5px 0; }
.tod-stage.game .tod-card-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.tod-stage.game .tod-card-wrap { min-height: 0; justify-content: center; }
.tod-card, .tod-card-inner { transition: min-height .55s var(--ease), width .55s var(--ease), transform .75s cubic-bezier(.3, 1.4, .5, 1); }
.tod-stage.carded .tod-card { width: min(94%, 380px); min-height: min(44vh, 340px); }
.tod-stage.carded .tod-card-inner { min-height: min(44vh, 340px); }
.tod-stage.carded .tod-q { font-size: 88px; }
.tod-stage.carded .tod-card-back b { font-size: 20px; }
.tod-stage.carded .tod-card-front p { font-size: clamp(19px, 5.4vw, 24px); line-height: 1.35; }
.tod-stage.carded .tod-front-tag { font-size: 13px; }
.tod-card.locked { opacity: 1; }
.tod-card.locked .tod-card-back { filter: saturate(.75) brightness(.85); }
.tod-guide { width: 100%; margin: 0; padding: 10px 14px; }
.tod-guide b.tod-guide-name { font: 900 clamp(21px, 6.4vw, 28px)/1.15 var(--font); }
.tod-guide span { font-size: 14px; }
.tod-actions { position: static; width: 100%; margin: 0; padding: 0; background: none; flex-wrap: nowrap; gap: 10px; }
.tod-actions .btn { flex: 1 1 0; max-width: none; min-width: 0; white-space: nowrap; padding: 13px 8px; font-size: clamp(13px, 3.8vw, 15px); }
.tod-stage > .tod-consent { margin: auto 0 0; padding: 8px 14px; }
.tod-fab-label {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  padding: 3px 10px; border-radius: 999px; font: 800 12px var(--font); color: #fff; background: rgba(42, 12, 51, .88);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
}
.tod-fab svg { pointer-events: none; }
.tod-fab.waiting { filter: grayscale(.85) brightness(.9); animation: none; }
.tod-fab.waiting svg { animation: none; }
.tod-fab.waiting .tod-fab-label { background: rgba(90, 80, 95, .9); }
.tod-fab.nope { animation: tod-nudge .45s ease-in-out; }
.tod-stage.game:not(.carded) .tod-wheel { width: min(84vw, 330px, 44vh); }
.tod-stage.game:not(.carded) .tod-card-area { flex: 1; }
/* Beranda: menu ringkas tanpa kotak (ikon bulat + label satu baris). */
.home-quicks {
  position: relative; display: flex; justify-content: center; gap: clamp(18px, 8vw, 40px);
  padding: 4px 16px calc(var(--tabbar-h) + max(22px, env(safe-area-inset-bottom)));
}
.home-quick { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: #fff; cursor: pointer; font: inherit; }
.home-quick-icon { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.home-quick-icon .count-badge { position: absolute; top: -4px; right: -6px; }
.home-quick-label { font-size: 12.5px; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.home-quick:active .home-quick-icon { transform: scale(.92); }
/* Pemilih avatar & ikon ruang: pratinjau + unggah satu baris, emoji di strip geser horizontal (rapi, tidak terpotong). */
.avatar-picker { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.avatar-pick-head { display: flex; align-items: center; gap: 12px; }
.avatar-pick-head .avatar-upload { flex: 1; margin: 0; }
.avatar-picker .avatar-grid, .room-icon-grid {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, 44px); grid-auto-columns: 44px; gap: 6px;
  max-height: none; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 8px; margin-top: 0; scrollbar-width: thin;
}
.room-icon-picker { display: flex; flex-direction: column; gap: 10px; }
.avatar-picker .avatar-opt, .room-icon-grid .avatar-opt { width: 44px; height: 44px; }
/* Stiker: × untuk menghapus (di pratinjau studio) & daftar stiker terpasang. */
.sticker-del {
  position: absolute; top: -6px; right: -8px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: 800 14px/1 var(--font); color: #fff; background: #e0306f; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); cursor: pointer;
}
.studio-placed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.studio-placed-label { font-size: 12px; font-weight: 700; opacity: .75; margin-right: 2px; }
.studio-placed-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; }
.studio-placed-chip b { font-size: 13px; color: #e0306f; }
.studio-placed-chip.on { border-color: #e0306f; }
/* Kartu ruang berfoto: foto penuh, judul di atas foto. */
.room-card.photo-card { overflow: hidden; justify-content: flex-end; background: #2a1a24 !important; color: #fff; }
.room-card-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.room-card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .25) 60%, rgba(0, 0, 0, .78)); }
.room-card.photo-card .room-name { position: relative; z-index: 1; color: #fff; font-size: 18px; text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
.room-card.photo-card .room-flags { z-index: 1; }
.room-card.photo-card .room-lock { background: rgba(0, 0, 0, .4); color: #fff; }
/* Label roulette tidak boleh keluar layar: rata kanan saat tombol di kanan (bawaan), rata kiri saat di kiri. */
.tod-fab .tod-fab-label { left: auto; right: -6px; transform: none; }
.tod-fab.on-left .tod-fab-label { left: -6px; right: auto; }
