/*
  333amethyst — Windows 95-ish UI theme
  ------------------------------------------------------
  This stylesheet aims to mimic classic Win95: beveled borders,
  grey frames, pixel-y font, desktop icons, and a Start menu.
*/

:root {
  /* Desktop gradient */
  --bg-a: #2ea8a8;
  --bg-b: #5d2aa8;

  /* Win95-ish system colors */
  --c-face: #c0c0c0;
  --c-face-2: #d6d6d6;
  --c-shadow: #808080;
  --c-dkshadow: #404040;
  --c-hilite: #ffffff;
  --c-title: #000080;
  --c-title-text: #ffffff;
  --c-text: #111;
  --c-link: #0000ee;
  --c-select: #000080;
  --c-select-text: #fff;

  /* Sizing */
  --taskbar-h: 44px;
  --radius: 2px;
  --border: 2px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--c-text);
  background: #000;
  overflow: hidden; /* desktop holds its own scroll (icons) */

  /* Pixel font with sane fallbacks */
  font-family: "Press Start 2P", "MS Sans Serif", Tahoma, Verdana, system-ui,
    sans-serif;
  font-size: 12px;
  line-height: 1.35;
}

button,
input {
  font: inherit;
}

/* Desktop */
.desktop {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.desktop__gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      1200px 800px at 20% 30%,
      rgba(255, 255, 255, 0.12),
      transparent 55%
    ),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
  filter: saturate(1.05);
}

.desktop__icons {
  position: absolute;
  inset: 12px 12px calc(var(--taskbar-h) + 12px) 12px;
  z-index: 1;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  grid-auto-rows: 96px;
  gap: 10px;
  align-content: start;

  padding: 4px;
  overflow: auto;
  scrollbar-color: var(--c-shadow) var(--c-face);
}

.icon {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  padding: 8px 6px;
  border-radius: 4px;
  cursor: pointer;

  display: grid;
  place-items: center;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.icon:focus-visible {
  outline: 2px dotted #fff;
  outline-offset: 2px;
}

.icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.icon:active {
  background: rgba(0, 0, 0, 0.18);
}

.icon__img {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
}

.icon__label {
  text-align: center;
  font-size: 10px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* Window layer */
.window-layer {
  position: absolute;
  inset: 0 0 var(--taskbar-h) 0;
  z-index: 2;
  pointer-events: none; /* windows re-enable this */
}

/* 95-ish bevel helpers */
.bevel {
  border: var(--border) solid var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2);
  border-radius: var(--radius);
  background: var(--c-face);
}

.bevel--pressed {
  box-shadow:
    inset 1px 1px 0 var(--c-dkshadow),
    inset -1px -1px 0 var(--c-hilite),
    inset 2px 2px 0 var(--c-shadow),
    inset -2px -2px 0 var(--c-face-2);
}

/* Window */
.window {
  position: absolute;
  min-width: 240px;
  min-height: 180px;
  max-width: min(96vw, 980px);
  max-height: min(76vh, 820px);

  pointer-events: auto;
  user-select: none;

  transform: scale(0.98);
  opacity: 0;
  transition: transform 140ms ease, opacity 140ms ease;
}

.window.is-open {
  transform: scale(1);
  opacity: 1;
}

.window.is-closing {
  transform: scale(0.98);
  opacity: 0;
}

.window__frame {
  height: 100%;
  width: 100%;
}

.window__titlebar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px;

  background: var(--c-title);
  color: var(--c-title-text);
  cursor: grab;
}

.window__titlebar:active {
  cursor: grabbing;
}

.window__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.window__title img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.window__title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.window__controls {
  display: flex;
  gap: 6px;
}

.win-btn {
  width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--c-face);
  border: var(--border) solid var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2);
}

.win-btn:active {
  box-shadow:
    inset 1px 1px 0 var(--c-dkshadow),
    inset -1px -1px 0 var(--c-hilite),
    inset 2px 2px 0 var(--c-shadow),
    inset -2px -2px 0 var(--c-face-2);
}

.win-btn__x {
  width: 10px;
  height: 10px;
  position: relative;
}

.win-btn__x::before,
.win-btn__x::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid #000;
  transform: rotate(45deg);
  top: 50%;
}

.win-btn__x::after {
  transform: rotate(-45deg);
}

.window__body {
  padding: 10px;
  height: calc(100% - 32px);
  overflow: hidden;
  user-select: text;
}

.window__content {
  height: 100%;
  overflow: auto;
  background: #fff;
  color: #000;
  padding: 10px;
  border: 1px solid var(--c-shadow);
}

.window__content a {
  color: var(--c-link);
}

/* Resizer handles */
.resize-handle {
  position: absolute;
  z-index: 3;
  background: transparent;
}

.resize-handle[data-edge="n"],
.resize-handle[data-edge="s"] {
  left: 8px;
  right: 8px;
  height: 10px;
}

.resize-handle[data-edge="n"] {
  top: -5px;
  cursor: ns-resize;
}

.resize-handle[data-edge="s"] {
  bottom: -5px;
  cursor: ns-resize;
}

.resize-handle[data-edge="e"],
.resize-handle[data-edge="w"] {
  top: 8px;
  bottom: 8px;
  width: 10px;
}

.resize-handle[data-edge="e"] {
  right: -5px;
  cursor: ew-resize;
}

.resize-handle[data-edge="w"] {
  left: -5px;
  cursor: ew-resize;
}

.resize-handle[data-edge="ne"],
.resize-handle[data-edge="nw"],
.resize-handle[data-edge="se"],
.resize-handle[data-edge="sw"] {
  width: 14px;
  height: 14px;
}

.resize-handle[data-edge="ne"] {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}
.resize-handle[data-edge="nw"] {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}
.resize-handle[data-edge="se"] {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}
.resize-handle[data-edge="sw"] {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

/* Gallery */
.gallery-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--c-face);
  border: 1px solid var(--c-shadow);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.gallery-item {
  appearance: none;
  padding: 0;
  border: 1px solid var(--c-shadow);
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.gallery-item:focus-visible {
  outline: 2px dotted var(--c-select);
  outline-offset: 2px;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: cover;
  transform: scale(1);
  transition: transform 150ms ease, filter 150ms ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
  filter: contrast(1.05) saturate(1.08);
}

.gallery-caption {
  padding: 6px 8px;
  font-size: 10px;
  border-top: 1px solid #e9e9e9;
}

/* Taskbar */
.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  z-index: 5;

  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;

  background: var(--c-face);
  border-top: 2px solid var(--c-hilite);
  box-shadow: inset 0 1px 0 var(--c-face-2);
}

.start-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;

  border: var(--border) solid var(--c-face);
  background: var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2);
}

.start-button.is-open {
  box-shadow:
    inset 1px 1px 0 var(--c-dkshadow),
    inset -1px -1px 0 var(--c-hilite),
    inset 2px 2px 0 var(--c-shadow),
    inset -2px -2px 0 var(--c-face-2);
}

.start-button__mark {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #00a2ff, #00ff6a);
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.taskbar-tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  scrollbar-color: var(--c-shadow) var(--c-face);
}

.taskbar-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  max-width: 320px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  border: var(--border) solid var(--c-face);
  background: var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2);
}

.taskbar-tab.is-active {
  box-shadow:
    inset 1px 1px 0 var(--c-dkshadow),
    inset -1px -1px 0 var(--c-hilite),
    inset 2px 2px 0 var(--c-shadow),
    inset -2px -2px 0 var(--c-face-2);
  background: #eaeaea;
}

.taskbar__clock {
  padding: 6px 10px;
  border: 1px solid var(--c-shadow);
  background: #e9e9e9;
  font-size: 10px;
}

/* Start menu */
.start-menu {
  position: absolute;
  left: 8px;
  bottom: calc(var(--taskbar-h) - 2px);
  width: min(260px, calc(100vw - 16px));
  display: none;

  border: var(--border) solid var(--c-face);
  background: var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2),
    0 10px 24px rgba(0, 0, 0, 0.25);
}

.start-menu.is-open {
  display: grid;
  grid-template-columns: 34px 1fr;
}

.start-menu__brand {
  background: linear-gradient(180deg, #000080, #2b2b8a);
  color: #fff;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 10px 0;
}

.start-menu__brand-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  letter-spacing: 1px;
}

.start-menu__item {
  grid-column: 2;
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.start-menu__item:hover,
.start-menu__item:focus-visible {
  background: var(--c-select);
  color: var(--c-select-text);
  outline: none;
}

.start-menu__divider {
  grid-column: 2;
  height: 1px;
  background: var(--c-shadow);
  margin: 4px 8px;
}

/* System overlay (fake “Exit/Restart”) */
.system-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 999;
}

.system-overlay[hidden] {
  display: none !important;
}

.system-overlay__panel {
  width: min(420px, calc(100vw - 24px));
  padding: 14px;
  background: var(--c-face);
  border: var(--border) solid var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2),
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.system-overlay__title {
  background: var(--c-title);
  color: var(--c-title-text);
  padding: 8px 10px;
  margin: -14px -14px 12px -14px;
}

.system-overlay__subtitle {
  font-size: 10px;
  margin-bottom: 12px;
}

.system-overlay__close {
  padding: 8px 12px;
  cursor: pointer;
  border: var(--border) solid var(--c-face);
  background: var(--c-face);
  box-shadow:
    inset -1px -1px 0 var(--c-dkshadow),
    inset 1px 1px 0 var(--c-hilite),
    inset -2px -2px 0 var(--c-shadow),
    inset 2px 2px 0 var(--c-face-2);
}

.system-overlay__close:active {
  box-shadow:
    inset 1px 1px 0 var(--c-dkshadow),
    inset -1px -1px 0 var(--c-hilite),
    inset 2px 2px 0 var(--c-shadow),
    inset -2px -2px 0 var(--c-face-2);
}

/* Mobile tweaks */
@media (max-width: 640px) {
  body {
    font-size: 11px;
  }

  .desktop__icons {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    grid-auto-rows: 92px;
  }

  .taskbar-tab {
    min-width: 120px;
  }
}

/* ========================================================= */
/* WINAMP PLAYER STYLES                                      */
/* ========================================================= */

.winamp-player {
  position: absolute;
  width: 275px;
  background: linear-gradient(135deg, #aab3b8, #60686d);
  border-top: 2px solid #e1e9ed;
  border-left: 2px solid #e1e9ed;
  border-right: 2px solid #303437;
  border-bottom: 2px solid #303437;
  border-radius: 4px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
  font-family: "MS Sans Serif", Tahoma, Verdana, system-ui, sans-serif;
  color: #000;
  display: flex;
  flex-direction: column;
  padding: 2px;
  user-select: none;
  pointer-events: auto;
  z-index: 100;
}

.winamp-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #000080, #1084d0);
  padding: 2px 5px;
  cursor: grab;
  color: white;
  margin-bottom: 3px;
}

.winamp-titlebar:active {
  cursor: grabbing;
}

.winamp-title-text {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.winamp-close-btn {
  background: #c0c0c0;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  color: black;
  font-size: 8px;
  line-height: 8px;
  padding: 1px 3px;
  cursor: pointer;
  cursor: pointer;
}

.winamp-close-btn:active {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #cfcfcf;
  border-bottom: 1px solid #cfcfcf;
}

.winamp-main {
  background: linear-gradient(180deg, #6c757d, #343a40);
  border: 1px inset #000;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.winamp-screen {
  background: #000;
  border: 2px inset #555;
  border-radius: 3px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #00ff00;
  font-family: inherit; /* will use pixel font if available */
}

.winamp-time {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: #00ff00;
  text-shadow: 0px 0px 2px #00ff00;
  text-align: right;
  line-height: 1;
}

.winamp-visualizer-container {
  display: flex;
  justify-content: center;
  background: #000;
  padding: 2px;
  border: 1px solid #333;
}

.winamp-track-info {
  background: #001f00;
  border: 1px inset #333;
  padding: 2px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  overflow: hidden;
  white-space: nowrap;
  color: #00ff00;
  text-shadow: 0px 0px 2px #00ff00;
}

.winamp-track-marquee {
  display: inline-block;
  padding-left: 100%;
  animation: wa-marquee 10s linear infinite;
}

@keyframes wa-marquee {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

.winamp-slider-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: #c0c0c0;
  font-weight: bold;
}

.winamp-controls-row {
  display: flex;
  gap: 2px;
  align-items: center;
}

.winamp-btn {
  background: #bbbbbb;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
  color: #000;
  font-weight: bold;
}

.winamp-btn:active {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  background: #a9a9a9;
}

.winamp-volume-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: #c0c0c0;
  font-weight: bold;
}

/* Custom range inputs for that retro feel */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #000;
  border: 1px inset #555;
  width: 100%;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 12px;
  background: linear-gradient(180deg, #dfdfdf, #909090);
  border: 1px solid #000;
  border-top-color: #fff;
  border-left-color: #fff;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 12px;
  background: linear-gradient(180deg, #dfdfdf, #909090);
  border: 1px solid #000;
  border-top-color: #fff;
  border-left-color: #fff;
  cursor: pointer;
}

/* PLAYLIST WINDOW */
.winamp-playlist-container {
  margin-top: 4px;
  background: linear-gradient(135deg, #aab3b8, #60686d);
  border: 2px solid #e1e9ed;
  border-right-color: #303437;
  border-bottom-color: #303437;
  padding: 2px;
}

.winamp-playlist-title {
  background: #111;
  color: rgba(255,255,255,0.8);
  font-size: 9px;
  text-align: center;
  margin-bottom: 2px;
  border: 1px inset #444;
}

.winamp-playlist-list {
  background: #000;
  border: 2px inset #555;
  margin: 0;
  padding: 2px;
  list-style: none;
  height: 80px;
  overflow-y: auto;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #00ff00;
}

.winamp-playlist-list li {
  padding: 3px 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winamp-playlist-list li:hover {
  background: #003300;
}

.winamp-playlist-list li.active {
  background: #000080;
  color: #ffffff;
}
