/* "PC pessoal da Duda" -----------------------------------------------------------------
   Desktop/tablet: a 16:9 screen centred in the viewport, draggable windows.
   Phones (narrow or short screens): full-viewport "app mode", one maximised window at a time.
   Sizes use px + clamp() (readable everywhere), never width-relative units for text. */
#pc { --ink: #2b1d16; --bar: rgba(30, 18, 14, .32); --sal: #f2a27e; --sal-2: #e98a62; --paper: #fff8f3;
      position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(40, 18, 8, .55);
      opacity: 0; transition: opacity .45s ease; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; font-size: 14px; }
#pc.show { display: grid; }
#pc.visible { opacity: 1; }
#pc *, #pc *::before, #pc *::after { box-sizing: border-box; }
#pc .screen { position: relative; width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9; max-height: 100dvh; overflow: hidden;
              border-radius: 10px; box-shadow: 0 20px 80px rgba(0,0,0,.5); color: #fff; }
#pc .wall { position: absolute; inset: -8%; background: url(lockscreen.jpg) center / cover; filter: blur(60px) saturate(1.1); transform: scale(1.05); }
#pc .exit { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 30;
            border: 0; border-radius: 99px; min-height: 36px; padding: 0 14px; background: rgba(255,255,255,.2); color: #fff;
            font-size: 13px; cursor: pointer; backdrop-filter: blur(10px); }
#pc .exit:hover { background: rgba(255,255,255,.32); }

/* lock screen */
#pc .screen > .lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
            padding: clamp(28px, 9%, 90px) 16px clamp(24px, 7%, 70px); transition: opacity .5s, transform .5s; }
#pc .screen > .lock.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
#pc .screen > .lock-top { text-align: center; }
#pc .clock { font-size: clamp(56px, 9vw, 150px); font-weight: 300; line-height: 1; letter-spacing: -.02em; }
#pc .date { margin-top: 8px; font-size: clamp(13px, 1.3vw, 18px); opacity: .85; text-transform: capitalize; }
#pc .user { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#pc .avatar { width: clamp(56px, 4.4vw, 76px); height: clamp(56px, 4.4vw, 76px); border-radius: 50%; box-shadow: 0 2px 12px rgba(0,0,0,.25);
              background: url(lockscreen.jpg) 49.97% 71.44% / 2287% auto no-repeat; }
#pc .name { font-size: clamp(15px, 1.4vw, 20px); font-weight: 500; }
/* the password field sits on the same centre line as clock, avatar and name; the "?" hangs to its right without shifting it */
#pc .pw { position: relative; display: flex; align-items: center; justify-content: center; }
#pc .pw .hint-btn { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
#pc .pw input { width: clamp(190px, 16vw, 260px); height: 38px; padding: 0 16px; border: 0; border-radius: 99px; outline: none; color: #fff;
                font-size: 15px; background: rgba(255,255,255,.28); backdrop-filter: blur(12px); }
#pc .pw input::placeholder { color: rgba(255,255,255,.8); }
#pc .pw input.shake { animation: pcShake .35s; }
#pc .hint-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.85); background: transparent; color: #fff; font-size: 15px; cursor: pointer; }
#pc .msg { margin-top: -4px; font-size: 13px; line-height: 1.45; opacity: .85; text-align: center; max-width: 280px; min-height: 2.9em; }
#pc .user { text-align: center; }
@keyframes pcShake { 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }

/* desktop */
#pc .desk { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .6s .15s; }
#pc .desk.on { opacity: 1; pointer-events: auto; }
#pc .desk .bg { position: absolute; inset: 0; background: url(lockscreen.jpg) center / cover; filter: blur(30px); transform: scale(1.1); }
#pc .menubar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: 30px; display: flex; align-items: center; gap: 18px;
               padding: 0 14px; font-size: 13px; background: var(--bar); backdrop-filter: blur(14px); white-space: nowrap; overflow: hidden; }
#pc .menubar b { font-weight: 600; }
#pc .menubar .sp { margin-left: auto; padding-right: 110px; }
#pc .icons { position: absolute; top: 46px; left: 18px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(5, auto); gap: 14px 10px; }
#pc .icon { width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border: 0; border-radius: 10px;
            background: none; color: #fff; font-size: 12.5px; line-height: 1.2; text-align: center; cursor: pointer; text-shadow: 0 1px 4px rgba(0,0,0,.55); }
#pc .icon:hover, #pc .icon:focus-visible { background: rgba(255,255,255,.16); outline: none; }
#pc .icon i, #pc .dock i { display: block; width: 52px; height: 52px; filter: drop-shadow(0 3px 7px rgba(0,0,0,.28)); }
#pc i svg, #pc i img { width: 100%; height: 100%; display: block; border-radius: 12px; object-fit: cover; }
#pc .dock { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; padding: 8px;
            border-radius: 18px; background: rgba(255,255,255,.2); backdrop-filter: blur(16px); }
#pc .dock button { padding: 0; border: 0; background: none; cursor: pointer; transition: transform .15s; }
#pc .dock button:hover { transform: translateY(-6px) scale(1.1); }
#pc .dock i { width: 44px; height: 44px; }

/* windows */
#pc .win { position: absolute; z-index: 10; left: 50%; top: 52%; width: min(980px, 88%); height: min(640px, 80%); transform: translate(-50%, -50%);
           display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; color: var(--ink); background: var(--paper);
           box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: pcPop .22s ease-out; }
#pc .win.moved { transform: none; }
#pc .win > header { flex: none; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; background: #efe3da; cursor: grab;
                    user-select: none; font-size: 13px; font-weight: 600; }
#pc .win > header .dots { display: flex; gap: 7px; }
#pc .win > header .dots span { width: 13px; height: 13px; border-radius: 50%; background: #d9cdc4; }
#pc .win > header .dots .close { background: #ff5f57; cursor: pointer; }
#pc .win > header .dots .max { background: #febc2e; }
#pc .win > header .dots .min { background: #28c840; }
#pc .win > header em { flex: 1; text-align: center; font-style: normal; transform: translateX(-30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pc .win > .body { flex: 1; min-height: 0; overflow: auto; }
/* desktop/tablet: apps are drawn ~20% smaller so their real-size UI (menus, panels, embedded sites) fits the 16:9 screen without cutting content */
@media (min-width: 761px) and (not ((max-height: 520px) and (pointer: coarse))) {
  #pc .win:not(.max) { top: calc(50% + 4px); width: min(1180px, 90%); height: min(760px, calc(100% - 140px)); }
  #pc .win > header { height: 30px; font-size: 12px; }
  #pc .win > header .dots span { width: 11px; height: 11px; }
  #pc .win > .body { zoom: .8; }
}
/* resize handles (edges + corners); the body is a size container so each app adapts to the window size */
#pc .win > .body { container: appwin / inline-size; }
#pc .win .rz { position: absolute; z-index: 3; }
#pc .win .rz-n, #pc .win .rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
#pc .win .rz-n { top: 0; } #pc .win .rz-s { bottom: 0; }
#pc .win .rz-e, #pc .win .rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
#pc .win .rz-e { right: 0; } #pc .win .rz-w { left: 0; }
#pc .win .rz-ne, #pc .win .rz-nw, #pc .win .rz-se, #pc .win .rz-sw { width: 14px; height: 14px; }
#pc .win .rz-ne { top: 0; right: 0; cursor: nesw-resize; } #pc .win .rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
#pc .win .rz-nw { top: 0; left: 0; cursor: nwse-resize; } #pc .win .rz-se { bottom: 0; right: 0; cursor: nwse-resize; }
#pc .win .rz-se::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; opacity: .45;
                         border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; border-bottom-right-radius: 3px; }
#pc .win.dark .rz-se::after { color: #aaa; }
#pc .win.resizing, #pc .win.resizing * { user-select: none; }
#pc .win.resizing .body { pointer-events: none; }          /* iframes don't swallow the drag */
#pc .win.zoomed { border-radius: 8px; }
#pc .win.max .rz { display: none; }
#pc .win.dark > header { background: #1f1f1f; color: #ddd; }
#pc .win.dark > header .dots span:not(.close):not(.max):not(.min) { background: #444; }
@keyframes pcPop { from { opacity: 0; } }
/* maximised app (the game): fills the desktop under the menu bar */
#pc .win.max { left: 0; top: 30px; width: 100%; height: calc(100% - 30px); transform: none; border-radius: 0 0 10px 10px; z-index: 40; }
#pc .win.max > header { cursor: default; }
#pc .back-mobile { display: none; }
#pc .empty, #pc .ph-note { opacity: .7; font-size: 13px; }
#pc code { background: rgba(0,0,0,.07); padding: 0 .3em; border-radius: 4px; }

/* ===================== PHONES: app mode ===================== */
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  #pc { background: #2a1a14; }
  #pc .screen { width: 100vw; height: 100dvh; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
  #pc .menubar { height: calc(34px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); font-size: 13px; gap: 12px; }
  #pc .menubar span:not(.sp) { display: none; }
  #pc .menubar .sp { padding-right: 104px; }
  #pc .exit { top: calc(env(safe-area-inset-top) + 2px); min-height: 30px; font-size: 12.5px; }
  #pc .icons { top: calc(54px + env(safe-area-inset-top)); left: 0; right: 0; padding: 0 12px; grid-auto-flow: row; grid-template-rows: none;
               grid-template-columns: repeat(4, 1fr); gap: 16px 4px; justify-items: center; }
  #pc .icon { width: 100%; max-width: 86px; font-size: 12px; }
  #pc .icon i { width: 56px; height: 56px; }
  #pc .dock { display: none; }
  #pc .win { left: 0; top: calc(34px + env(safe-area-inset-top)); width: 100%; height: auto; bottom: 0; transform: none; border-radius: 0;
             animation: pcSlide .25s ease-out; }
  #pc .win > header { height: 44px; cursor: default; }
  #pc .win > header .dots, #pc .win .rz { display: none; }
  #pc .win > header em { transform: none; text-align: left; font-size: 15px; }
  #pc .back-mobile { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; margin-left: -8px;
                     border: 0; background: none; color: inherit; font-size: 15px; cursor: pointer; }
  #pc .screen > .lock { padding-top: calc(70px + env(safe-area-inset-top)); }
  #pc .pw input { width: min(62vw, 260px); height: 42px; }
}
@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  #pc .icons { grid-template-columns: repeat(8, 1fr); }
  #pc .screen > .lock { flex-direction: row; justify-content: space-around; align-items: center; padding-top: 20px; }
  #pc .clock { font-size: 64px; }
}
@keyframes pcSlide { from { transform: translateY(24px); opacity: 0; } }
