:root {
  --bg-main:    #213248;
  --bg-card:    #000;
  --color-primary:       #4074cf;
  --color-primary-hover: #5585d8;
  --color-text:  #e2ecf8;
  --color-muted: #8aaecb;
  --border-soft: #4074cf33;
  --adwaita-top:    #444;
  --adwaita-bottom: #393939;
  --adwaita-border: #1e1e1e;
  --adwaita-label:  rgba(255,255,255,0.87);
  --wm-close-bg:    #f05454;
  --wm-close-bdr:   #c94040;
  --wm-grey-bg:     #c9c9c9;
  --wm-grey-bdr:    #a0a0a0;
  --tb-h:        44px;
  --tb-bg:       rgba(15,22,35,0.97);
  --tb-border:   rgba(64,116,207,0.18);
  --tb-text:     #c8ddf0;
  --sm-bg:       rgba(18,28,46,0.97);
  --sm-border:   rgba(64,116,207,0.25);
  --sm-w-left:   220px;
  --sm-w-right:  180px;
  --sm-h:        420px;

  --handle-size: 6px;
  --corner-size: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

body {
  background-color: var(--bg-main);
  background-image: url(/assets/images/background.png);
  color: var(--color-text);
  font-family: 'Share Tech Mono', monospace;
  height: 100vh;
  overflow: hidden;
}

.terminal {
  position: fixed;
  width: 560px;
  min-width: 320px;
  min-height: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: visible;
  transition: box-shadow 0.15s;
}

.terminal.maximized { border-radius: 0; box-shadow: none; }

.terminal.flash { animation: wflash 0.3s ease; }
@keyframes wflash {
  0%,100% { box-shadow: 0 8px 32px rgba(0,0,0,0.6); }
  50%      { box-shadow: 0 0 0 3px var(--color-primary); }
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 10px;
  background: linear-gradient(to bottom, var(--adwaita-top), var(--adwaita-bottom));
  border-bottom: 1px solid var(--adwaita-border);
  border-radius: 8px 8px 0 0;
  cursor: grab;
  user-select: none;
  position: relative;
}
.terminal-titlebar:active { cursor: grabbing; }
.terminal.maximized .terminal-titlebar { border-radius: 0; }

.titlebar-label {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--adwaita-label);
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}

.titlebar-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.wm-btn {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.12s;
}
.wm-btn:hover { filter: brightness(1.2); }
.wm-btn svg { opacity: 0; transition: opacity 0.12s; display: block; }
.terminal-titlebar:hover .wm-btn svg { opacity: 1; }

.wm-close    { background: var(--wm-close-bg); box-shadow: inset 0 0 0 0.5px var(--wm-close-bdr); }
.wm-minimize { background: var(--wm-grey-bg);  box-shadow: inset 0 0 0 0.5px var(--wm-grey-bdr); }
.wm-maximize { background: var(--wm-grey-bg);  box-shadow: inset 0 0 0 0.5px var(--wm-grey-bdr); }

.terminal-body {
  padding: 16px 20px;
  font-size: 0.82rem;
  line-height: 2;
  color: var(--color-muted);
  height: calc(100% - 38px);
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}
.prompt  { color: var(--color-primary); }
.output  { padding-left: 1rem; display: inline-block; }
.cursor  {
  display: inline-block; width: 9px; height: 1em;
  background: white; vertical-align: middle; margin-left: 2px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.resize-handle { position: absolute; z-index: 10; }
.resize-n  { top: calc(-1 * var(--handle-size)/2); left: var(--corner-size); right: var(--corner-size); height: var(--handle-size); cursor: n-resize; }
.resize-s  { bottom: calc(-1 * var(--handle-size)/2); left: var(--corner-size); right: var(--corner-size); height: var(--handle-size); cursor: s-resize; }
.resize-w  { left: calc(-1 * var(--handle-size)/2); top: var(--corner-size); bottom: var(--corner-size); width: var(--handle-size); cursor: w-resize; }
.resize-e  { right: calc(-1 * var(--handle-size)/2); top: var(--corner-size); bottom: var(--corner-size); width: var(--handle-size); cursor: e-resize; }
.resize-nw { top: calc(-1 * var(--corner-size)/2); left: calc(-1 * var(--corner-size)/2); width: var(--corner-size); height: var(--corner-size); cursor: nw-resize; }
.resize-ne { top: calc(-1 * var(--corner-size)/2); right: calc(-1 * var(--corner-size)/2); width: var(--corner-size); height: var(--corner-size); cursor: ne-resize; }
.resize-sw { bottom: calc(-1 * var(--corner-size)/2); left: calc(-1 * var(--corner-size)/2); width: var(--corner-size); height: var(--corner-size); cursor: sw-resize; }
.resize-se { bottom: calc(-1 * var(--corner-size)/2); right: calc(-1 * var(--corner-size)/2); width: var(--corner-size); height: var(--corner-size); cursor: se-resize; }

.taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tb-h);
  background: var(--tb-bg);
  border-top: 1px solid var(--tb-border);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  z-index: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tb-start {
  width: 36px; height: 36px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.tb-start:hover   { background: rgba(255,255,255,0.08); }
.tb-start.active  { background: rgba(64,116,207,0.25); }

.tb-sep {
  width: 1px; height: 22px;
  background: rgba(255,255,255,0.1);
  margin: 0 4px;
  flex-shrink: 0;
}

.tb-windows {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

.tb-window-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  height: 34px;
  border-radius: 5px;
  font-size: 0.72rem;
  color: var(--tb-text);
  transition: background 0.12s;
  max-width: 160px;
  overflow: hidden;
}
.tb-window-item:hover { background: rgba(255,255,255,0.07); }

.tb-win-icon {
  width: 22px; height: 22px;
  background: #111;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.tb-win-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tb-win-indicator {
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.15s;
}

.tb-item-active .tb-win-indicator    { opacity: 1; }
.tb-item-minimized .tb-window-item   { opacity: 0.55; }
.tb-item-closed .tb-win-indicator    { opacity: 0; }

.tb-item-active  .tb-window-item,
.tb-window-item.tb-item-active { background: rgba(64,116,207,0.18); }

.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.tb-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: default;
  transition: background 0.12s;
}
.tb-clock:hover { background: rgba(255,255,255,0.06); }

#tb-time { font-size: 0.82rem; color: #ddeeff; }
#tb-date { font-size: 0.62rem; color: var(--color-muted); }

.startmenu {
  position: fixed;
  bottom: var(--tb-h);
  left: 8px;
  width: calc(var(--sm-w-left) + var(--sm-w-right));
  height: var(--sm-h);
  background: var(--sm-bg);
  border: 1px solid var(--sm-border);
  border-radius: 10px 10px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 600;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.startmenu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.startmenu-inner {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sm-left {
  width: var(--sm-w-left);
  padding: 20px 16px 12px;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sm-section-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.sm-pinned {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sm-app {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--color-text);
  transition: background 0.12s;
  text-align: left;
  width: 100%;
}
.sm-app:hover { background: rgba(255,255,255,0.07); }

.sm-app-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sm-icon-img  { background: transparent; border: none; padding: 0; overflow: hidden; border-radius: 8px; }
.sm-icon-img img { width: 36px; height: 36px; display: block; object-fit: cover; border-radius: 8px; }
.sm-icon-term  { background: #111; border: 1px solid rgba(255,255,255,0.1); }

.sm-right {
  flex: 1;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0,0,0,0.15);
}

.sm-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  gap: 8px;
}
.sm-info-key { color: var(--color-muted); }
.sm-info-val { color: var(--color-text);  text-align: right; }

.sm-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 4px 0;
}

.sm-link {
  display: block;
  font-size: 0.72rem;
  color: var(--color-primary);
  padding: 4px 0;
  transition: color 0.12s;
}
.sm-link:hover { color: var(--color-primary-hover); }

/* ── Footer bar ──────────────────────────────────────── */
.sm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  background: rgba(0,0,0,0.25);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--color-text);
}

.sm-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.sm-power {
  width: 28px; height: 28px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--tb-text);
  transition: background 0.12s;
}
.sm-power:hover { background: rgba(240,84,84,0.2); }