/* =========================================================
   About | Desktop environment
   Tokens match the main portfolio (style.css)
   ========================================================= */
:root{
  --void:      #05080b;
  --charcoal:  #0d1319;
  --glass:     rgba(12, 18, 25, 0.58);
  --glass-hi:  rgba(18, 26, 35, 0.72);
  --border:    rgba(148, 176, 199, 0.16);
  --border-hi: rgba(47, 168, 255, 0.42);
  --mist:      #e8eef3;
  --steel:     #8493a1;
  --steel-dim: #576270;
  --pulse:     #2fa8ff;
  --pulse-dim: rgba(47, 168, 255, 0.16);
  --signal:    #39ff8a;
  --signal-dim:rgba(57, 255, 138, 0.16);
  --danger:    #ff5c5c;
  --amber:     #ffc857;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --task-h: 52px;
  --radius: 12px;
  --radius-sm: 8px;
  --blur: blur(22px) saturate(150%);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--void);
  color: var(--mist);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; color: inherit; cursor: pointer; }
h1, h2, p, dl, dd, ul{ margin: 0; padding: 0; }
ul{ list-style: none; }

:focus-visible{ outline: 2px solid var(--pulse); outline-offset: 2px; }

/* =========================================================
   Wallpaper
   ========================================================= */
#wallpaper{
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  background: var(--void);
}
.wall-fx{
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 72% 18%, rgba(47,168,255,0.12), transparent 55%),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.6) 100%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.014) 0 1px, transparent 1px 3px);
}

/* =========================================================
   Desktop icons
   ========================================================= */
.desktop{
  position: fixed;
  inset: 0 0 var(--task-h) 0;
  z-index: 2;
}
.desktop-icons{
  position: absolute;
  top: 14px; left: 14px; bottom: 14px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 104px);
  grid-auto-columns: 104px;
  gap: 6px;
  align-content: start;
}
.d-icon{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 104px; height: 104px;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: background .15s, border-color .15s;
}
.d-icon:hover{ background: rgba(148,176,199,0.09); border-color: var(--border); }
.d-icon.is-selected{ background: var(--pulse-dim); border-color: var(--border-hi); }
.d-tile{
  display: grid; place-items: center;
  width: 50px; height: 50px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--pulse);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 16px rgba(0,0,0,0.35);
}
.d-tile svg{ width: 28px; height: 28px; }
.d-label{
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  color: var(--mist);
  overflow-wrap: break-word;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
.d-icon-exit .d-tile{ color: var(--signal); }
.d-icon-exit .d-label{ color: var(--signal); }

/* =========================================================
   Windows
   ========================================================= */
#windows{
  position: fixed;
  inset: 0 0 var(--task-h) 0;
  z-index: 3;
  pointer-events: none;
}
.win{
  position: absolute;
  display: flex;
  flex-direction: column;
  width: min(700px, calc(100vw - 16px));
  max-height: calc(100% - 16px);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  pointer-events: auto;
  will-change: transform, opacity;
}
.win[data-app="media"], .win[data-app="physical"]{ width: min(760px, calc(100vw - 16px)); }
.win[data-app="desc"]{ width: min(620px, calc(100vw - 16px)); }
.win[data-app="profile"]{ width: min(560px, calc(100vw - 16px)); }

.win.is-active{
  border-color: var(--border-hi);
  box-shadow: 0 24px 70px rgba(0,0,0,0.65), 0 0 0 1px rgba(47,168,255,0.10), inset 0 1px 0 rgba(255,255,255,0.07);
}
.win.is-min{ display: none; }
.win.is-max{
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: 100% !important;
  max-height: none;
  border-radius: 0;
  border-width: 0;
}

/* Title bar: title on the LEFT, controls on the RIGHT (Windows layout) */
.win-bar{
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 0 0 12px;
  background: rgba(8, 12, 17, 0.55);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.win.is-dragging .win-bar{ cursor: grabbing; }
.win.is-max .win-bar{ cursor: default; }
.win-ico{ display: grid; place-items: center; color: var(--pulse); }
.win-ico svg{ width: 16px; height: 16px; }
.win-title{
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--steel);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win.is-active .win-title{ color: var(--mist); }

.win-ctrls{
  display: flex;
  margin-left: auto;   /* pins the button group to the right edge */
  height: 100%;
}
.wc{
  display: grid; place-items: center;
  width: 46px; height: 100%;
  background: transparent;
  border: 0;
  color: var(--steel);
  transition: background .12s, color .12s;
}
.wc svg{ width: 12px; height: 12px; }
.wc:hover{ background: rgba(148,176,199,0.14); color: var(--mist); }
.wc-close:hover{ background: #e5484d; color: #fff; }
.wc:focus-visible{ outline-offset: -3px; }

.win-body{
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,176,199,0.3) transparent;
}

/* ---------- Shared content styles ---------- */
.prompt{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
  margin-bottom: 12px;
}
.prompt::before{ content: "$ "; color: var(--steel-dim); }
.doc-name{ font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.doc-lede{ color: #c3ced8; max-width: 60ch; margin-bottom: 18px; }
.hint{ font-size: 12.5px; color: var(--steel); margin-top: 16px; max-width: 62ch; }
.sec{
  font-size: 13px; font-weight: 600; color: var(--mist);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.kv{
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  padding: 14px 16px;
  background: rgba(5,8,11,0.45);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.kv dt{ font-family: var(--font-mono); font-size: 12.5px; color: var(--steel); padding-top: 1px; }
.kv dd{ color: var(--mist); }
.dot{
  display: inline-block; width: 8px; height: 8px; margin-right: 8px;
  border-radius: 50%; background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
}

/* Code / script */
.code{
  margin: 0;
  padding: 16px 18px;
  background: rgba(5,8,11,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #cfd9e2;
  overflow-x: auto;
  tab-size: 2;
}
.code .c{ color: var(--steel-dim); font-style: italic; }
.code .k{ color: #c792ea; }
.code .s{ color: #a5e075; }
.code .v{ color: var(--amber); }
.code .f{ color: var(--pulse); }
.code .ok{ color: var(--signal); }

/* Tables */
.table-wrap{ overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.data{ width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data th, .data td{ padding: 9px 14px; text-align: left; white-space: nowrap; }
.data th{
  font-weight: 500; font-size: 12px; color: var(--steel);
  background: rgba(5,8,11,0.45);
  border-bottom: 1px solid var(--border);
}
.data td{ border-bottom: 1px solid rgba(148,176,199,0.08); }
.data tbody tr:last-child td{ border-bottom: 0; }
.data .num{ text-align: right; font-family: var(--font-mono); }
.data tr.rest td{ color: var(--steel); }
.data tr.today td{ background: var(--pulse-dim); }
.data tr.today td:first-child{ box-shadow: inset 3px 0 0 var(--pulse); color: var(--pulse); font-weight: 600; }

/* Bars */
.bar{
  height: 8px;
  background: rgba(148,176,199,0.12);
  border-radius: 99px;
  overflow: hidden;
}
.bar > span{
  display: block; height: 100%;
  background: var(--pulse);
  border-radius: inherit;
  transition: width .25s linear;
}
.bar-green > span{ background: var(--signal); }

.macro{ display: grid; gap: 12px; }
.macro-row{
  display: grid;
  grid-template-columns: 74px 1fr 150px;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
}
.macro-name{ color: var(--steel); }
.macro-val{ font-family: var(--font-mono); font-size: 12.5px; text-align: right; }

/* Games */
.games{ display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.game{
  display: flex; gap: 14px;
  padding: 14px;
  background: rgba(5,8,11,0.45);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cover{
  flex: none;
  display: grid; place-items: center;
  width: 84px; height: 112px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-weight: 700; font-size: 18px; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.9);
}
.cover-wwm{ background: linear-gradient(155deg, #12384a 0%, #0a1620 60%, #1c6e73 130%); }
.cover-spidey{ background: linear-gradient(155deg, #4a1220 0%, #0d1319 60%, #1f4f8f 130%); }
.game-info{ flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.game-info h2{ font-size: 15px; font-weight: 600; line-height: 1.3; }
.meta{ font-size: 12.5px; color: var(--steel); }
.status{ display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--steel); }
.pct{ font-family: var(--font-mono); color: var(--mist); }
.btn{
  align-self: flex-start;
  margin-top: auto;
  padding: 6px 14px;
  font-size: 12.5px; font-weight: 500;
  background: var(--pulse-dim);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  transition: background .15s;
}
.btn:hover:not(:disabled){ background: rgba(47,168,255,0.28); }
.btn:disabled{ cursor: default; color: var(--signal); background: var(--signal-dim); border-color: rgba(57,255,138,0.35); }
.game.is-done .bar > span{ background: var(--signal); }

/* Terminal log */
.term{
  padding: 16px 18px;
  background: rgba(2,4,6,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: #b8c5d1;
  overflow-x: auto;
}
.log{
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  opacity: 0;
  animation: logIn .25s ease forwards;
  animation-delay: calc(var(--i) * 140ms);
}
.log .t{ color: var(--steel-dim); }
.log .lvl{ display: inline-block; min-width: 4.2ch; color: var(--pulse); }
.log .lvl.ok{ color: var(--signal); }
.log .mask{ color: var(--amber); }
.log.fr{ color: var(--mist); }
.log.tr{ color: var(--steel); }
.caret{
  display: inline-block; width: 8px; height: 14px; margin-left: 4px;
  background: var(--signal); vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes logIn{ from{ opacity: 0; transform: translateY(4px); } to{ opacity: 1; transform: none; } }
@keyframes blink{ 50%{ opacity: 0; } }

/* =========================================================
   Taskbar
   ========================================================= */
.taskbar{
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--task-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px env(safe-area-inset-bottom, 0);
  background: rgba(8, 12, 17, 0.66);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
}
.start-btn{
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  font-size: 13px; font-weight: 600;
  color: var(--pulse);
  background: var(--pulse-dim);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  transition: background .15s;
}
.start-btn:hover, .start-btn[aria-expanded="true"]{ background: rgba(47,168,255,0.28); }

.task-items{
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.task-items::-webkit-scrollbar{ display: none; }
.task{
  position: relative;
  display: flex; align-items: center; gap: 8px;
  flex: 0 1 190px;
  min-width: 44px;
  height: 36px; padding: 0 12px;
  background: rgba(148,176,199,0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--steel);
  transition: background .15s, color .15s;
}
.task:hover{ background: rgba(148,176,199,0.14); color: var(--mist); }
.task svg{ flex: none; width: 15px; height: 15px; color: var(--pulse); }
.task span{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task::after{
  content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px;
  background: var(--steel-dim); border-radius: 2px;
}
.task.is-active{ color: var(--mist); background: var(--pulse-dim); border-color: var(--border-hi); }
.task.is-active::after{ background: var(--pulse); }
.task.is-min{ opacity: .7; }
.task.is-min::after{ left: 40%; right: 40%; }

.clock{
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 0 6px;
  font-family: var(--font-mono);
  line-height: 1.25;
  text-align: right;
}
.clock-time{ font-size: 13px; color: var(--mist); }
.clock-date{ font-size: 10.5px; color: var(--steel); }

/* =========================================================
   Start menu
   ========================================================= */
.start-menu{
  position: fixed;
  left: 10px; bottom: calc(var(--task-h) + 8px);
  z-index: 60;
  width: 290px;
  padding: 10px;
  background: var(--glass-hi);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .18s, transform .18s, visibility 0s .18s;
}
.start-menu.is-open{ opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s; }
.start-head{ padding: 6px 10px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--steel); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.start-list button, .start-exit{
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 9px 10px;
  background: transparent; border: 0; border-radius: 8px;
  font-family: var(--font-mono); font-size: 12.5px; text-align: left;
}
.start-list button:hover, .start-exit:hover{ background: var(--pulse-dim); }
.start-list svg{ width: 18px; height: 18px; color: var(--pulse); }
.start-exit{ margin-top: 6px; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; padding-top: 12px; color: var(--signal); }

/* =========================================================
   Mobile: windows snap to full screen
   ========================================================= */
@media (max-width: 700px){
  .win{
    left: 0 !important; top: 0 !important;
    width: 100% !important; height: 100% !important;
    max-height: none;
    border-radius: 0; border-width: 0;
  }
  .win-bar{ cursor: default; }
  .wc-max{ display: none; }
  .wc{ width: 52px; }
  .win-body{ padding: 16px 16px 20px; }

  .start-btn span{ display: none; }
  .start-btn{ padding: 0 11px; }
  .task{ flex: 0 0 auto; padding: 0 10px; }
  .task span{ display: none; }
  .clock-date{ display: none; }

  .desktop-icons{ grid-template-rows: repeat(auto-fill, 96px); grid-auto-columns: 92px; top: 10px; left: 8px; }
  .d-icon{ width: 92px; height: 96px; }

  .kv{ grid-template-columns: 1fr; gap: 2px; }
  .kv dt{ margin-top: 8px; }
  .kv dt:first-child{ margin-top: 0; }
  .macro-row{ grid-template-columns: 1fr; gap: 4px; }
  .macro-val{ text-align: left; }
  .game{ flex-direction: column; }
  .cover{ width: 100%; height: 72px; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .log{ opacity: 1; }
}