:root {
  /* Simplified Win98 Greyscale Ramp (6 shades) */
  --grey-0: #ffffff; /* White / Highlight */
  --grey-1: #e6e6e6; /* Soft Light Face */
  --grey-2: #c0c0c0; /* Standard Win98 Silver Face */
  --grey-3: #808080; /* Shadow / Muted */
  --grey-4: #404040; /* Dark Shadow */
  --grey-5: #000000; /* Pure Black */

  --bg-color: var(--grey-5);
  --fg-color: var(--grey-0);

  --win-face: var(--grey-2);
  --win-face-light: var(--grey-1);
  --win-shadow: var(--grey-3);
  --win-shadow-deep: var(--grey-4);
  --win-highlight: var(--grey-0);
  --win-dark: var(--grey-5);

  --win-text: var(--grey-5);
  --win-text-muted: var(--grey-3);
  --win-text-soft: var(--grey-4);

  --taskbar-height: 40px;
  --ui-font: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Geneva, sans-serif;
  --desktop-wallpaper: url("background.png");
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  font-family: var(--ui-font);
  font-size: 11px;
  color: var(--win-text);
  background-color: var(--bg-color);
  user-select: none;
  -webkit-user-select: none;
}

body {
  min-height: 100vh;
}

/* Global Image Selection & Drag Prevention */
img {
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

/* --- Win98 Buttons --- */
.win-button {
  min-width: 80px;
  height: 24px;
  padding: 2px 10px;
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: bold;
  color: var(--grey-5);
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  cursor: pointer;
  user-select: none;
}

.win-button:active {
  border-color: var(--grey-5) var(--grey-0) var(--grey-0) var(--grey-5);
  padding: 3px 9px 1px 11px;
}

.win-button--danger {
  color: #cc0000;
}

/* --- 1. Intro Screen & Warning Popup --- */
.intro-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.intro-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(440px, 100%);
}

.intro-card {
  width: 100%;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.intro-logo {
  max-width: 240px;
  height: auto;
  object-fit: contain;
}

.intro-buttons-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.win-button--warning {
  min-width: 30px;
  width: 30px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.warning-triangle-icon {
  width: 16px;
  height: 16px;
  fill: #ff0000;
}

.intro-disclaimer {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--grey-4);
  border-top: 1px solid var(--grey-3);
  padding-top: 14px;
}

/* Intro Warning Popup */
.intro-warning-popup {
  width: 100%;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
}

.intro-warning-body {
  padding: 12px 16px;
  color: var(--grey-5);
  background: var(--win-face);
}

.intro-warning-message {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--grey-5);
}

/* --- 2. Boot Screen --- */
.boot-screen {
  position: fixed;
  inset: 0;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
  opacity: 1;
}

.boot-screen.is-fading-out {
  opacity: 0;
}

.boot-content {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-logo {
  max-width: 320px;
  max-height: 50vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.8s ease-in-out;
}

.boot-logo.is-faded-in {
  opacity: 1;
}

/* Win98 Greyscale Boot Loader Progress Bar */
.boot-bar {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 18px;
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: var(--grey-5);
  padding: 2px;
  overflow: hidden;
}

.boot-bar__blocks {
  display: flex;
  gap: 3px;
  position: absolute;
  top: 2px;
  bottom: 2px;
  animation: win98-boot-slide 1.2s infinite linear;
}

.boot-bar__block {
  width: 10px;
  height: 100%;
  background: var(--grey-2);
  border: 1px solid var(--grey-1);
}

@keyframes win98-boot-slide {
  0% { left: -40px; }
  100% { left: 220px; }
}

/* --- 3. Shutdown Glitch Screen --- */
.shutdown-screen[hidden] {
  display: none !important;
}

.shutdown-screen:not([hidden]) {
  position: fixed;
  inset: 0;
  background-color: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  cursor: pointer;
}

.crt-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 10;
}

.shutdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  z-index: 20;
  user-select: none;
}

.glitch-text,
.glitch-text-sm {
  font-family: monospace;
  font-weight: bold;
  color: var(--grey-1);
  position: relative;
  margin: 0;
}

.glitch-text {
  font-size: 8vw;
}

.glitch-text-sm {
  font-size: 1.2rem;
  color: var(--grey-2);
}

.glitch-text::before,
.glitch-text::after,
.glitch-text-sm::before,
.glitch-text-sm::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  background: var(--bg-color);
  color: var(--grey-0);
  overflow: hidden;
}

.glitch-text::before,
.glitch-text-sm::before {
  left: -2px;
  text-shadow: 2px 0 var(--grey-3);
  animation: glitch-anim-1 0.4s infinite linear alternate-reverse;
}

.glitch-text::after,
.glitch-text-sm::after {
  left: 2px;
  text-shadow: -2px 0 var(--grey-4);
  animation: glitch-anim-2 0.3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% { clip-path: inset(20% 0 80% 0); }
  20% { clip-path: inset(60% 0 10% 0); }
  40% { clip-path: inset(40% 0 50% 0); }
  60% { clip-path: inset(80% 0 5% 0); }
  80% { clip-path: inset(10% 0 70% 0); }
  100% { clip-path: inset(30% 0 40% 0); }
}

@keyframes glitch-anim-2 {
  0% { clip-path: inset(10% 0 60% 0); }
  20% { clip-path: inset(30% 0 20% 0); }
  40% { clip-path: inset(70% 0 10% 0); }
  60% { clip-path: inset(20% 0 50% 0); }
  80% { clip-path: inset(90% 0 5% 0); }
  100% { clip-path: inset(50% 0 30% 0); }
}

/* --- 4. BSOD Fullscreen Overlay --- */
.bsod-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bsod-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Heavy Single Freeze Frame Glitch Filters & Shifts */
.desktop__surface.is-frozen-glitch::before,
.desktop__surface.is-frozen-glitch::after {
  animation-play-state: paused !important;
}

.desktop.is-bsod-freezing {
  pointer-events: none !important;
  user-select: none !important;
}

.desktop.is-bsod-freezing .desktop__surface {
  filter: contrast(280%) brightness(130%);
}

.desktop.is-bsod-freezing .desktop__surface::before {
  clip-path: inset(12% 0 42% 0);
  transform: translateX(var(--freeze-surface-shift-1, -60px));
  filter: contrast(300%) brightness(180%) invert(40%);
}

.desktop.is-bsod-freezing .desktop__surface::after {
  clip-path: inset(52% 0 10% 0);
  transform: translateX(var(--freeze-surface-shift-2, 60px));
  filter: saturate(300%) hue-rotate(180deg) brightness(150%);
}

.desktop.is-bsod-freezing .taskbar {
  transform: translateX(var(--freeze-taskbar-shift, -35px));
  filter: contrast(220%) brightness(140%) invert(20%);
}

.desktop.is-bsod-freezing .desktop__icons {
  transform: translate(var(--freeze-icons-shift-x, 30px), var(--freeze-icons-shift-y, -12px));
  filter: contrast(200%) brightness(130%);
}

.desktop.is-bsod-freezing .win-window:not([hidden]) {
  transform: translate(var(--freeze-window-shift-x, 22px), var(--freeze-window-shift-y, -12px));
  filter: contrast(220%) brightness(130%) invert(10%);
  pointer-events: none !important;
}

/* Desktop */
.desktop {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-color);
}

.desktop.is-fading-in {
  animation: fast-fade-desktop 0.4s ease forwards;
}

@keyframes fast-fade-desktop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.desktop__surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--bg-color);
  background-image: var(--desktop-wallpaper);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Desktop Icons Container */
.desktop__icons {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  z-index: 1;
}

/* Desktop Icon Style */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  padding: 8px 6px;
  background: transparent;
  border: 1px dotted transparent;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  position: relative;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  border-color: var(--grey-0);
  background: rgba(255, 255, 255, 0.15);
}

.desktop-icon.is-dragging-icon {
  z-index: 1000 !important;
  opacity: 0.85;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.2);
}

.desktop-icon__img,
.desktop-icon__svg {
  width: 52px;
  height: 52px;
  object-fit: contain;
  color: var(--grey-0);
  filter: drop-shadow(0px 1px 3px rgba(0, 0, 0, 0.8));
}

.desktop-icon__label {
  margin-top: 6px;
  font-size: 12px;
  font-weight: bold;
  color: var(--grey-0);
  text-align: center;
  text-shadow: 1px 1px 2px var(--grey-5), -1px -1px 2px var(--grey-5);
  word-break: break-word;
}

/* Trash Bin Icon Positioning */
.desktop-icon--trash {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 15px);
  right: 20px;
  z-index: 5;
}

.desktop-icon--trash.is-trash-hover {
  background: rgba(255, 0, 0, 0.35);
  border-color: #ff0000;
  transform: scale(1.1);
}

/* Clean Trashed Icon State (Maintains slot space invisibly) */
.desktop-icon.is-trashed {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Resizable Windows 98 Window */
.win-window {
  position: absolute;
  top: 30px;
  left: 50px;
  width: min(860px, calc(100vw - 40px));
  height: min(600px, calc(100vh - var(--taskbar-height) - 40px));
  min-width: 340px;
  min-height: 240px;
  max-width: 100vw;
  max-height: calc(100vh - var(--taskbar-height));
  display: flex;
  flex-direction: column;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
  z-index: 10;
  resize: both;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.win-window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px;
  background: linear-gradient(90deg, var(--grey-5) 0%, var(--grey-4) 100%);
  color: var(--grey-0);
  font-weight: bold;
  font-size: 11px;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}

.win-window__title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.win-window__icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  color: var(--grey-0);
}

.win-window__controls {
  display: flex;
  gap: 2px;
}

.win-window__btn {
  width: 16px;
  height: 14px;
  padding: 0;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
  border: 1px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  color: var(--grey-5);
  cursor: pointer;
}

.win-window__btn:active {
  border-color: var(--grey-4) var(--grey-0) var(--grey-0) var(--grey-4);
  padding: 1px 0 0 1px;
}

/* IE98 Address Bar Styling */
.ie-toolbar {
  background: var(--win-face);
  border-bottom: 2px solid var(--grey-3);
  padding: 4px 6px;
  user-select: none;
}

.ie-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ie-address-label {
  font-weight: bold;
  font-size: 11px;
  color: var(--grey-5);
}

.ie-address-box {
  flex: 1;
  background: var(--grey-0);
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ie-address-link {
  color: #0000ff;
  text-decoration: underline;
  cursor: pointer;
  font-size: 11px;
}

.ie-address-link:hover {
  color: #ff0000;
}

/* Window Content Body */
.win-window__body {
  flex: 1;
  position: relative;
  background: #000000;
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  margin: 2px;
  overflow-y: auto;
}

.win-window__body--kofi {
  background: #f9f9f9;
}

.win-window__body--othertube {
  background: #181818;
  color: #ffffff;
  padding: 10px;
}

.win-window__body--chat {
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.chat-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Settings Window Styling */
#window-settings {
  width: 360px;
  height: auto;
  min-width: 320px;
  min-height: 220px;
}

.win-window__body--settings {
  background: var(--win-face);
  color: var(--grey-5);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.win-fieldset {
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-3) var(--grey-3) var(--grey-0);
  padding: 10px 12px;
  margin: 0;
  background: var(--win-face);
}

.win-fieldset--danger {
  border-color: var(--grey-0) var(--grey-3) var(--grey-3) var(--grey-0);
}

.win-legend {
  font-weight: bold;
  font-size: 11px;
  color: var(--grey-5);
  padding: 0 4px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.settings-checkbox-label input {
  cursor: pointer;
}

.settings-help-text {
  margin: 0 0 8px 0;
  font-size: 10px;
  color: var(--grey-4);
  line-height: 1.3;
}

.settings-danger-zone {
  display: flex;
  justify-content: flex-end;
}

/* Steam Image Container & Enlarged Overlay Link */
.steam-img-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.steam-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.steam-overlay-link {
  position: absolute;
  top: 50%;
  left: 70%;
  transform: translate(-50%, -50%);
  color: #4199fd;
  text-decoration: underline;
  font-family: var(--ui-font);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.85);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(65, 153, 253, 0.6);
  text-shadow: 1px 1px 2px #000000;
  white-space: nowrap;
}

.steam-overlay-link:hover {
  color: #66c0f4;
  background: rgba(0, 0, 0, 0.98);
}

/* --- Media Player Windows 98 Skin --- */
.wmp-window {
  width: 420px;
  height: 310px;
  min-width: 320px;
  min-height: 250px;
  background: var(--win-face);
}

.wmp-body {
  flex: 1;
  background: var(--win-face);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Sunken Black LCD Screen */
.wmp-lcd-screen {
  flex: 1;
  background: #000000;
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.wmp-lcd-screen__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: monospace;
  color: #33ff33;
  font-weight: bold;
  font-size: 11px;
}

.wmp-lcd-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.wmp-music-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 0;
}

.wmp-music-note-box {
  width: 90px;
  height: 90px;
  border: 1px solid var(--grey-4);
  background: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}

.wmp-music-note {
  width: 50px;
  height: 50px;
  color: #e0e0e0;
}

/* Win98 Timeline Seeker */
.wmp-seek-row {
  display: flex;
  align-items: center;
}

.wmp-seeker {
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--grey-4);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.wmp-seeker::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: 1px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: var(--grey-5);
}

.wmp-seeker::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  cursor: pointer;
}

/* Win98 Buttons & Volume Controls */
.wmp-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.wmp-controls__left {
  display: flex;
  align-items: center;
  gap: 3px;
}

.wmp-controls__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wmp-btn {
  min-width: 28px;
  height: 24px;
  padding: 0 4px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  color: var(--grey-5);
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.wmp-btn-svg {
  width: 14px;
  height: 14px;
  color: var(--grey-5);
  display: block;
}

.wmp-btn:active,
.wmp-btn.is-pressed {
  border-color: var(--grey-4) var(--grey-0) var(--grey-0) var(--grey-4);
  background: var(--grey-1);
  padding: 1px 0 0 1px;
}

.wmp-btn--mute {
  min-width: 26px;
}

.wmp-volume-slider {
  width: 70px;
  height: 18px;
  margin: 0;
  accent-color: var(--grey-4);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.wmp-volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: 1px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: var(--grey-5);
}

.wmp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  cursor: pointer;
}

/* --- OtherTube UI --- */
.othertube-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #333333;
}

.othertube-logo {
  font-size: 18px;
  font-weight: bold;
  font-family: sans-serif;
  letter-spacing: -0.5px;
}

.othertube-logo__red {
  background: #ff0000;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 3px;
}

.othertube-logo__black {
  color: #ffffff;
  margin-left: 2px;
}

.othertube-search {
  display: flex;
  gap: 4px;
}

.othertube-search__input {
  background: #121212;
  border: 1px solid #444444;
  color: #ffffff;
  padding: 4px 8px;
  font-size: 11px;
  width: 180px;
}

.othertube-search__btn {
  background: #333333;
  border: 1px solid #555555;
  color: #ffffff;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.othertube-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.othertube-card {
  background: #202020;
  border: 1px solid #333333;
  border-radius: 4px;
  overflow: hidden;
}

.othertube-card__video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  background: #000000;
}

.othertube-card__video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.othertube-card__thumb {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.othertube-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.othertube-card__thumb:hover img {
  transform: scale(1.04);
  opacity: 0.85;
}

.othertube-card__play {
  position: absolute;
  width: 48px;
  height: 34px;
  background: rgba(255, 0, 0, 0.9);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: background 0.2s ease, transform 0.2s ease;
}

.othertube-card__play svg {
  width: 20px;
  height: 20px;
}

.othertube-card__thumb:hover .othertube-card__play {
  background: #ff0000;
  transform: scale(1.1);
}

.othertube-card__meta {
  padding: 6px 8px;
  background: #181818;
  border-top: 1px solid #333333;
  text-align: right;
}

.othertube-card__link {
  color: #3ea6ff;
  font-size: 11px;
  text-decoration: none;
  font-weight: bold;
}

.othertube-card__link:hover {
  text-decoration: underline;
  color: #65b8ff;
}

.othertube-loading,
.othertube-empty,
.othertube-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: #aaaaaa;
  font-size: 12px;
}

.win-window__resize-grip {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    var(--grey-3) 0,
    var(--grey-3) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Win98 Dialog Window */
.win-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
  z-index: 999;
  user-select: none;
}

.win-dialog__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px;
  background: linear-gradient(90deg, var(--grey-5) 0%, var(--grey-4) 100%);
  color: var(--grey-0);
  font-weight: bold;
  font-size: 11px;
}

.win-dialog__body {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px 15px;
}

.win-dialog__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--grey-5);
  color: var(--grey-0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  user-select: none;
}

.win-dialog__message {
  margin: 0;
  font-size: 11px;
  color: var(--grey-5);
  line-height: 1.4;
}

.win-dialog__footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 15px 15px;
}

.win-dialog__button {
  min-width: 70px;
  height: 23px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  color: var(--grey-5);
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
}

.win-dialog__button:active {
  border-color: var(--grey-4) var(--grey-0) var(--grey-0) var(--grey-4);
  padding: 1px 0 0 1px;
}

/* Taskbar & Open App Buttons */
.taskbar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--taskbar-height);
  padding: 3px 6px;
  background: var(--win-face);
  border-top: 2px solid var(--grey-0);
  box-shadow: inset 0 1px 0 var(--grey-1);
}

.taskbar__left,
.taskbar__right {
  display: flex;
  align-items: center;
}

.taskbar__left {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.taskbar__tasks {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  overflow-x: auto;
  max-width: calc(100vw - 220px);
}

/* Taskbar Button Style */
.taskbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  min-width: 60px;
  max-width: 160px;
  flex: 1;
  padding: 2px 6px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  color: var(--grey-5);
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

.taskbar-btn:active,
.taskbar-btn.is-active {
  border-color: var(--grey-4) var(--grey-0) var(--grey-0) var(--grey-4);
  background: var(--grey-1);
  box-shadow: inset 1px 1px 1px var(--grey-4);
  padding: 3px 5px 1px 7px;
}

.taskbar-btn__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
}

.taskbar-btn__icon svg {
  width: 14px;
  height: 14px;
}

.taskbar-btn__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Classic Windows 98 3D Start Button */
.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 82px;
  height: 28px;
  padding: 2px 10px 2px 6px;
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: bold;
  color: var(--grey-5);
  cursor: pointer;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: inset 1px 1px 0 var(--grey-1), inset -1px -1px 0 var(--grey-3);
  user-select: none;
  flex-shrink: 0;
}

.start-button:active,
.start-button.is-open {
  border-color: var(--grey-5) var(--grey-0) var(--grey-0) var(--grey-5);
  background: var(--win-face);
  color: var(--grey-5);
  box-shadow: inset 1px 1px 1px var(--grey-4);
  padding: 3px 9px 1px 7px;
}

.start-button:focus-visible {
  outline: 1px dotted var(--grey-5);
  outline-offset: -4px;
}

.start-button__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--grey-5);
}

.start-button__label {
  font-weight: bold;
  letter-spacing: 0.2px;
  color: var(--grey-5);
}

/* Start Menu */
.start-menu {
  position: absolute;
  bottom: calc(var(--taskbar-height) + 2px);
  left: 2px;
  z-index: 1000;
  display: flex;
  width: min(280px, calc(100vw - 8px));
  min-height: 360px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
}

.start-menu__stripe {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 40px;
  padding: 15px 5px;
  background: linear-gradient(
    90deg,
    var(--grey-1) 0%,
    var(--grey-2) 40%,
    var(--grey-3) 100%
  );
  color: var(--grey-5);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  user-select: none;
  box-shadow: inset -1px 0 0 var(--grey-3);
}

.start-menu__otherworld {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.start-menu__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 10px 10px;
  background: var(--win-face);
}

.start-menu__user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.start-menu__avatar {
  width: 80px;
  height: 80px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-3) var(--grey-3) var(--grey-0);
  border-radius: 50%;
  object-fit: cover;
  background: var(--grey-4);
  box-shadow: inset 0 0 0 1px var(--grey-3);
}

.start-menu__username {
  font-size: 16px;
  font-weight: bold;
  color: var(--grey-5);
}

/* Small Start Menu Copyright Note */
.start-menu__copyright {
  font-size: 9px;
  color: var(--grey-4);
  text-align: center;
  margin-top: auto;
  padding-bottom: 4px;
  user-select: none;
}

.start-menu__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--grey-3);
  padding-top: 8px;
}

.start-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--grey-5);
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  text-align: left;
}

.start-menu__item:hover {
  background: var(--grey-5);
  color: var(--grey-0);
}

.start-menu__item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* System Tray */
.tray {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--grey-5);
  position: relative;
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: var(--win-face);
  box-shadow: inset 1px 1px 0 var(--grey-4);
}

.volume-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tray__volume-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--grey-5);
  cursor: pointer;
}

.tray__volume-button:focus-visible {
  outline: 1px dotted var(--grey-5);
  outline-offset: 1px;
}

.tray__volume-button.is-open,
.tray__volume-button:active {
  border: 1px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: var(--grey-1);
}

.speaker-icon {
  width: 16px;
  height: 16px;
}

/* Authentic Win98 Volume Slider Popup */
.volume-popup {
  position: absolute;
  right: -8px;
  bottom: calc(100% + 6px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 52px;
  padding: 8px 8px 10px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-5) var(--grey-5) var(--grey-0);
  background: var(--win-face);
  box-shadow: 2px 2px 0 var(--grey-4);
  color: var(--grey-5);
  user-select: none;
}

.volume-popup__label {
  font-size: 11px;
  font-weight: bold;
}

.volume-popup__track-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 120px;
  padding: 0;
  border: 2px solid;
  border-color: var(--grey-3) var(--grey-0) var(--grey-0) var(--grey-3);
  background: #a0a0a0;
  box-shadow: inset 1px 1px 1px var(--grey-4);
  position: relative;
  overflow: hidden;
}

.volume-popup__slider {
  width: 100px;
  height: 20px;
  margin: 0;
  padding: 0;
  transform: rotate(-90deg);
  transform-origin: center center;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
}

.volume-popup__slider:focus {
  outline: none;
}

.volume-popup__slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: 1px solid;
  border-color: var(--grey-4) var(--grey-1) var(--grey-1) var(--grey-4);
  background: var(--grey-5);
  cursor: pointer;
}

.volume-popup__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 20px;
  margin-top: -8px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  box-shadow: inset 1px 1px 0 var(--grey-0);
  cursor: pointer;
}

.volume-popup__slider:active::-webkit-slider-thumb {
  border-color: var(--grey-4) var(--grey-0) var(--grey-0) var(--grey-4);
  background: var(--grey-1);
}

.volume-popup__slider::-moz-range-track {
  width: 100%;
  height: 4px;
  border: 1px solid;
  border-color: var(--grey-4) var(--grey-1) var(--grey-1) var(--grey-4);
  background: var(--grey-5);
  cursor: pointer;
}

.volume-popup__slider::-moz-range-thumb {
  width: 12px;
  height: 20px;
  border: 2px solid;
  border-color: var(--grey-0) var(--grey-4) var(--grey-4) var(--grey-0);
  background: var(--win-face);
  border-radius: 0;
  cursor: pointer;
}

.tray__time {
  white-space: nowrap;
}

/* --- Dynamic Background Screen Tearing & Glitch Variants --- */
.desktop__surface[class*="is-glitching"]::before,
.desktop__surface[class*="is-glitching"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--desktop-wallpaper);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.desktop__surface.is-glitching-tear-1::before {
  clip-path: inset(18% 0 48% 0);
  transform: translateX(-35px);
  filter: contrast(170%) brightness(120%);
}

.desktop__surface.is-glitching-tear-1::after {
  clip-path: inset(55% 0 15% 0);
  transform: translateX(40px);
  filter: saturate(190%) hue-rotate(-25deg);
}

.desktop__surface.is-glitching-tear-2::before {
  clip-path: inset(8% 0 72% 0);
  transform: translateX(50px) skewX(-3deg);
  filter: invert(15%) contrast(180%);
  animation: tear-shake 0.12s steps(2) infinite;
}

.desktop__surface.is-glitching-tear-2::after {
  clip-path: inset(38% 0 22% 0);
  transform: translateX(-45px) skewX(2deg);
  filter: brightness(140%) hue-rotate(90deg);
  animation: tear-shake 0.12s steps(2) reverse infinite;
}

.desktop__surface.is-glitching-flicker::before {
  clip-path: inset(30% 0 40% 0);
  transform: translate(-12px, 4px);
  filter: contrast(140%) brightness(130%);
}

.desktop__surface.is-glitching-flicker::after {
  clip-path: inset(70% 0 5% 0);
  transform: translate(18px, -3px);
  filter: grayscale(100%) invert(30%);
}

@keyframes tear-shake {
  0% { transform: translateX(35px) scaleY(1.02); }
  50% { transform: translateX(-40px) scaleY(0.98); }
  100% { transform: translateX(25px); }
}

@media (max-width: 600px) {
  .othertube-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  :root {
    --taskbar-height: 38px;
  }

  .taskbar {
    gap: 8px;
    padding: 3px 4px;
  }

  .start-button {
    min-width: 72px;
    height: 28px;
    font-size: 12px;
  }

  .tray {
    gap: 10px;
    padding: 0 8px;
    font-size: 12px;
  }

  .volume-popup {
    right: -4px;
  }
}