/* nani-os: one stylesheet for the room, the boot screen and the desktop. */

@font-face { font-family: 'Silkscreen'; src: url('../fonts/silkscreen.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'VT323'; src: url('../fonts/vt323.woff2') format('woff2'); font-display: swap; }

:root {
  --ink: #1a1030;
  --night: #0d0b18;
  --paper: #efe9f7;
  --paper-2: #e2dbee;
  --mute: #9b93b0;
  --text: #ece6ff;
  --accent: #7a4fc4;
  --accent-2: #6a40b3;
  --accent-hi: #9b7be0;
  --accent-dark: #2b1f4a;
  --pixel: 'Silkscreen', ui-monospace, monospace;
  --mono: 'VT323', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--text); overflow: hidden; }
body { font: 20px/1.2 var(--mono); font-variant-ligatures: none; -webkit-font-smoothing: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; font-variant-ligatures: none; }
button { cursor: pointer; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
:focus-visible { outline: 3px dashed var(--accent-hi); outline-offset: 2px; }
::selection { background: var(--accent); color: #fff; }

/* ---------- the room ---------- */
.room { position: fixed; inset: 0; display: grid; place-items: center; outline: none; }
#room-canvas { display: block; transition: transform 0.95s cubic-bezier(0.7, 0, 0.3, 1), filter 0.95s; will-change: transform; }
#room-canvas.zoomed { transform: scale(11); filter: brightness(1.4); }
#room-canvas.no-anim { transition: none; }
.room-brand, .room-clock, .room-help, .room-sound, .boot-btn { transition: opacity 0.3s; }
.room.zooming .room-brand, .room.zooming .room-clock, .room.zooming .room-help, .room.zooming .room-sound { opacity: 0; }
.room-brand { position: fixed; left: 28px; bottom: 22px; margin: 0; font: 400 26px/1 var(--pixel); letter-spacing: 1px; color: var(--text); text-shadow: 3px 3px 0 #000; }
.room-brand small { display: block; margin-top: 6px; font: 22px/1 var(--mono); letter-spacing: 0; color: #a59fd0; }
.room-clock { position: fixed; right: 28px; top: 20px; margin: 0; text-align: right; font: 400 13px/1.8 var(--pixel); color: #a59fd0; }
.room-clock span:first-child { color: var(--text); }
.room-help { position: fixed; right: 28px; bottom: 22px; margin: 0; font-size: 20px; color: #7d77a8; }
.room-people { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); margin: 0; padding: 4px 12px; font: 400 11px var(--pixel); color: #ffd166; background: rgba(13, 11, 24, 0.8); border: 3px solid #3a3460; white-space: nowrap; }
.room.zooming .room-people { opacity: 0; }
.room-player { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; background: rgba(13, 11, 24, 0.88); border: 3px solid #4a3a78; font-size: 19px; color: #c9c2ee; max-width: calc(100vw - 32px); }
.room-player #room-track { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 280px; }
.room-player-note { color: #7ee0c3; }
.room-player button { width: 30px; height: 28px; padding: 0; background: #1d1730; border: 2px solid #4a3a78; color: #ece6ff; font-size: 14px; }
.room-player button:hover { border-color: #9b7be0; }
.room-player button.on { color: #7dff8a; }
.room.zooming .room-player { opacity: 0; }
.room-toast { position: fixed; left: 50%; top: 62px; transform: translateX(-50%); margin: 0; padding: 6px 12px; font: 400 11px var(--pixel); color: var(--ink); background: #ffd166; border: 3px solid var(--ink); box-shadow: 4px 4px 0 #000; animation: pop 0.25s steps(3); z-index: 7; }
.room-sound { position: fixed; left: 28px; top: 20px; background: none; border: 3px solid #3a3460; padding: 4px 10px; font: 400 11px var(--pixel); color: #a59fd0; }
.room-sound:hover { border-color: #7d77a8; color: var(--text); }
.boot-btn {
  position: fixed; transform: translate(-50%, calc(-100% - 70px)); white-space: nowrap;
  font: 400 12px var(--pixel); letter-spacing: 1px; color: #5ef2d6; background: var(--night);
  border: 4px solid #5ef2d6; padding: 8px 12px; box-shadow: 4px 4px 0 #000; animation: bob 1.6s steps(2) infinite;
}
.boot-btn::after { content: ''; position: absolute; left: 50%; top: 100%; width: 4px; height: 58px; background: #5ef2d6; transform: translateX(-50%); }
.boot-btn:hover { background: #5ef2d6; color: var(--night); }
@keyframes bob { 50% { margin-top: -4px; } }
.room-tip { position: fixed; z-index: 5; pointer-events: none; font: 400 11px var(--pixel); color: var(--night); background: #ffd166; padding: 4px 8px; box-shadow: 3px 3px 0 #000; }
.quip { position: fixed; z-index: 6; margin: 0; max-width: 260px; font: 21px/1.1 var(--mono); color: var(--ink); background: #fffbe8; border: 3px solid var(--ink); padding: 4px 10px; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); pointer-events: none; }
.quip.pop { animation: pop 0.25s steps(3); }
@keyframes pop { from { transform: translateY(6px) scale(0.9); } }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; z-index: 50; background: #05040c; color: #c9c2ee; padding: 6vh 6vw; font: 24px/1.25 var(--mono); }
.boot.out { animation: flash 0.25s steps(2) forwards; }
@keyframes flash { 50% { background: #fff; } to { opacity: 0; } }
.boot .bright { color: #fff; }
.boot .dim, .boot-skip { color: #6a63a0; }
.boot-skip { position: fixed; right: 24px; bottom: 16px; margin: 0; font-size: 20px; }
.splash { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; }
.splash-logo { font: 400 clamp(36px, 8vw, 72px)/1 var(--pixel); color: #fff; text-shadow: 4px 4px 0 var(--accent), 8px 8px 0 #000; }
.splash-sub { color: #a59fd0; }
.splash .bar { width: min(320px, 70vw); height: 20px; border: 3px solid #c9c2ee; padding: 3px; }
.splash .bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #5ef2d6 0 10px, transparent 10px 14px); }
.safe { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; text-align: center; color: #ffb45c; font-size: 28px; padding: 20px; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; background: var(--night); color: var(--text); font: 24px var(--mono); }

/* ---------- desktop ---------- */
.os { position: fixed; inset: 0; z-index: 40; overflow: hidden; }
.os > .wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.os.party > .wallpaper { animation: party 0.8s steps(6) infinite; }
@keyframes party { to { filter: hue-rotate(360deg) saturate(1.6); } }
.desk-icons {
  position: absolute; left: 0; top: 0; bottom: 48px; margin: 0; padding: 14px 10px; list-style: none;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 96px); grid-auto-columns: 100px; gap: 4px;
}
.desk-icon { width: 96px; padding: 6px 2px; background: none; border: 2px solid transparent; text-align: center; color: #fff; text-shadow: 2px 2px 0 var(--ink); font-size: 20px; line-height: 1; }
.desk-icon canvas { display: block; width: 48px; height: 48px; margin: 0 auto 6px; }
.desk-icon span { padding: 0 4px; }
.desk-icon.sel span, .desk-icon:focus-visible span { background: var(--accent); }
.desk-icon.sel { border-style: dotted; border-color: rgba(255, 255, 255, 0.6); }
.layer { position: absolute; inset: 0 0 48px 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
.crt { position: absolute; inset: 0; z-index: 30; pointer-events: none; display: none; }
.os.crt-on .crt {
  display: block;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.42));
}

/* taskbar */
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 0 6px; background: var(--ink); border-top: 4px solid var(--accent); }
.start { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; font: 400 14px var(--pixel); letter-spacing: 1px; color: var(--ink); background: #ffd166; border: 3px solid #fff3c4; box-shadow: inset -3px -3px 0 #d9a43a; }
.start[aria-expanded='true'] { box-shadow: inset 3px 3px 0 #d9a43a; }
.start-mark { width: 12px; height: 12px; background: var(--accent); box-shadow: 4px 4px 0 var(--ink); }
.tabs { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tab { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; max-width: 190px; height: 34px; padding: 0 10px; font-size: 19px; color: var(--text); background: var(--accent-dark); border: 3px solid var(--accent-2); }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.on { background: var(--accent-2); border-color: var(--accent-hi); }
.tab-icon { width: 16px; height: 16px; flex: none; }
.tray { display: flex; align-items: center; gap: 6px; }
.tray-btn { height: 34px; padding: 0 10px; background: none; border: 3px solid var(--accent-dark); color: var(--text); font-size: 19px; }
.tray-radio { color: #7ee0c3; max-width: 140px; overflow: hidden; white-space: nowrap; }
.clock { padding: 0 10px; font-size: 21px; color: var(--text); }
.tray-people { padding: 0 8px; font-size: 19px; color: #7dff8a; white-space: nowrap; }

/* menus */
.menu { position: absolute; z-index: 25; min-width: 220px; padding: 4px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 rgba(10, 6, 24, 0.55); color: var(--ink); }
.start-menu { left: 6px; bottom: 54px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 10px; background: none; border: 0; text-align: left; color: var(--ink); font-size: 21px; }
.menu button:hover, .menu button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu button canvas { width: 24px; height: 24px; }
.menu hr { border: 0; border-top: 3px dotted var(--mute); margin: 4px 6px; }

/* notifications */
.toasts { position: absolute; right: 12px; bottom: 60px; z-index: 26; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { max-width: min(360px, 80vw); padding: 8px 12px; background: var(--ink); color: var(--text); border: 3px solid var(--accent-hi); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); font-size: 20px; animation: slide 0.25s steps(3); }
.toast.out { opacity: 0; transition: opacity 0.4s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.saver { position: absolute; inset: 0; z-index: 45; width: 100%; height: 100%; background: #05040c; cursor: none; }

/* windows */
.win { position: absolute; display: flex; flex-direction: column; min-width: 200px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 8px 8px 0 rgba(10, 6, 24, 0.55); outline: none; }
.win.opening { animation: open 0.18s steps(3); }
@keyframes open { from { transform: scale(0.85); opacity: 0.4; } }
.win.maxed { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; box-shadow: none; }
.win-bar { display: flex; align-items: center; gap: 6px; height: 32px; flex: none; padding: 0 4px 0 8px; background: repeating-linear-gradient(0deg, #9b93b0 0 4px, #8d85a3 4px 8px); border-bottom: 3px solid var(--ink); cursor: grab; touch-action: none; user-select: none; }
.win.focused .win-bar { background: repeating-linear-gradient(0deg, var(--accent) 0 4px, var(--accent-2) 4px 8px); }
.win-bar:active { cursor: grabbing; }
.win-icon { width: 16px; height: 16px; flex: none; }
.win-title { flex: 1; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 400 12px var(--pixel); letter-spacing: 1px; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.win-btn { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; font: 400 11px/1 var(--pixel); color: var(--ink); background: var(--paper); border: 3px solid var(--ink); }
.win-btn:hover { background: #fff; }
.win-btn.close:hover { background: #e05a47; color: #fff; }
.win-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.win-grip { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 50%, var(--mute) 50% 62%, transparent 62% 74%, var(--mute) 74% 86%, transparent 86%); }
.win.maxed .win-grip { display: none; }

/* shared bits */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 2px 12px; font-size: 20px; color: var(--ink); background: var(--paper-2); border: 3px solid var(--ink); box-shadow: inset -3px -3px 0 #b9b3c9, inset 3px 3px 0 #fff; text-decoration: none; }
.btn:hover { background: #fff; }
.btn:active, .btn[aria-pressed='true'], .btn[aria-checked='true'] { box-shadow: inset 3px 3px 0 #b9b3c9; background: #d4cbe6; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { min-height: 28px; padding: 0 8px; font-size: 18px; }
.btn.danger { background: #f6c6bf; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border-bottom: 3px solid var(--ink); background: var(--paper-2); }
.status { margin-top: auto; padding: 3px 10px; border-top: 3px solid var(--ink); background: var(--paper-2); color: #4a3f66; font-size: 18px; }
.dim { color: #6e6884; }
.lcd { display: inline-block; min-width: 54px; padding: 0 6px; font: 26px/1.1 var(--mono); color: #ff4f4f; background: #1a0808; border: 3px solid var(--ink); text-align: center; }

/* terminal */
.term { flex: 1; overflow: auto; padding: 10px 14px; background: #120d24; color: var(--text); font: 21px/1.15 var(--mono); cursor: text; }
.tl { white-space: pre-wrap; word-break: break-word; min-height: 1.15em; }
.tl.echo { color: #fff; }
.tl.err { color: #ff8f7a; }
.tl.dim { color: #8a83b3; }
.tl.dir { color: #79bbeb; }
.tl.app { color: #7ee0c3; }
.term-line { display: flex; gap: 0; }
.term-prompt { color: #7ee0c3; white-space: pre; }
.term-in { flex: 1; min-width: 0; padding: 0; background: none; border: 0; outline: none; color: #fff; font: inherit; caret-color: #ffd166; }

/* files */
.files { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.files-path { padding: 0 8px; font-size: 20px; color: #4a3f66; }
.files-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); align-content: start; gap: 6px; padding: 10px; background: #fff; }
.file { padding: 6px 2px; background: none; border: 2px solid transparent; text-align: center; font-size: 19px; line-height: 1.05; color: var(--ink); word-break: break-word; }
.file canvas { display: block; width: 40px; height: 40px; margin: 0 auto 4px; }
.file.sel { border: 2px dotted var(--accent); background: #ece6fa; }

/* notes */
.notes { flex: 1; overflow: auto; padding: 14px 18px; background: repeating-linear-gradient(180deg, #fffbe8 0 24px, #e8dfc2 24px 25px); outline: none; }
.notes pre { margin: 0; font: 21px/25px var(--mono); white-space: pre-wrap; color: var(--ink); }

/* paint */
.paint { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.paint-main { flex: 1; display: flex; gap: 12px; padding: 12px; align-items: flex-start; justify-content: center; flex-wrap: wrap; overflow: auto; background: #cfc8dd; }
.paint-frame { border: 3px solid var(--ink); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3); line-height: 0; }
.paint-canvas { width: min(320px, 70vw); height: min(320px, 70vw); cursor: crosshair; touch-action: none; }
.palette { display: grid; grid-template-columns: repeat(4, 30px); gap: 4px; }
.swatch { width: 30px; height: 30px; padding: 0; border: 3px solid var(--ink); }
.swatch[aria-pressed='true'] { outline: 3px solid #fff; outline-offset: -7px; box-shadow: 0 0 0 3px var(--accent); }

/* mines */
.mines { display: flex; flex-direction: column; flex: 1; }
.mines-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.face { min-width: 56px; font: 400 14px var(--pixel); }
.mines-grid { display: grid; gap: 0; margin: 0 10px 10px; border: 3px solid var(--ink); align-self: center; }
.cell { width: 26px; height: 26px; padding: 0; font: 400 12px/1 var(--pixel); background: var(--paper-2); border: 0; box-shadow: inset -3px -3px 0 #b9b3c9, inset 3px 3px 0 #fff; color: var(--ink); }
.cell.open { background: #f7f3ff; box-shadow: inset 1px 1px 0 #cfc8dd; }
.cell.flag { color: #e05a47; }
.cell.mine { background: #cfc8dd; }
.cell.boom { background: #e05a47; color: #fff; }
.cell.n1 { color: #3f88c5; } .cell.n2 { color: #2c7a39; } .cell.n3 { color: #e05a47; } .cell.n4 { color: #4a3a78; }
.cell.n5 { color: #8a3a2e; } .cell.n6 { color: #2a9d8f; } .cell.n7 { color: var(--ink); } .cell.n8 { color: #6e6884; }

/* snake */
.snake { display: flex; flex-direction: column; flex: 1; }
.snake-frame { display: grid; place-items: center; padding: 10px; background: #0b140e; flex: 1; }
.snake-canvas { width: min(320px, 80vw); height: min(240px, 60vw); border: 3px solid #5bba6f; outline: none; touch-action: none; }
.snake-canvas:focus-visible { border-color: #b8ff7a; }
.dpad { display: none; grid-template-areas: '. up .' 'left . right' '. down .'; gap: 4px; justify-content: center; padding: 8px; background: #0b140e; }
.dpad .up { grid-area: up; } .dpad .down { grid-area: down; } .dpad .left { grid-area: left; } .dpad .right { grid-area: right; }
@media (pointer: coarse) { .dpad { display: grid; } }

/* radio */
.radio { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: #d4cbe6; flex: 1; }
.boombox-frame { display: grid; place-items: center; padding: 8px; background: #1d1730; border: 3px solid var(--ink); }
.boombox { width: 100%; max-width: 440px; aspect-ratio: 220 / 120; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset b { font-weight: 400; color: #e05a47; }
.power.on { background: #b8ff7a; }
.radio-now { margin: 0 0 0 6px; flex: 1; min-width: 160px; font-size: 20px; }
.sliders label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; font-size: 19px; }
.radio-credit { margin: 0; font-size: 17px; color: #4a3f66; }
input[type='range'] { flex: 1; accent-color: var(--accent); }

/* settings */
.settings { padding: 10px 16px 16px; overflow: auto; }
.settings h3 { margin: 12px 0 6px; font: 400 12px var(--pixel); letter-spacing: 1px; color: var(--accent-2); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: grid; justify-items: center; gap: 4px; padding: 6px; background: var(--paper-2); border: 3px solid var(--ink); font-size: 18px; color: var(--ink); }
.choice[aria-checked='true'] { background: #fff; box-shadow: 0 0 0 3px var(--accent); }
.thumb { width: 96px; height: 54px; border: 2px solid var(--ink); }
.dot { display: block; width: 28px; height: 28px; border: 3px solid var(--ink); }
.toggle { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; }
.toggle input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); }
.toggle span { display: grid; }
.toggle b { font-weight: 400; }
.toggle small { font-size: 17px; color: #6e6884; }

/* about */
.about { padding: 14px 18px; display: grid; gap: 10px; align-content: start; }
.about-head { padding: 8px; background: var(--ink); border: 3px solid var(--ink); }
.about-logo { width: 240px; height: 80px; display: block; }
.about p { margin: 0; }
.specs { margin: 0; display: grid; gap: 2px; }
.spec { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.spec dt { color: var(--accent-2); }
.spec dd { margin: 0; }

/* phones */
@media (max-width: 720px), (max-height: 480px) {
  .room-brand { font-size: 18px; left: 16px; bottom: 16px; }
  .room-brand small { font-size: 18px; }
  .room-help { display: none; }
  .room-clock { right: 16px; top: 14px; font-size: 10px; }
  .room-sound { left: 16px; top: 14px; }
  .room-people { top: auto; bottom: 64px; font-size: 9px; }
  .room-player { bottom: 96px; }
  .room-player #room-track { max-width: 150px; }
  .boot-btn { font-size: 10px; transform: translate(-50%, calc(-100% - 46px)); }
  .boot-btn::after { height: 34px; }
  .desk-icons { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 84px); grid-template-rows: none; grid-auto-rows: 88px; right: 0; justify-content: center; }
  .desk-icon { width: 84px; font-size: 18px; }
  .desk-icon canvas { width: 40px; height: 40px; }
  .win { border-width: 0; }
  .start-menu { left: 0; right: 0; bottom: 48px; }
  .tab { max-width: 120px; }
  .clock { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- v2: games, sticky, trophies, visitors, widget ---------- */
.menu-head { margin: 4px 10px 2px; font: 400 10px var(--pixel); letter-spacing: 1px; color: var(--accent-2); }
.start-menu { max-height: calc(100% - 64px); overflow: auto; }
.widget { position: absolute; right: 18px; top: 16px; display: grid; justify-items: end; gap: 2px; color: #fff; text-shadow: 3px 3px 0 var(--ink); pointer-events: none; }
.widget b { font: 400 34px/1 var(--pixel); letter-spacing: 2px; }
.widget span { font-size: 20px; }
.widget-now { color: #7ee0c3; }

.game2048 { display: flex; flex-direction: column; flex: 1; }
.g2048-frame { flex: 1; display: grid; place-items: center; padding: 12px; background: #2b1f4a; }
.g2048 { display: grid; grid-template-columns: repeat(4, 64px); grid-template-rows: repeat(4, 64px); gap: 6px; padding: 6px; background: #1a1030; border: 3px solid var(--ink); outline: none; touch-action: none; }
.g2048:focus-visible { box-shadow: 0 0 0 3px var(--accent-hi); }
.tile { display: grid; place-items: center; font: 400 18px var(--pixel); color: var(--ink); background: #3a2d5e; }
.tile.new { animation: open 0.15s steps(2); }
.t2 { background: #efe9f7; } .t4 { background: #e2d6f5; } .t8 { background: #ffb45c; } .t16 { background: #f2a65a; }
.t32 { background: #e0703c; color: #fff; } .t64 { background: #e05a47; color: #fff; } .t128 { background: #ffd166; font-size: 15px; }
.t256 { background: #f2c14e; font-size: 15px; } .t512 { background: #7ee0c3; font-size: 15px; } .t1024 { background: #5ef2d6; font-size: 12px; }
.t2048, .t4096 { background: #ff4fd8; color: #fff; font-size: 12px; }

.blocks { display: flex; flex-direction: column; flex: 1; background: #1a1030; }
.blocks-main { display: flex; gap: 12px; padding: 10px; justify-content: center; flex: 1; }
.blocks-frame { align-self: flex-start; border: 3px solid #9b7be0; line-height: 0; }
.blocks-canvas { width: 160px; height: 320px; outline: none; touch-action: none; }
.blocks-side { display: flex; flex-direction: column; gap: 4px; color: #ece6ff; min-width: 110px; }
.blocks-side small { font: 400 10px var(--pixel); color: #9b93b0; margin-top: 6px; }
.blocks-side p { margin: 0; }
.blocks-next { width: 64px; height: 64px; background: #0f0c20; border: 3px solid #4a3a78; }
.touchpad { display: none; gap: 6px; justify-content: center; padding: 0 10px 10px; }
.touchpad .btn { min-width: 48px; }
@media (pointer: coarse) { .touchpad { display: flex; } }

.arcade { display: flex; flex-direction: column; flex: 1; }
.arcade-frame { flex: 1; display: grid; place-items: center; padding: 10px; background: #0b0918; }
.arcade-canvas { width: min(320px, 82vw); height: min(240px, 61.5vw); border: 3px solid #9b7be0; outline: none; touch-action: none; }
.arcade-canvas:focus-visible { border-color: #ffd166; }

.memory { display: flex; flex-direction: column; flex: 1; }
.memory-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 72px); grid-auto-rows: 72px; gap: 8px; justify-content: center; align-content: center; padding: 12px; background: #2b1f4a; }
.card { padding: 0; border: 3px solid var(--ink); background: repeating-linear-gradient(45deg, #7a4fc4 0 6px, #6a40b3 6px 12px); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25); }
.card canvas { width: 45px; height: 60px; visibility: hidden; }
.card.up { background: #efe9f7; }
.card.up canvas { visibility: visible; }
.card.done { background: #c9f7e8; border-color: #2a9d8f; }

.sticky { display: flex; flex-direction: column; flex: 1; }
.sticky.yellow { background: #ffe79a; } .sticky.pink { background: #ffc9dc; } .sticky.mint { background: #c9f7e8; } .sticky.sky { background: #cfe8ff; }
.sticky-text { flex: 1; resize: none; border: 0; outline: none; padding: 12px 14px; background: transparent; color: var(--ink); font: 22px/1.15 var(--mono); }
.sticky-bar { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-top: 2px dashed rgba(26, 16, 48, 0.3); }
.sticky-bar .dim { margin-left: auto; }
.sticky-dot { width: 22px; height: 22px; padding: 0; border: 3px solid var(--ink); }
.sticky-dot.yellow { background: #ffd166; } .sticky-dot.pink { background: #ff8fab; } .sticky-dot.mint { background: #7ee0c3; } .sticky-dot.sky { background: #79bbeb; }
.sticky-dot[aria-pressed='true'] { outline: 3px solid #fff; outline-offset: -7px; }

.trophies, .visitors { padding: 10px 14px; overflow: auto; }
.trophy-count { margin: 0 0 8px; font: 400 12px var(--pixel); color: var(--accent-2); }
.trophy-list, .visitor-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.trophy-list li { display: flex; gap: 10px; align-items: center; padding: 4px 8px; background: #fff; border: 3px solid var(--ink); }
.trophy-list li canvas { width: 32px; height: 32px; flex: none; }
.trophy-list li div { display: grid; }
.trophy-list li small { color: #6e6884; font-size: 17px; }
.trophy-list li.locked canvas { filter: grayscale(1) brightness(0.6); opacity: 0.6; }
.trophy-list li.locked b { color: #6e6884; }
.visitor-list li { display: flex; gap: 10px; align-items: center; padding: 4px 8px; background: #fff; border: 3px solid var(--ink); }
.visitor-list li canvas { width: 27px; height: 36px; }
.visitor-list li.you { border-color: var(--accent); background: #f3edff; }
.small-note { font-size: 17px; margin: 10px 0 0; }

@media (max-width: 720px), (max-height: 480px) {
  .widget { display: none; }
  .g2048 { grid-template-columns: repeat(4, 56px); grid-template-rows: repeat(4, 56px); }
  .memory-grid { grid-template-columns: repeat(4, 64px); grid-auto-rows: 64px; }
}
