/* Desktop metaphor: a fixed 1200×760 stage scaled to the viewport; below 960×600 the windows stack. */
:root {
  color-scheme: light;
  --wall: #c9ccc3; --wall-ink: #babdb3; --win: #fbfaf7; --bar: #f1f0ec; --chip: #e4e3de;
  --ink: #141414; --muted: #66665f; --line: #d9d8d2; --frame: #141414;
  --term: #141414; --term-ink: #ebebe6; --sticky: #f3e27a; --rec: #e0402a;
  --accent: #2f49ff; --accent-soft: #8a9bff; --on-accent: #ffffff;
  --f-cond: 'Fira Sans Extra Condensed', var(--font-display);
  --f-mono: 'JetBrains Mono', var(--font-mono);
  --f-hand: Caveat, cursive;
  --win-shadow: 0 30px 70px -30px #0008;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --wall: #1d1f1b; --wall-ink: #262923; --win: #151613; --bar: #1a1b18; --chip: #262823;
  --ink: #ecebe6; --muted: #95958d; --line: #30322c; --frame: #3b3d37;
  --term: #0b0b0a; --term-ink: #e6e6e0; --sticky: #e3d06a; --rec: #ff5a3d;
  --accent: #8a9bff; --on-accent: #0d0d0c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--wall); }
body { color: var(--ink); font: 400 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
textarea::placeholder { color: inherit; opacity: .5; }
.skip { position: fixed; z-index: 10001; left: 16px; top: -80px; padding: 12px 20px; border-radius: 6px; background: var(--accent); color: var(--on-accent); }
.skip:focus { top: 44px; }
.muted { color: var(--muted); }
.mono { font: 500 12px/1.3 var(--f-mono); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

.stage { position: relative; min-height: 100vh; padding: 50px 16px 112px; background-image:
  linear-gradient(#00000008 1px, transparent 1px),
  linear-gradient(90deg, #00000008 1px, transparent 1px),
  linear-gradient(#0000000f 1px, transparent 1px),
  linear-gradient(90deg, #0000000f 1px, transparent 1px),
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/></svg>");
  background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px, auto; }
:root[data-theme="dark"] .stage { background-image:
  linear-gradient(#ffffff07 1px, transparent 1px),
  linear-gradient(90deg, #ffffff07 1px, transparent 1px),
  linear-gradient(#ffffff0d 1px, transparent 1px),
  linear-gradient(90deg, #ffffff0d 1px, transparent 1px),
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/></svg>"); }
.wall-name { display: none; }

.bar { position: fixed; z-index: 9999; left: 0; right: 0; top: 0; height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: var(--bar); border-bottom: 1px solid var(--line); font: 500 13px/1 var(--f-mono); }
.bar-side { display: flex; gap: 12px; align-items: center; }
.bar-status { color: var(--muted); }
.bar-status > button:not(.chip) { color: var(--muted); }
.bar-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.bar-menu { display: none; gap: 20px; }
.bar-city, .bar-clock { display: none; }
.bar-clock { color: var(--ink); }
.chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); }
.rec { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); }

.icons { display: none; }
.glyph { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--win); color: var(--ink); border: 1px solid var(--line); font: 800 22px/1 var(--f-cond); }
.glyph.is-accent { background: var(--accent); color: var(--on-accent); }
.glyph.is-term { background: var(--term); color: var(--term-ink); }
.glyph.is-chip { background: var(--chip); }
.glyph.is-sticky { background: var(--sticky); color: #1d1b16; }
.glyph.is-cut { background: #12233c; color: #7dd3fc; border-color: #33507c; }
.glyph.is-tb { background: #111111; color: #f4f4f1; border-color: #111111; border-radius: 0; font-size: 17px; letter-spacing: -.02em; }
.glyph.is-kassa { background: #101612; color: #a8e63e; border-color: #101612; font-family: var(--f-mono); font-weight: 700; }

main { display: flex; flex-direction: column; gap: 20px; max-width: 680px; margin: 0 auto; }
.win { position: relative; background: var(--win); border: 1px solid var(--frame); border-radius: 10px; overflow: hidden; box-shadow: var(--win-shadow); scroll-margin-top: 50px; }
.win:focus { outline: none; }
/* Живое превью: масштабированный iframe приложения поверх статичного скриншота (фолбэк без JS). */
.win .shot { position: relative; display: block; overflow: hidden; }
.win .shot img { display: block; width: 100%; height: auto; }
.win .shot .live { position: absolute; inset: 0; width: 1200px; height: 760px; border: 0; transform-origin: 0 0; opacity: 0; transition: opacity 400ms; pointer-events: none; }
.win .shot.is-live .live { opacity: 1; }
.win .shot.is-live::after { content: 'live'; position: absolute; right: 8px; top: 8px; display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: #141414cc; color: #f4f4f1; font: 500 10px/1 var(--f-mono); }
.win .shot.is-live:hover { cursor: zoom-in; }
.win .shot.is-live img { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .win .shot .live { transition: none; } }
@media not ((min-width: 960px) and (min-height: 600px)) { .win .shot .live { display: none; } }
/* Inline left/top belong to the desktop stage only. */
@media not ((min-width: 960px) and (min-height: 600px)) { .stage .win, .stage .sticky { left: auto !important; top: auto !important; } }
.win-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding: 0 10px; border-bottom: 1px solid var(--line); font: 500 11px/1.3 var(--f-mono); }
.win-x { padding: 4px 6px; color: var(--muted); }
.win img { display: block; width: 100%; height: auto; }
.win-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.win-foot p { font-size: 13px; max-width: 40ch; }
.win-note { padding: 0 14px 10px; color: var(--muted); font-size: 11px; }
.win-note a { text-decoration: underline; }
.btn { display: inline-flex; white-space: nowrap; align-items: center; padding: 9px 14px; border-radius: 6px; border: 1px solid var(--line); font-weight: 500; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

.readme { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.readme h1 { font: 800 40px/.92 var(--f-cond); text-transform: uppercase; }
.fine { display: flex; flex-wrap: wrap; gap: 14px; font: 500 12px/1 var(--f-mono); color: var(--muted); }

.term { background: var(--term); color: var(--term-ink); font: 400 13px/1.6 var(--f-mono); }
.term .win-bar { border-color: #ffffff1f; }
.term .win-x { color: inherit; opacity: .6; }
.term-body { display: flex; flex-direction: column; padding: 10px 14px 14px; overflow-y: auto; max-height: min(75vh, 560px); scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; }
.dim { opacity: .6; }
.entries button { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 170px) 1fr; padding: 5px 0; border-bottom: 1px dashed #ffffff1f; text-align: left; font: inherit; }
.entries b { font-weight: 500; }
.entries .is-ok .mark, .entries [aria-pressed="true"] .mark { color: var(--accent-soft); }
.entry { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font: 400 14px/1.5 var(--font-body); }
.entry .dim { font-size: 13px; }
.entry .dim a { text-decoration: underline; }
.entry .shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 4px 0 6px; }
.entry .shots figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.entry .shots img { display: block; width: 100%; height: auto; border: 1px solid #ffffff24; border-radius: 6px; background: #0006; }
.entry .shots figcaption { font: 400 11px/1.4 var(--f-mono); opacity: .6; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; font: 500 12px/1 var(--f-mono); color: var(--accent-soft); }

.sticky { position: relative; align-self: center; width: 230px; padding: 14px 16px 12px; background: var(--sticky); color: #1d1b16; transform: rotate(2deg); box-shadow: 0 18px 30px -16px #0007; display: flex; flex-direction: column; gap: 6px; }
.sticky-top { display: flex; justify-content: space-between; font: 500 11px/1 var(--f-mono); opacity: .7; }
.sticky textarea { all: unset; height: 96px; font: 700 24px/1.05 var(--f-hand); cursor: text; white-space: pre-wrap; overflow: hidden; }
.sticky-cta { align-self: flex-start; font: 500 12px/1 var(--f-mono); border-bottom: 1px solid currentColor; padding-bottom: 2px; }

.trash { display: grid; grid-template-columns: minmax(0, 1fr); }
.trash-list { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-bottom: 1px solid var(--line); background: var(--bar); }
#olds { display: contents; }
.trash-list p { padding: 4px 8px 10px; font-size: 13px; }
.trash-list button { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 6px; text-align: left; }
.trash-list button > span:last-child { font-size: 12px; opacity: .75; }
.trash-list [aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.trash-view { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.trash-view figure { display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.shot { aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.link-mono { font: 500 12px/1 var(--f-mono); color: var(--muted); }

.contact { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px 24px; }
.contact h2 { font: 800 44px/.9 var(--f-cond); text-transform: uppercase; }
.contact .muted { font-size: 14px; }
.contact label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.contact textarea { height: 96px; resize: none; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: transparent; color: inherit; font: 400 14px/1.5 var(--font-body); outline-color: var(--accent); }
.contact .btn { align-self: flex-start; }

.toast { position: fixed; left: 50%; top: 52px; transform: translateX(-50%); z-index: 10000; width: max-content; max-width: min(520px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--win); box-shadow: 0 20px 40px -20px #0009; font-size: 14px; }
.toast-title { flex: none; font: 500 12px/1.6 var(--f-mono); color: var(--accent-soft); }

.dock { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9998; max-width: calc(100vw - 16px); overflow-x: auto; display: flex; gap: 2px; padding: 6px; border-radius: 14px; background: var(--bar); border: 1px solid var(--line); font: 500 12px/1 var(--f-mono); }
.dock button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border-radius: 8px; }
.dock .glyph { width: 40px; height: 40px; border-radius: 10px; font-size: 18px; }
.dock button > span:last-child { display: flex; align-items: center; gap: 5px; }
.dock i { width: 4px; height: 4px; border-radius: 50%; }
.dock .is-open i { background: var(--ink); }

@media (min-width: 960px) and (min-height: 600px) {
  html:has(.stage), html:has(.stage) body { height: 100%; overflow: hidden; }
  .desk { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
  .stage { position: absolute; width: 1200px; height: 760px; min-height: 0; padding: 0; transform-origin: 0 0; overflow: hidden; user-select: none; }
  .wall-name { display: block; position: absolute; left: 32px; bottom: 32px; font: 900 160px/.8 var(--f-cond); text-transform: uppercase; color: transparent; -webkit-text-stroke: 1.5px var(--wall-ink); pointer-events: none; opacity: .9; }
  .stage .bar, .stage .toast, .stage .dock { position: absolute; }
  .bar-side { gap: 20px; }
  .bar-menu, .bar-city, .bar-clock { display: flex; }
  .icons { position: absolute; right: 20px; top: 56px; z-index: 1; display: flex; flex-direction: column; gap: 6px; }
  .icon { cursor: default; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 8px; }
  .icon .label { font: 500 12px/1.25 var(--f-mono); text-align: center; padding: 1px 4px; border-radius: 3px; }
  .icon.is-selected { background: var(--chip); }
  .icon.is-selected .label { background: var(--accent); color: var(--on-accent); }
  .dock button { padding: 8px 12px; }
  .stage main { display: block; max-width: none; margin: 0; }
  .stage .win, .stage .sticky { position: absolute; }
  [data-drag] { cursor: grab; touch-action: none; }
  [data-drag]:active { cursor: grabbing; }
  .win[data-win="readme"] { width: 380px; }
  .win[data-win="code"], .win[data-win="contact"] { width: 500px; }
  .win[data-win="raskroi"] { width: 580px; }
  .win[data-win="dubl"], .win[data-win="tb"] { width: 420px; }
  .win[data-win="kassa"] { width: 250px; }
  .win[data-win="kassa"] .win-foot { padding: 8px 12px; }
  .win[data-win="trash"] { width: 680px; }
  /* Активное окно — резкое и насыщенное, остальные чуть приглушены. */
  .stage .win { transition: filter 260ms; }
  .stage .win.is-dim { filter: saturate(.62) brightness(.94) opacity(.78); }
  :root[data-theme="dark"] .stage .win.is-dim { filter: saturate(.5) brightness(.82) opacity(.8); }
  @media (prefers-reduced-motion: reduce) { .stage .win { transition: none; } }
  /* Док: имя приложения поднимается и чуть увеличивается при наведении. */
  .dock button { position: relative; transition: transform 200ms cubic-bezier(.34,1.56,.64,1); }
  .dock button::after { content: attr(data-open); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(6px); padding: 4px 10px; border-radius: 6px; background: var(--ink); color: var(--win); font: 500 11px/1 var(--f-mono); opacity: 0; pointer-events: none; transition: opacity 160ms, transform 200ms; white-space: nowrap; }
  .dock button:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
  .dock button:hover { transform: translateY(-7px) scale(1.09); }
  .dock button[data-open="readme"]::after { content: 'about me'; }
  .dock button[data-open="code"]::after { content: '~/code'; }
  .dock button[data-open="contact"]::after { content: 'contact'; }
  .dock button[data-open="sticky"]::after { content: 'sticker'; }
  .dock button[data-open="kassa"]::after { content: 'kopeyka'; }
  :root[data-lang="ru"] .dock button[data-open="readme"]::after { content: 'обо мне'; }
  :root[data-lang="ru"] .dock button[data-open="code"]::after { content: '~/код'; }
  :root[data-lang="ru"] .dock button[data-open="contact"]::after { content: 'связаться'; }
  :root[data-lang="ru"] .dock button[data-open="sticky"]::after { content: 'стикер'; }
  :root[data-lang="ru"] .dock button[data-open="kassa"]::after { content: 'копейка'; }
  /* Ховер по десктоп-иконке — лёгкий подъём. */
  .icon { transition: transform 180ms; }
  .icon:hover { transform: translateY(-2px); }
  .win-foot { flex-wrap: nowrap; }
  .win-foot .row { flex: none; flex-wrap: nowrap; }
  .sticky { align-self: auto; }
  .trash { grid-template-columns: 220px minmax(0, 1fr); }
  .trash-list { border-bottom: 0; border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* LeadFlow uses the existing desktop window and stacked mobile layout. */
@media (min-width: 960px) and (min-height: 600px) {
  .win[data-win="leadflow"] { width: 560px; }
  .win[data-win="leadflow"] .win-foot { flex-wrap: wrap; }
  .win[data-win="leadflow"] .win-foot p { max-width: none; }
  .bar-menu { gap: 12px; }
  .icons { gap: 0; }
  .icon { padding-block: 5px; }
}
