:root {
  --ink: #3a2418; --paper: rgba(255, 248, 242, .96); --accent: #e9774a; --shadow: 0 18px 50px rgba(90, 35, 10, .28);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #e7a67c; }
canvas { display: block; cursor: grab; touch-action: none; }

#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #f0b98f; color: #5a2c14;
           font-size: 15px; letter-spacing: .04em; transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }

.hover-tip { position: fixed; left: 0; top: 0; z-index: 30; display: flex; flex-direction: column; gap: 1px; padding: 6px 12px 7px; border-radius: 12px;
             pointer-events: none; background: rgba(255, 248, 242, .9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
             color: var(--ink); box-shadow: 0 6px 18px rgba(90, 35, 10, .18); border: 1px solid rgba(233, 119, 74, .25);
             opacity: 0; transition: opacity .15s; }
.hover-tip b { font-size: 13px; font-weight: 600; }
.hover-tip small { font-size: 11px; opacity: .65; }
.hover-tip.show { opacity: 1; }

.back-btn { position: fixed; left: 50%; bottom: 28px; z-index: 25; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
            border: 0; border-radius: 99px; padding: 11px 22px; font-size: 15px; cursor: pointer; color: var(--ink);
            background: var(--paper); box-shadow: var(--shadow); transition: .3s; }
.back-btn.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

.toast { position: fixed; left: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px;
         max-width: min(340px, calc(100vw - 32px)); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
         font-size: 14px; opacity: 0; transform: translateY(10px); transition: .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* ---------------- welcome pop-up (glass, salmon) */
.welcome-modal .modal-backdrop { background: rgba(120, 50, 25, .22); backdrop-filter: blur(3px); }
.welcome-modal .modal-card { width: min(520px, calc(100vw - 28px)); background: rgba(255, 238, 226, .78); backdrop-filter: blur(18px) saturate(1.2);
                             border: 1px solid rgba(255, 255, 255, .6); border-radius: 22px; }
.wl { padding: 6px 4px 2px; }
.wl-eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: #a5563a; }
.wl h2 { margin: 0 0 12px; font-family: Georgia, serif; font-style: italic; font-weight: 400; font-size: clamp(26px, 6vw, 34px); color: #5a2a16; }
.wl p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; color: #5b3a2c; }
.wl-cta { font-weight: 600; color: #a24a27 !important; }
.wl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.wl-actions button { min-height: 46px; padding: 0 20px; border-radius: 99px; font-size: 15px; cursor: pointer; }
.wl-primary { border: 0; background: #b9562f; color: #fff7f1; font-weight: 600; box-shadow: 0 10px 24px rgba(150, 60, 25, .28); }
.wl-primary:hover { background: #a84a26; }
.wl-secondary { border: 1px solid rgba(165, 86, 58, .45); background: transparent; color: #8a4326; }
@media (max-width: 480px) { .wl-actions button { flex: 1 1 100%; } }

/* monitor hint after "Mostrar o computador" */
.focus-hint { position: fixed; left: 0; top: 0; z-index: 35; pointer-events: none; transition: opacity .4s; }
.focus-hint.out { opacity: 0; }
.fh-ring { position: absolute; left: -46px; top: -46px; width: 92px; height: 92px; border-radius: 50%; border: 2px solid #fff;
           box-shadow: 0 0 0 4px rgba(233, 130, 92, .55), 0 0 30px rgba(255, 190, 150, .9); animation: fhPulse 1.4s ease-in-out infinite; }
.fh-label { position: absolute; left: 0; top: 58px; transform: translateX(-50%); white-space: nowrap; padding: 8px 14px; border-radius: 99px;
            background: #b9562f; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 8px 20px rgba(120, 50, 20, .3); }
@keyframes fhPulse { 50% { transform: scale(1.18); opacity: .7; } }

/* ---------------- modal manager */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 18, 8, .38); opacity: 0; transition: opacity .3s; }
.modal.floating .modal-backdrop { background: transparent; }
.modal-card { position: relative; max-width: min(92vw, 860px); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; border-radius: 18px; background: var(--paper);
              color: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(14px) scale(.97); transition: .3s cubic-bezier(.2,.8,.2,1); }
.modal.floating { place-items: end end; padding: 20px; }
.modal.open .modal-backdrop { opacity: 1; }
.modal.open .modal-card { opacity: 1; transform: none; }
.modal-close { position: absolute; top: 8px; right: 10px; z-index: 2; width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer;
               font-size: 22px; line-height: 1; color: inherit; background: rgba(0,0,0,.06); }
.modal-close:hover { background: rgba(0,0,0,.12); }
.modal-body { padding: 22px; }
@media (max-width: 640px) {
  .modal.floating { place-items: end center; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .modal-body { padding: 18px 16px; }
  .modal-close { width: 40px; height: 40px; }
  .back-btn { bottom: calc(18px + env(safe-area-inset-bottom)); min-height: 46px; }
  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; }
}

/* ---------------- panels */
.pnl { width: min(320px, 84vw); }
.pnl h3 { margin: 0 0 12px; font-size: 18px; }
.pnl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 6px; font-size: 14px; }
.pnl input[type=range] { width: 100%; accent-color: var(--accent); }
.pnl input[type=color] { width: 44px; height: 30px; border: 0; background: none; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sw { display: flex; align-items: center; gap: 6px; padding: 5px 9px 5px 6px; border: 1px solid rgba(0,0,0,.1); border-radius: 99px; background: #fff;
      font-size: 12px; cursor: pointer; color: inherit; }
.sw i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.sw:hover { border-color: var(--accent); }
.oil-now { margin: 0 0 10px; font-size: 14px; }
.oils { display: grid; gap: 6px; }
.oil { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 8px 10px; border: 1px solid rgba(0,0,0,.08); border-radius: 12px;
       background: #fff; cursor: pointer; color: inherit; transition: .15s; }
.oil i { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--c)); }
.oil span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.oil small { opacity: .7; }
.oil.sel { border-color: var(--c); box-shadow: 0 0 0 2px var(--c); }
.toggle { justify-content: flex-start; }
.pnl-fine { font-size: 11px; opacity: .6; margin: 8px 0 0; }

/* ---------------- Etapa 9: lamp + clock panels (glass card; the room stays visible so the light change can be seen) */
.lamp-modal .modal-backdrop, .clock-modal .modal-backdrop { background: transparent; backdrop-filter: none; }
.lamp-modal .modal-card, .clock-modal .modal-card { background: rgba(255, 244, 236, .82); backdrop-filter: blur(16px) saturate(1.15); -webkit-backdrop-filter: blur(16px) saturate(1.15); }
.pnl-sub { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.pnl-sub output { text-transform: none; letter-spacing: 0; font-weight: 500; }
.sw.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(233, 130, 92, .35); }
.sw-custom { position: relative; }
.sw-custom input[type=color] { width: 18px; height: 18px; padding: 0; border-radius: 50%; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { min-height: 34px; padding: 0 11px; border: 1px solid rgba(0,0,0,.1); border-radius: 99px; background: #fff; color: inherit; font-size: 12px; cursor: pointer; }
.chip small { opacity: .55; margin-left: 2px; }
.chip:hover { border-color: var(--accent); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.sel small { opacity: .85; }
.clk-now { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 10px; }
.clk-time { font-size: 42px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clk-phase { font-size: 13px; opacity: .7; }
.clk-steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.clk-steppers div { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.clk-steppers span { flex: 1; opacity: .75; }
.clk-steppers button { width: 38px; height: 38px; border: 1px solid rgba(0,0,0,.1); border-radius: 12px; background: #fff; font-size: 18px; cursor: pointer; color: inherit; }
.gl-block { margin: 0 0 14px; padding: 2px 12px 10px; border-radius: 14px; background: rgba(233, 130, 92, .10); border: 1px solid rgba(233, 130, 92, .22); }
.gl-block .pnl-sub { margin-top: 10px; }
.lamp-modal .gl-block { margin-right: 34px; }
.gl-sw { margin-top: 10px; }
.sw-orig i { background: conic-gradient(#ffb46b, #ff8a3d, #ffd34d, #ffb46b); }
.lamp-sub { margin-top: 4px; }          /* keeps the % clear of the close button */
.clock-modal .gl-block { margin: 14px 0 0; }
.pnl input[type=range]:disabled { opacity: .4; }
.clk-scale { display: flex; justify-content: space-between; font-size: 10px; opacity: .5; margin-top: 2px; }
@media (max-width: 640px) {
  .lamp-modal .modal-card, .clock-modal .modal-card { width: 100%; max-width: none; max-height: 52dvh; border-radius: 20px 20px 16px 16px; }
  .lamp-modal .pnl, .clock-modal .pnl { width: 100%; }
  .chip { min-height: 40px; }
  .clk-time { font-size: 34px; }
}

.note-modal .modal-card { background: none; box-shadow: none; overflow: visible; }
.note-modal .modal-close { top: -6px; right: -6px; background: #fff; }
.postit { width: 240px; padding: 28px 24px; transform: rotate(-3deg); background: linear-gradient(#ffd9a0 0 14%, #ffcc80 14%);
          box-shadow: 0 14px 30px rgba(80,40,0,.3); font-family: "Segoe Print", "Comic Sans MS", cursive; color: #3a3036; }
.postit-text { font-size: 24px; margin: 0 0 12px; }
.postit-hint { font-size: 13px; margin: 0; opacity: .8; }

/* ---------------- spotify */
.spotify-modal .modal-card { background: #121212; color: #fff; }
.spotify-modal .modal-close { background: rgba(255,255,255,.1); color: #fff; }
.sp { width: min(340px, 86vw); }
.sp-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 14px; }
.sp-now { display: flex; gap: 14px; align-items: center; }
.sp-cover { width: 84px; height: 84px; flex: none; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #e9774a, #8e2de2); box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.sp-cover img { width: 100%; height: 100%; object-fit: cover; }
.sp-cover-ph { display: grid; place-items: center; height: 100%; font-size: 36px; }
.sp-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-meta span { color: #b3b3b3; font-size: 14px; }
.sp-embed { border-radius: 12px; overflow: hidden; min-height: 152px; }
.sp-note { font-size: 11px; color: #b3b3b3; margin: 6px 0 0; }
.sp-bar { display: flex; align-items: center; gap: 8px; margin: 16px 0 10px; font-size: 11px; color: #b3b3b3; }
.sp-track { flex: 1; height: 4px; border-radius: 4px; background: #4d4d4d; cursor: pointer; }
.sp-fill { height: 100%; width: 0; border-radius: 4px; background: #1DB954; }
.sp-ctrls { display: flex; align-items: center; justify-content: center; gap: 18px; position: relative; }
.sp-play { width: 48px; height: 48px; border: 0; border-radius: 50%; background: #fff; color: #000; font-size: 16px; cursor: pointer; transition: transform .1s; }
.sp-play:hover { transform: scale(1.06); }
.sp-vol { position: absolute; right: 0; display: flex; align-items: center; gap: 4px; font-size: 14px; }
.sp-vol input { width: 80px; accent-color: #1DB954; }
.sp-err { color: #ffb4a0; font-size: 12px; margin: 10px 0 0; min-height: 1em; }

/* ---------------- instagram */
.ig-modal .modal-card { border-radius: 28px; }
.ig { width: min(360px, 86vw); color: #111; }
.ig-top { display: flex; justify-content: space-between; align-items: center; margin: 2px 30px 14px 0; font-size: 17px; }
.ig-logo { font-family: "Segoe Script", cursive; font-size: 18px; background: linear-gradient(90deg, #f58529, #dd2a7b, #8134af); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ig-profile { display: flex; gap: 16px; align-items: center; }
.ig-avatar { flex: none; width: 76px; height: 76px; border-radius: 50%; padding: 3px; background: conic-gradient(#f58529, #dd2a7b, #8134af, #515bd4, #f58529); }
.ig-avatar::before, .ig-avatar img { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; box-sizing: border-box; background: #e9ddd3; object-fit: cover; }
.ig-avatar img + * { display: none; }
.ig-avatar:has(img)::before { display: none; }
.ig-info p { margin: 4px 0 0; font-size: 13px; color: #555; }
.ig-open { display: block; margin: 16px 0 12px; padding: 9px; border-radius: 10px; text-align: center; font-weight: 600; font-size: 14px;
           text-decoration: none; color: #fff; background: #0095f6; }
.ig-open.disabled { background: #efefef; color: #777; font-weight: 400; font-size: 12px; cursor: default; }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.ig-tile { aspect-ratio: 1; background: center / cover; }
.ig-tile.ph { background: linear-gradient(135deg, hsl(calc(var(--h) * 1deg) 85% 78%), hsl(calc(var(--h) * 1deg + 10deg) 70% 62%)); }
.ig-note { font-size: 11px; color: #888; margin: 10px 0 0; }

/* ---------------- gallery */
.gallery-modal .modal-card { width: min(92vw, 900px); }
.gal h2 { margin: 0 0 14px; font-size: 20px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gal-item { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; cursor: zoom-in; background: #eee;
            animation: galIn .4s both; animation-delay: var(--d); }
.gal-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gal-item:hover img { transform: scale(1.05); }
.gal-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; color: #fff; text-align: left;
                 background: linear-gradient(transparent, rgba(0,0,0,.55)); }
@keyframes galIn { from { opacity: 0; transform: translateY(8px); } }
.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 12px;
            background: rgba(20, 10, 5, .9); opacity: 0; transition: opacity .25s; }
.lightbox.open { opacity: 1; }
.lightbox figure { margin: 0; max-width: min(84vw, 1200px); text-align: center; color: #fff; }
.lightbox img { max-width: 100%; max-height: 76vh; border-radius: 8px; opacity: 0; transform: scale(.98); transition: .3s; }
.lightbox img.in { opacity: 1; transform: none; }
.lightbox figcaption { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; font-size: 14px; }
.lightbox figcaption span { opacity: .8; } .lightbox figcaption em { opacity: .55; font-size: 12px; }
.lightbox button { border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; border-radius: 50%; }
.lb-prev, .lb-next { width: 46px; height: 46px; font-size: 28px; flex: none; }
.lb-x { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; font-size: 24px; }
.lightbox button:hover { background: rgba(255,255,255,.25); }
@media (max-width: 640px) { .lb-prev, .lb-next { position: absolute; bottom: 20px; } .lb-prev { left: 20px; } .lb-next { right: 20px; } }
