/* ===== Temi ===== */
.theme-95 { --desk:#008080; --wall:none; --title:#000080; --title-in:#808080; --tt-in:#c0c0c0; --face:#c0c0c0; --light:#dfdfdf; --hi:#fff; --sh:#808080; --dk:#0a0a0a; --sel:#000080; --band:#000080; }
.theme-98 { --desk:#3a6ea5; --wall:url(../assets/wallpaper.jpg); --title:linear-gradient(90deg,#000080,#1084d0); --title-in:linear-gradient(90deg,#808080,#b5b5b5); --tt-in:#d4d0c8; --face:#c0c0c0; --light:#dfdfdf; --hi:#fff; --sh:#808080; --dk:#0a0a0a; --sel:#000080; --band:linear-gradient(0deg,#000080,#1084d0); }
.theme-me { --desk:#2d6aa3; --wall:radial-gradient(ellipse at 50% 42%,#6fa7d8 0%,#3f7fbd 38%,#245887 100%); --title:linear-gradient(90deg,#0a246a,#a6caf0); --title-in:linear-gradient(90deg,#808080,#c0c0c0); --tt-in:#d4d0c8; --face:#d4d0c8; --light:#e8e6e1; --hi:#fff; --sh:#808080; --dk:#404040; --sel:#0a246a; --band:linear-gradient(0deg,#0a246a,#5a8ed0); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: Tahoma, "MS Sans Serif", Geneva, Verdana, sans-serif; font-size: 12px; color: #000; -webkit-font-smoothing: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* Rilievi */
.out { box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--sh), inset 2px 2px var(--light); }
.in { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--sh), inset -2px -2px var(--light), inset 2px 2px var(--dk); }
.btn { background: var(--face); border: 0; min-width: 75px; height: 23px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: #000; }
.btn:active:not(:disabled) { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
.btn:disabled { color: var(--sh); text-shadow: 1px 1px var(--hi); cursor: default; }
.btn.sm { min-width: 0; height: 21px; padding: 0 8px; }

/* ===== Avvio ===== */
.boot { position: fixed; inset: 0; background: #000; color: #b8b8b8; font-family: "VT323", "Courier New", monospace; font-size: 21px; line-height: 1.15; z-index: 10000; }
.boot-bios { height: 100%; padding: 28px 36px; position: relative; cursor: pointer; }
.boot-bios pre { font: inherit; margin: 0; white-space: pre-wrap; display: inline; }
.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.bios-logo { position: absolute; right: 36px; top: 28px; display: flex; align-items: center; gap: 12px; color: #ffb000; font-size: 22px; }
.bios-footer { position: absolute; left: 36px; right: 36px; bottom: 28px; color: #fff; }
.bios-skip { background: none; border: 0; color: #ffb000; font: inherit; cursor: pointer; margin-left: 12px; }
.boot-menu { height: 100%; background: #0000a8; color: #fff; display: flex; align-items: center; justify-content: center; padding: 16px; }
.menu-box { width: min(640px, 100%); border: 4px double #fff; padding: 20px 26px 16px; animation: fadein .25s ease-out; }
.menu-head { background: #aaa; color: #0000a8; padding: 2px 10px; margin: -20px -26px 16px; font-size: 22px; }
.menu-box p { margin: 0 0 12px; }
.theme-list { list-style: none; margin: 0 0 14px; padding: 0; }
.theme-list button { width: 100%; display: flex; flex-direction: column; text-align: left; background: none; border: 0; color: #fff; font: inherit; padding: 6px 12px; cursor: pointer; }
.theme-list button .ds { color: #9fc4ff; font-size: 18px; }
.theme-list button.sel { background: #aaa; color: #0000a8; }
.theme-list button.sel .ds { color: #00006a; }
.theme-list button.sel .nm::before { content: "\25B8  "; }
.menu-hint { color: #9fc4ff; }
.menu-count { color: #ffff55; min-height: 1.2em; }
.boot-splash { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #000; color: #fff; animation: fadein .4s; }
.splash-name { font-family: Tahoma, Verdana, sans-serif; font-size: 34px; font-weight: bold; letter-spacing: 1px; }
.splash-name span { color: #ff9a1f; font-style: italic; }
.splash-sub { font-size: 20px; color: #8a8a8a; }
.splash-bar { width: 240px; height: 18px; border: 2px solid #555; overflow: hidden; position: relative; }
.splash-bar span { position: absolute; top: 2px; bottom: 2px; width: 60px; background: repeating-linear-gradient(90deg,#2f5fd0 0 10px,transparent 10px 14px); animation: bar 1.1s linear infinite; }
@keyframes bar { from { left: -60px; } to { left: 240px; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ===== Desktop ===== */
.desktop { position: fixed; inset: 0; background: var(--desk); background-image: var(--wall-override, var(--wall)); background-size: cover; background-position: center; animation: fadein .35s; overflow: hidden; }
.icons { position: absolute; top: 6px; left: 4px; bottom: 34px; display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; gap: 4px; }
.dicon { width: 78px; padding: 3px 2px; display: flex; flex-direction: column; align-items: center; background: none; border: 0; color: #fff; cursor: default; outline: none; }
.dicon .ic { width: 32px; height: 32px; position: relative; }
.dicon .ic svg { display: block; }
.dicon .lb { margin-top: 4px; padding: 1px 2px; line-height: 1.25; text-align: center; word-break: break-word; border: 1px dotted transparent; }
.dicon.selected .lb { background: var(--sel); color: #fff; border-color: #ffff80; }
.dicon.selected .ic::after { content: ""; position: absolute; inset: 0; background: var(--sel); opacity: .5; mix-blend-mode: multiply; }
.windows { position: absolute; inset: 0 0 28px 0; pointer-events: none; }
.windows > * { pointer-events: auto; }

/* ===== Finestre ===== */
.win { position: absolute; background: var(--face); padding: 3px; display: flex; flex-direction: column; min-width: 220px; min-height: 120px; animation: winopen .14s ease-out; }
@keyframes winopen { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.win.minimized { display: none; }
.win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
.win-title { height: 18px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 2px 0 3px; background: var(--title-in); color: var(--tt-in); font-weight: bold; touch-action: none; }
.win.active .win-title { background: var(--title); color: #fff; }
.win-title .wi { display: flex; margin-right: 3px; }
.win-title .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-ctl { width: 16px; height: 14px; padding: 0; border: 0; background: var(--face); display: grid; place-items: center; cursor: pointer; color: #000; }
.win-ctl svg { fill: #000; }
.win-ctl.close { margin-left: 2px; }
.win-ctl:active { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); }
.win-menu { display: flex; padding: 2px 0 1px; flex: none; }
.win-menu span { padding: 2px 7px; }
.win-menu span:hover { background: var(--sel); color: #fff; }
.win-body { flex: 1; min-height: 0; overflow: auto; margin-top: 2px; position: relative; }
.win-body.white { background: #fff; padding: 2px; }
.win-body.flush { overflow: hidden; display: flex; flex-direction: column; padding: 2px; }
.win-status { display: flex; gap: 2px; margin-top: 2px; flex: none; }
.win-status div { flex: 1; padding: 2px 5px; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); white-space: nowrap; overflow: hidden; }
.win-grip { position: absolute; right: 2px; bottom: 2px; width: 13px; height: 13px; cursor: nwse-resize; background: linear-gradient(135deg,transparent 40%,var(--sh) 40% 48%,var(--hi) 48% 55%,transparent 55% 62%,var(--sh) 62% 70%,var(--hi) 70% 77%,transparent 77%); touch-action: none; }
.win.max .win-grip { display: none; }

/* Contenuti */
.doc { padding: 14px 20px 22px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.55; user-select: text; color: #111; }
.doc h1 { font-size: 24px; margin: 0 0 10px; color: #000080; }
.doc h2 { font-size: 17px; margin: 18px 0 6px; }
.doc a { color: #0000ee; }
.doc code { font-family: "Courier New", monospace; font-size: 13px; background: #eee; padding: 0 3px; }
.doc .meta { font-family: Tahoma, sans-serif; font-size: 11px; color: #666; margin-bottom: 12px; }
.notepad { flex: 1; width: 100%; border: 0; resize: none; padding: 6px 8px; font-family: "Courier New", Courier, monospace; font-size: 14px; line-height: 1.35; outline: none; background: #fff; color: #000; user-select: text; }
.blog { display: flex; flex-direction: column; height: 100%; gap: 4px; }
.ie-bar { display: flex; align-items: center; gap: 6px; flex: none; padding: 2px 0; }
.addr { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.addr span { flex: 1; background: #fff; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: "Courier New", monospace; }
.ie-page { flex: 1; overflow: auto; background: #fff; padding: 2px; }
.blog-h { border-bottom: 2px solid #000080; padding-bottom: 6px; }
.post-card { padding: 4px 0 14px; border-bottom: 1px dashed #bbb; margin-bottom: 12px; }
.post-card h2 { margin: 6px 0 2px; font-size: 19px; }
.post-card p { margin: 4px 0 6px; }
.more { font-size: 13px; }
.blog-foot { font-size: 13px; color: #555; }
.linklist { list-style: none; margin: 0; padding: 6px; }
.linklist a { display: flex; gap: 10px; align-items: flex-start; padding: 8px; color: #000; text-decoration: none; }
.linklist a:hover { background: var(--sel); color: #fff; }
.linklist a span { display: flex; flex-direction: column; gap: 2px; }
.linklist small { opacity: .75; }
.folder-grid { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 10px; min-height: 100%; }
.folder-grid .dicon { color: #000; }
.empty { padding: 30px; color: #666; text-align: center; }
.dlg { display: flex; flex-direction: column; height: 100%; padding: 14px 14px 10px; }
.dlg-row { display: flex; gap: 16px; align-items: flex-start; flex: 1; }
.dlg-msg { line-height: 1.5; padding-top: 4px; }
.dlg-btns { display: flex; gap: 6px; justify-content: center; padding-top: 8px; }
.settings { padding: 6px; display: flex; flex-direction: column; height: 100%; }
.tabs { display: flex; padding-left: 2px; }
.tab { background: var(--face); padding: 3px 12px; position: relative; top: 2px; box-shadow: inset 1px 1px var(--hi), inset -1px 0 var(--dk), inset -2px 0 var(--sh); z-index: 1; }
.tabpanel { flex: 1; padding: 14px 12px; }
.monitor { width: 190px; height: 146px; margin: 0 auto; padding: 12px; background: var(--face); }
.stand { width: 70px; height: 10px; margin: 0 auto 12px; background: var(--face); box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi); }
.mini { height: 100%; position: relative; background: var(--desk); background-image: var(--wall-override, var(--wall)); background-size: cover; background-position: center; box-shadow: inset 1px 1px var(--dk); overflow: hidden; transition: background-color .2s; }
.mini-win { position: absolute; left: 22px; top: 16px; width: 104px; height: 60px; background: var(--face); padding: 2px; box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi); }
.mini-title { height: 9px; background: var(--title); }
.mini-task { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: var(--face); box-shadow: inset 0 1px var(--hi); }
fieldset { border: 0; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi), inset 2px 2px var(--hi), inset -2px -2px var(--sh); padding: 10px 12px; margin: 0; }
legend { padding: 0 4px; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.radio span { display: flex; flex-direction: column; }
.radio small { color: #444; }
.radio input { margin: 2px 0 0; accent-color: var(--sel); }

/* Mine Retrò */
.win-body.mn-body { overflow: visible; }
.mines { padding: 6px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mn-tools { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.mn-tools .btn.on { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); background: repeating-conic-gradient(var(--hi) 0 25%, var(--face) 0 50%) 0 0 / 2px 2px; }
.mn-flag svg { margin-right: 4px; }
.mn-frame { padding: 6px; background: var(--face); }
.mn-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; margin-bottom: 6px; }
.mn-led { background: #000; color: #ff2a1a; font-family: "VT323", "Courier New", monospace; font-size: 28px; line-height: 24px; padding: 0 4px; min-width: 44px; text-align: center; letter-spacing: 1px; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.mn-face { width: 28px; height: 28px; border: 0; padding: 0; background: var(--face); display: grid; place-items: center; cursor: pointer; }
.mn-face:active { box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--sh); }
.mn-board { display: grid; padding: 3px; touch-action: manipulation; }
.mn-cell { width: 20px; height: 20px; padding: 0; border: 0; background: var(--face); font-family: Tahoma, Verdana, sans-serif; font-weight: bold; font-size: 13px; display: grid; place-items: center; cursor: pointer; box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--sh), inset 2px 2px var(--light); }
.mn-cell.open { box-shadow: inset 1px 1px var(--sh); cursor: default; }
.mn-cell.boom { background: #ff2a1a; }
.mn-cell.wrong { background: #ffb3b3; }
.mn-msg { min-height: 16px; font-weight: bold; color: #000080; text-align: center; }
.mn-help, .mn-rec { font-size: 11px; color: #333; text-align: center; max-width: 330px; }

/* ===== Barra applicazioni ===== */
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: var(--face); box-shadow: inset 0 1px var(--light), inset 0 2px var(--hi); display: flex; align-items: center; gap: 3px; padding: 3px 2px 1px; z-index: 9000; }
.start-btn { height: 22px; display: flex; align-items: center; gap: 4px; padding: 0 7px 0 4px; font-weight: bold; border: 0; background: var(--face); cursor: pointer; flex: none; }
.start-btn.on { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); }
.start-logo { display: flex; }
.taskbar-sep { width: 2px; height: 20px; box-shadow: inset 1px 0 var(--sh), inset -1px 0 var(--hi); flex: none; }
.tasks { flex: 1; display: flex; gap: 3px; min-width: 0; overflow: hidden; }
.task { height: 22px; flex: 0 1 160px; min-width: 32px; display: flex; align-items: center; gap: 4px; padding: 0 6px; border: 0; background: var(--face); text-align: left; cursor: pointer; overflow: hidden; }
.task svg { flex: none; }
.task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task.active { font-weight: bold; background: repeating-conic-gradient(var(--hi) 0 25%, var(--face) 0 50%) 0 0 / 2px 2px; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); }
.tray { height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px; flex: none; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.tray-ic { display: flex; }

/* Menu Avvio */
.startmenu { position: absolute; left: 2px; bottom: 27px; z-index: 9500; display: flex; background: var(--face); padding: 3px; animation: smup .12s ease-out; }
@keyframes smup { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.sm-band { width: 26px; background: var(--band); color: #c0c0c0; display: flex; align-items: flex-end; justify-content: center; padding: 6px 0; }
.sm-band span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 18px; letter-spacing: .5px; white-space: nowrap; }
.sm-band b { color: #fff; }
.sm-items { min-width: 190px; }
.sm-item { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 22px 0 6px; cursor: pointer; outline: none; color: #000; }
.sm-item .sm-ic svg { width: 24px; height: 24px; display: block; }
.sm-sub .sm-item { height: 24px; gap: 6px; }
.sm-sub .sm-item .sm-ic svg { width: 16px; height: 16px; }
.sm-item:hover, .sm-item:focus-visible, .sm-item.open { background: var(--sel); color: #fff; }
.sm-arrow { position: absolute; right: 7px; font-size: 10px; }
.sm-sub { display: none; position: absolute; left: calc(100% - 3px); bottom: -3px; min-width: 190px; background: var(--face); padding: 3px; z-index: 2; }
.sm-item.has-sub:hover > .sm-sub, .sm-item.open > .sm-sub { display: block; }
.sm-sep { height: 2px; margin: 3px 2px; box-shadow: inset 0 1px var(--sh), inset 0 -1px var(--hi); }

/* Spegnimento */
.shutdown { position: fixed; inset: 0; background: #000; color: #ff9a1f; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; font-family: Tahoma, Verdana, sans-serif; font-size: 24px; z-index: 10001; cursor: pointer; animation: fadein .6s; }
.shutdown p { margin: 0; }
.shutdown small { color: #777; font-size: 14px; }

/* ===== Mobile ===== */
@media (max-width: 767px) {
  .boot { font-size: 17px; }
  .boot-bios { padding: 18px; }
  .bios-logo { position: static; margin-bottom: 14px; }
  .bios-logo svg { width: 48px; height: 48px; }
  .bios-footer { left: 18px; right: 18px; bottom: 18px; }
  .menu-box { padding: 16px; }
  .menu-head { margin: -16px -16px 14px; }
  .icons { flex-direction: row; flex-wrap: wrap; align-content: flex-start; right: 4px; bottom: 34px; gap: 8px 2px; }
  .dicon { width: calc(25% - 2px); }
  .win, .win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
  .win-grip { display: none; }
  .win-ctl { width: 22px; height: 18px; }
  .win-title { height: 24px; }
  .task span { display: none; }
  .task { flex: 0 0 34px; justify-content: center; }
  .sm-sub { position: static; display: none; box-shadow: none; padding: 0 0 0 18px; min-width: 0; background: transparent; }
  .sm-item.has-sub { flex-wrap: wrap; height: auto; min-height: 34px; }
  .sm-item.has-sub:hover > .sm-sub { display: none; }
  .sm-item.has-sub.open > .sm-sub { display: block; width: 100%; }
  .sm-item.has-sub > .sm-arrow { top: 11px; }
  .win.dlg-win { left: 12px !important; right: 12px; top: 30% !important; width: auto !important; height: auto !important; min-height: 160px; }
  .sm-item.open { background: transparent; color: #000; }
  .sm-sub .sm-item { color: #000; }
  .doc { font-size: 16px; padding: 12px 14px 20px; }
}

/* ===== Calcolatrice ===== */
.calc { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 6px; }
.calc-disp { background: #fff; padding: 4px 8px; text-align: right; font-family: "VT323", "Courier New", monospace; font-size: 30px; line-height: 36px; overflow: hidden; white-space: nowrap; }
.calc-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.calc-grid .btn { min-width: 0; height: auto; padding: 0; font-weight: bold; }
.calc-grid .btn.calc-op { color: #000080; }
.calc-grid .btn[data-k="0"] { grid-column: span 2; }

/* ===== Terminale ===== */
.term { display: flex; flex-direction: column; height: 100%; background: #000; color: #33ff66; font-family: "VT323", "Courier New", monospace; font-size: 18px; line-height: 1.3; padding: 8px; user-select: text; }
.term-log { flex: 1; overflow: auto; }
.term-out { white-space: pre-wrap; word-break: break-word; }
.term-echo { color: #a8a8a8; }
.term-line { display: flex; gap: 6px; align-items: center; flex: none; padding-top: 2px; }
.term-ps { color: #ffff55; }
.term-in { flex: 1; background: none; border: 0; outline: none; color: inherit; font: inherit; padding: 0; }

/* ===== Tris ===== */
.tris { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 8px; }
.tris-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; flex: 1; min-height: 220px; }
.tris-cell { min-width: 0; height: auto; padding: 0; background: #fff; font-size: 32px; font-weight: bold; }
.tris-cell.x { color: #cc0000; }
.tris-cell.o { color: #0000cc; }
.tris-cell.win { background: #ffffb0; }
.tris-msg { min-height: 18px; font-weight: bold; color: #000080; text-align: center; }
.tris-score, .game-help { font-size: 11px; color: #333; text-align: center; }
.tris .btn { width: 100%; }

/* ===== Giochi ===== */
.game { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; }
.game canvas { display: block; max-width: 100%; height: auto; }
.game-side { display: flex; gap: 12px; justify-content: space-between; width: 100%; font-size: 11px; color: #333; }
.game-msg { min-height: 16px; font-weight: bold; color: #000080; text-align: center; }
.game .btn[data-jump] { min-width: 110px; }
.dpad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 28px); gap: 3px; margin-top: 4px; }
.dpad .btn { min-width: 0; height: auto; padding: 0; }
.dpad .btn[data-dir="up"] { grid-column: 2; }
.dpad .btn[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad .btn[data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad .btn[data-dir="right"] { grid-column: 3; grid-row: 2; }
@media (hover: hover) and (pointer: fine) { .dpad { display: none; } }

/* ===== Pittura ===== */
.paint { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 6px; }
.paint-tools { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.paint-tools .btn.on { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--light), inset 2px 2px var(--sh); }
.paint-sw { width: 20px; height: 20px; padding: 0; box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi); cursor: pointer; }
.paint-sw.on { outline: 2px solid #000; outline-offset: 1px; }
.paint-sep { width: 1px; height: 18px; box-shadow: inset 1px 0 var(--sh); }
.paint-canvas-wrap { flex: 1; overflow: auto; background: #fff; padding: 2px; }
.paint-canvas-wrap canvas { display: block; max-width: 100%; height: auto; cursor: crosshair; touch-action: none; background: #fff; }

/* ===== Lettore musicale ===== */
.player { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 6px; }
.pl-screen { background: #0b0b0b; padding: 6px; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.pl-row { display: flex; justify-content: space-between; gap: 8px; font-family: "VT323", "Courier New", monospace; font-size: 20px; line-height: 22px; color: #33ff66; }
.pl-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-time { color: #ffd400; }
.pl-viz { display: block; margin: 5px auto 0; background: #000; }
.pl-meta { font-family: "VT323", "Courier New", monospace; font-size: 14px; color: #8a8a8a; margin-top: 3px; }
.pl-btns { display: flex; align-items: center; gap: 4px; }
.pl-btns .btn { min-width: 34px; padding: 0 6px; font-size: 11px; }
.pl-vol { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 11px; }
.pl-vol input { width: 68px; accent-color: var(--sel); }
.pl-list { list-style: none; margin: 0; padding: 2px; flex: 1; overflow: auto; background: #fff; }
.pl-item { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; padding: 3px 6px; cursor: pointer; font: inherit; }
.pl-item small { color: #666; }
.pl-item.on { background: var(--sel); color: #fff; }
.pl-item.on small { color: #cfe0ff; }

/* ===== Emulatori (CHIP-8) ===== */
.chip { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.chip canvas { display: block; width: 512px; max-width: 100%; height: auto; background: #000; image-rendering: pixelated; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.chip-rows { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.chip-tools { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 148px; }
.chip-tools .btn { width: 100%; }
.chip-speed { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.chip-speed input { width: 88px; accent-color: var(--sel); }
.chip-pad { display: grid; grid-template-columns: repeat(4, 34px); gap: 3px; }
.chip-pad .btn { min-width: 0; padding: 0; height: 26px; font-family: "VT323", "Courier New", monospace; font-size: 15px; }
.chip-pad .btn.on { box-shadow: inset 1px 1px var(--dk), inset -1px -1px var(--hi), inset 2px 2px var(--sh); }
.chip-status, .chip-help { font-size: 11px; color: #333; }
.chip-help b { font-family: "Courier New", monospace; }

/* ===== Calendario (orologio della barra) ===== */
.calendar { display: none; position: fixed; right: 4px; bottom: 30px; z-index: 9600; width: 216px; padding: 6px; background: var(--face); animation: smup .12s ease-out; }
.calendar.show { display: block; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px; background: var(--band); color: #fff; font-weight: bold; }
.cal-nav { width: 20px; height: 16px; border: 0; padding: 0; background: var(--face); color: #000; cursor: pointer; font-size: 9px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-top: 4px; }
.cal-grid span { text-align: center; font-size: 11px; padding: 1px 0; }
.cal-dow { color: #000080; font-weight: bold; }
.cal-day.today { background: var(--sel); color: #fff; font-weight: bold; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 5px; font-size: 11px; }
.cal-foot .btn { min-width: 0; height: 19px; padding: 0 6px; }

@media (max-width: 767px) {
  .pl-vol { display: none; }
  .chip canvas { width: 100%; }
  .calendar { width: 244px; }
}

/* ===== Sfondi del desktop ===== */
body[data-wall="nuvole"] { --wall-override: url(../assets/wallpaper.jpg); }
body[data-wall="aurora"] { --wall-override: linear-gradient(180deg, #05253f 0%, #0f6a86 55%, #7fd0dd 100%); }
body[data-wall="tramonto"] { --wall-override: linear-gradient(180deg, #241a4a 0%, #7b3a6b 45%, #e0785a 100%); }
body[data-wall="notte"] { --wall-override: radial-gradient(ellipse at 70% 15%, #26315e 0%, #0a0f1f 60%, #05070f 100%); }

/* ===== Protezione schermo ===== */
.saver-app { display: flex; flex-direction: column; gap: 6px; padding: 6px; height: 100%; }
.saver-app canvas { display: block; width: 300px; max-width: 100%; margin: 0 auto; background: #000; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.saver-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11px; }
.saver-row .btn { min-width: 0; height: 22px; padding: 0 8px; }
.saver-row .btn.on { box-shadow: inset 1px 1px var(--dk), inset -1px -1px var(--hi), inset 2px 2px var(--sh); }
.saver-row select { font: inherit; }
.saver-hint2 { font-size: 11px; color: #333; line-height: 1.4; }
.saver { position: fixed; inset: 0; z-index: 12000; background: #000; cursor: none; }
.saver canvas { display: block; width: 100%; height: 100%; }
.saver-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #808080; font-size: 12px; font-family: Tahoma, Verdana, sans-serif; }

/* ===== Demo 3D ===== */
.voxel { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.voxel canvas { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; background: #000; image-rendering: pixelated; box-shadow: inset 1px 1px var(--sh), inset -1px -1px var(--hi); }
.voxel-bar { display: flex; align-items: center; gap: 6px; justify-content: space-between; flex-wrap: wrap; }
.voxel-bar .btn { min-width: 0; padding: 0 10px; }
.voxel-msg { font-size: 11px; color: #333; text-align: center; }

@media (max-width: 767px) {
  .saver-app canvas { width: 100%; }
}

/* ===== YouTube ===== */
.yt { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.yt-screen { position: relative; background: #000; border: 2px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); aspect-ratio: 16 / 9; }
.yt-screen iframe { display: block; width: 100%; height: 100%; border: 0; }
.yt-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #cfe0ff; text-align: center; font-size: 11px; padding: 8px; }
.yt-empty span { font-size: 26px; color: #ff4b4b; }
.yt-empty[hidden] { display: none; }
.yt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.yt-head a { font-size: 11px; color: #00379c; }
.yt-form { display: flex; gap: 4px; flex-wrap: wrap; }
.yt-form input { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 12px; padding: 3px 4px; border: 2px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); background: #fff; }
.yt-form .btn { min-width: 0; padding: 0 10px; }
.yt-msg { font-size: 11px; color: #a00; min-height: 14px; }
.yt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; }
.yt-item { display: flex; align-items: center; gap: 4px; border: 1px solid #b8b8b8; background: #f4f4f4; }
.yt-item.on { background: #dbe8ff; border-color: #4b7bd6; }
.yt-open { flex: 1; display: flex; align-items: center; gap: 8px; padding: 3px; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.yt-thumb { position: relative; flex: 0 0 60px; height: 34px; background: #222 center / cover no-repeat; display: flex; align-items: center; justify-content: center; }
.yt-thumb::after { content: "\25B6"; font-size: 12px; color: #ff4b4b; text-shadow: 0 0 2px #000; }
.yt-info { display: flex; flex-direction: column; min-width: 0; }
.yt-info b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-info small { font-size: 10px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-del { flex: 0 0 20px; border: 0; background: #c33; color: #fff; font-size: 14px; height: 20px; line-height: 1; cursor: pointer; }
.yt-note { font-size: 10px; color: #444; line-height: 1.35; }
.yt-none { font-size: 11px; color: #555; padding: 4px; }

/* ===== Flipper ===== */
.pin { display: flex; flex-direction: column; gap: 5px; padding: 6px; align-items: center; }
.pin-hud { display: flex; gap: 10px; justify-content: space-between; width: 100%; max-width: 320px; font-size: 11px; }
.pin-hud b { font-family: VT323, monospace; font-size: 15px; }
.pin canvas { display: block; width: 100%; max-width: 300px; height: auto; border: 1px solid #000; background: #101a3a; }
.pin-msg { font-size: 11px; color: #333; text-align: center; min-height: 26px; max-width: 320px; }
.pin-bar { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pin-bar .btn { min-width: 0; padding: 0 8px; }
.pin-help { font-size: 10px; color: #444; text-align: center; }

@media (max-width: 767px) {
  .yt-list { max-height: 150px; }
}

/* ===== Radio ===== */
.radio { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.rd-screen { background: #0d1f14; border: 2px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); padding: 8px; color: #7dffa8; font-family: VT323, monospace; }
.rd-band { font-size: 11px; letter-spacing: 2px; opacity: .75; }
.rd-name { font-size: 24px; line-height: 1.1; }
.rd-genre { font-size: 11px; opacity: .8; }
.rd-waves { display: flex; gap: 3px; align-items: flex-end; height: 22px; margin-top: 4px; }
.rd-waves span { width: 5px; height: 4px; background: #7dffa8; }
.rd-waves.on span { animation: rdwave .7s infinite alternate ease-in-out; }
.rd-waves.on span:nth-child(2) { animation-delay: .12s; }
.rd-waves.on span:nth-child(3) { animation-delay: .24s; }
.rd-waves.on span:nth-child(4) { animation-delay: .36s; }
.rd-waves.on span:nth-child(5) { animation-delay: .48s; }
@keyframes rdwave { from { height: 4px; } to { height: 22px; } }
.rd-knobs { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.rd-knobs .btn { min-width: 44px; }
.rd-vol { display: flex; align-items: center; gap: 6px; font-size: 11px; margin-top: 4px; }
.rd-vol input { flex: 1; }
.rd-list { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.rd-item { width: 100%; display: flex; align-items: baseline; gap: 6px; text-align: left; background: #f4f4f4; border: 1px solid #b8b8b8; font: inherit; font-size: 12px; padding: 3px 6px; cursor: pointer; }
.rd-item small { color: #555; font-size: 10px; }
.rd-item em { margin-left: auto; font-style: normal; font-size: 9px; background: #dbe8ff; border: 1px solid #8aa9d8; padding: 0 3px; }
.rd-item.on { background: #dbe8ff; border-color: #4b7bd6; }
.rd-msg { font-size: 11px; color: #a00; min-height: 14px; }
.rd-site { font-size: 11px; color: #00379c; }
.rd-site[hidden] { display: none; }
.rd-note { font-size: 10px; color: #444; line-height: 1.35; }

/* ===== Assistente ===== */
.chat { display: flex; flex-direction: column; gap: 6px; padding: 6px; height: 400px; }
.chat-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; background: #fff; border: 2px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); }
.chat-row { display: flex; }
.chat-row.me { justify-content: flex-end; }
.chat-bubble { max-width: 84%; font-size: 12px; line-height: 1.35; padding: 5px 8px; border: 1px solid #8aa9d8; background: #eaf1ff; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-row.me .chat-bubble { background: #fffbe6; border-color: #d8c98a; }
.chat-row.bot .chat-bubble::before { content: "Assistente: "; font-weight: bold; color: #20408a; }
.chat-row.typing .chat-bubble { color: #666; font-style: italic; }
.chat-row.warn .chat-bubble { background: #fff3d6; border-color: #d8b06a; }
.chat-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-chips .btn { min-width: 0; height: 20px; padding: 0 6px; font-size: 10px; }
.chat-input { display: flex; gap: 4px; }
.chat-input input { flex: 1; min-width: 0; font: inherit; font-size: 12px; padding: 3px 5px; border: 2px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); }
.chat-input .btn { min-width: 0; padding: 0 8px; }
.chat-note { font-size: 10px; color: #444; line-height: 1.3; }

@media (max-width: 767px) {
  .chat { height: 340px; }
  .rd-list { max-height: 140px; }
}

/* ===== Calcolatrice scientifica ===== */
.calc2 { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 6px; }
.calc2-bar { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.calc2-bar .btn { min-width: 0; height: 20px; padding: 0 7px; font-size: 10px; }
.calc2-bar .btn.on { background: #dfe9ff; border-color: #808080 #fff #fff #808080; font-weight: bold; }
.calc2-lbl { font-weight: bold; }
.calc2-tip { margin-left: auto; color: #444; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc2-scr { padding: 2px 8px 4px; }
.calc2-prev { min-height: 14px; font: 12px/14px "VT323", "Courier New", monospace; color: #2a6a2a; text-align: right; white-space: nowrap; overflow: hidden; }
.calc2 .calc-disp { background: none; padding: 0; font-size: 26px; line-height: 30px; overflow-x: auto; }
.calc2-grid { display: grid; gap: 3px; }
.calc2-sci { grid-template-columns: repeat(6, 1fr); }
.calc2-main { grid-template-columns: repeat(4, 1fr); flex: 1; }
.calc2-grid .btn { min-width: 0; height: 100%; min-height: 26px; padding: 0; font-weight: bold; }
.calc2-fn { font-size: 11px; color: #000080; }
.calc2-fn sup { font-size: 8px; }
.calc2-main .btn { min-height: 32px; font-size: 15px; }
.calc2-main .btn.calc-op { color: #000080; }
.calc2-main .btn[data-k="0"] { grid-column: span 2; }
.calc2-hint { font-size: 9px; color: #444; text-align: center; line-height: 1.25; }

@media (max-width: 767px) {
  .calc2-hint { display: none; }
}
