  :root{
    --term-bg:#0c0c0c;
    --term-fg:#cccccc;
    --term-dim:#767676;
    --term-bright:#f2f2f2;
    --term-err:#e74856;
    --term-ok:#16c60c;
    --title-bg:#1f1f1f;
    --mono:"Cascadia Mono",Consolas,"Lucida Console","DejaVu Sans Mono",monospace;
    --sans:"Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,Helvetica,Arial,sans-serif;
  }
  *{box-sizing:border-box}
  html,body{height:100%}
  body{
    margin:0;
    font-family:var(--sans);
    background:linear-gradient(135deg,#0a3a66 0%,#1668a8 55%,#2a8fd0 100%);
    background-attachment:fixed;
    display:flex;align-items:center;justify-content:center;
    padding:1.5rem;
  }
  .window{
    width:min(980px,100%);
    height:min(760px,calc(100dvh - 3rem));
    min-height:320px;
    display:flex;flex-direction:column;
    background:var(--term-bg);
    border:1px solid #3a3a3a;
    box-shadow:0 18px 50px rgba(0,0,0,.45);
  }
  .titlebar{
    flex:none;height:34px;background:var(--title-bg);color:#e6e6e6;
    display:flex;align-items:center;justify-content:space-between;
    font-size:12px;user-select:none;
  }
  .title{display:flex;align-items:center;gap:8px;padding-left:10px}
  .title svg{width:16px;height:16px}
  .winbtns{display:flex;height:100%}
  .winbtns span{width:46px;display:flex;align-items:center;justify-content:center}
  .winbtns span:last-child:hover{background:#c42b1c}
  .winbtns span:not(:last-child):hover{background:#333}
  .winbtns svg{width:10px;height:10px;stroke:#e6e6e6;fill:none;stroke-width:1}

  .term{
    position:relative;
    flex:1;overflow-y:auto;padding:8px 12px 14px;
    color:var(--term-fg);font-family:var(--mono);font-size:15px;line-height:1.3;
    cursor:text;scrollbar-color:#4a4a4a var(--term-bg);
  }
  .ln{white-space:pre-wrap;word-break:break-word;min-height:1.3em}
  .dim{color:var(--term-dim)}
  .bright{color:var(--term-bright)}
  .err{color:var(--term-err)}
  .ok{color:var(--term-ok)}

  .prompt-row{position:relative;white-space:pre-wrap;word-break:break-all;min-height:1.3em;color:var(--term-bright)}
  .prompt-row[hidden]{display:none}
  .prompt{color:var(--term-fg)}
  .cur{
    background:var(--term-fg);color:var(--term-bg);white-space:pre;
    animation:blink 1.06s steps(1) infinite;
  }
  @keyframes blink{50%{background:transparent;color:var(--term-fg)}}
  @media (prefers-reduced-motion:reduce){.cur{animation:none}}

  /* campo di input reale ma invisibile: serve solo a catturare la tastiera (anche su mobile) */
  .ghost{
    position:absolute;left:0;top:0;width:1px;height:1em;
    opacity:0;border:0;padding:0;margin:0;outline:0;
    font-size:16px;color:transparent;background:transparent;pointer-events:none;
  }

  html:not(.js) .prompt-row{display:none}
  .ns p{margin:0 0 .6em;white-space:pre-wrap}
  .ns a{color:var(--term-bright)}

  @media (max-width:640px){
    body{padding:.5rem}
    .window{height:calc(100dvh - 1rem)}
    .term{font-size:16px}
  }

/* image viewer ("Photos") */
.viewer{position:fixed;top:84px;right:4vw;width:min(640px,92vw);z-index:20;background:#1f1f1f;border:1px solid #3a3a3a;box-shadow:0 12px 40px rgba(0,0,0,.55);font-family:"Segoe UI",system-ui,-apple-system,Roboto,Helvetica,Arial,sans-serif}
.vbar{display:flex;align-items:center;justify-content:space-between;height:32px;padding-left:10px;font-size:12px;color:#e6e6e6;cursor:move;user-select:none;touch-action:none}
.vclose{width:44px;height:100%;border:0;background:transparent;color:#e6e6e6;font-size:20px;line-height:1;cursor:pointer}
.vclose:hover{background:#c42b1c}
.vclose:focus-visible{outline:2px solid #fff;outline-offset:-2px}
.vbody{background:#fff;max-height:70vh;overflow:auto;display:flex;justify-content:center;color:#222}
.vbody img{display:block;max-width:100%;height:auto;cursor:zoom-in}
.vbody.zoom{justify-content:flex-start}
.vbody.zoom img{max-width:none;cursor:zoom-out}
.verr{margin:2rem 1rem;font-size:14px}
.vcap{padding:6px 10px;font-size:12px;color:#aaa;background:#1f1f1f}
@media (max-width:640px){.viewer{top:60px;right:3vw}}

/* PDF reader ("Reader") */
.pdfwin{width:min(760px,94vw)}
.ptools{display:flex;align-items:center;gap:4px;padding:4px 8px;background:#2b2b2b;color:#e6e6e6;font-size:12px}
.pbtn{min-width:32px;height:26px;padding:0 8px;border:1px solid #444;background:#333;color:#e6e6e6;font:inherit;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.pbtn:hover{background:#444}
.pbtn:focus-visible{outline:2px solid #fff;outline-offset:1px}
.pinfo{margin-left:8px;color:#bbb;flex:1}
.pbody{background:#525659;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:10px;padding:12px;max-height:72vh}
.pbody .ppage{display:block;flex:none;margin:0 auto;background:#fff;box-shadow:0 2px 8px rgba(0,0,0,.5);max-width:none}
.pbody .verr{color:#eee}
.pbody .verr a{color:#9cf}
@media (max-width:640px){.pdfwin{top:60px}.pbody{max-height:68vh}}

/* Notepad */
.npwin{width:min(720px,94vw);background:#202020}
.npmenu{display:flex;gap:2px;padding:2px 6px;background:#202020;color:#e6e6e6;font-size:12px;border-bottom:1px solid #2d2d2d}
.npmenu span{padding:4px 10px;border-radius:4px}
.npmenu span:hover{background:#2d2d2d}
.nptext{display:block;box-sizing:border-box;width:100%;height:min(58vh,520px);margin:0;padding:8px 10px;border:0;outline:0;resize:none;background:#1c1c1c;color:#e6e6e6;font:14px/1.45 Consolas,"Cascadia Mono","Courier New",monospace;tab-size:8;white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto}
.nptext::selection{background:#264f78}
.npstatus{display:flex;gap:16px;padding:4px 10px;font-size:12px;color:#bbb;background:#202020;border-top:1px solid #2d2d2d;white-space:nowrap;overflow:hidden}
.npmsg{flex:1;color:#e6e6e6;overflow:hidden;text-overflow:ellipsis}
@media (max-width:640px){.nptext{height:52vh;font-size:13px}.npstatus span:last-child{display:none}}
.winlogo{color:#3a96dd;font-weight:700}

/* Wireshark */
.wswin{width:min(980px,96vw);top:56px;background:#f0f0f0;color:#111}
.wswin .vbar{background:#1f1f1f}
.wswin .npmenu{background:#f0f0f0;color:#111;border-bottom:1px solid #d0d0d0}
.wswin .npmenu span:hover{background:#e0e0e0}
.wsfilter{margin:4px 6px;padding:3px 8px;background:#afffaf;border:1px solid #8fd88f;font:12px Consolas,"Cascadia Mono",monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wslist{height:min(26vh,210px);overflow:auto;background:#fff;border-top:1px solid #ccc;border-bottom:1px solid #ccc;font:12px Consolas,"Cascadia Mono",monospace;outline:0}
.wslist:focus-visible{box-shadow:inset 0 0 0 2px #3875d7}
.wsrow{display:grid;grid-template-columns:52px 82px 112px 112px 68px 54px minmax(320px,1fr);min-width:820px;cursor:default;white-space:nowrap}
.wsrow span{padding:2px 6px;overflow:hidden;text-overflow:ellipsis}
.wshead{position:sticky;top:0;background:#f5f5f5;border-bottom:1px solid #ccc;font-family:"Segoe UI",system-ui,sans-serif;font-weight:600}
.wssip{background:#e4ffc7}
.wsrtp{background:#daeeff}
.wsrow.wssel{background:#3875d7;color:#fff}
.wsdetail{position:relative;height:min(24vh,200px);overflow:auto;background:#fff;border-bottom:1px solid #ccc;font:12px/1.5 Consolas,"Cascadia Mono",monospace;padding:4px 0}
.wsd{white-space:pre;padding-right:8px}
.wsd.wsgen{color:#555}
.wsd.wsbad{background:#ffff9c;color:#000}
.wsexpert{max-height:96px;overflow:auto;background:#fff;font:12px "Segoe UI",system-ui,sans-serif;border-bottom:1px solid #ccc}
.wsex{display:flex;gap:10px;padding:3px 8px;cursor:pointer}
.wsex:hover{filter:brightness(.95)}
.wssev{width:56px;font-weight:600}
.wsgrp{width:64px;color:#555}
.wswarn{background:#ffff9c}
.wsnote{background:#a0ffff}
.wswin .npstatus{background:#f0f0f0;color:#333;border-top:0}
.wswin .npmsg{color:#333}
.wsexp{color:#9a6a00;font-weight:600}
@media (max-width:640px){.wswin{top:44px}.wslist{height:22vh}.wsdetail{height:22vh}}
.wswin .npmenu{overflow:hidden;white-space:nowrap}
.wstcp{background:#e7e6ff}
.wsudp{background:#daeeff}
.wssmb{background:#feffd0}
.wsicmp{background:#fce0ff}
.wsarp{background:#faf0d7}
.wsrow.wsbad{background:#12272e;color:#f78787}
.wsrow.wsbad.wssel,.wsrow.wssel{background:#3875d7;color:#fff}
