* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-url: url("background.jpg");
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  background-image: var(--bg-url);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  transition: background-image 0.25s ease-in-out;
}

.outer {
  position: relative;
  width: 100%;
  height: 100%;
}

.theme-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  color: #f5f5f5;
  font-size: 12px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.theme-toggle label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.theme-toggle .theme-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: none;
}

.theme-toggle select {
  font-size: 12px;
  padding: 6px 26px 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #f5f5f5 !important;
  outline: none !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: inherit !important;
  line-height: 1.5;
  position: relative;
  min-height: 30px;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M2 2l4 4 4-4' stroke='%23f5f5f5' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") right 8px center no-repeat,
    rgba(255, 255, 255, 0.12);
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.theme-toggle:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}

body[data-theme="xp"] .theme-icon {
  background-image: url("https://p135.p2.n0.cdn.zight.com/items/GGuw64o4/d9c2eb0d-a75c-4c02-af83-1f2de91a8fe0.svg");
}

body[data-theme="win98"] .theme-icon {
  background-image: url("https://p135.p2.n0.cdn.zight.com/items/o0uzE7vX/da4cdf15-1885-4fc1-a14f-34cab451d3b9.png");
}

body[data-theme="win7"] .theme-icon {
  background-image: url("https://p135.p2.n0.cdn.zight.com/items/E0uQ9K4W/b565abaa-a322-4608-afa8-d0d6c416fb88.png");
}

body[data-theme="macos"] .theme-icon {
  background-image: url("https://p135.p2.n0.cdn.zight.com/items/Blu6YDOP/471c4d9b-b51a-4e5b-8c56-5d061943d9cd.svg");
}

body[data-theme="macos"] {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
}

body[data-theme="win7"] {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

body[data-theme="win98"] {
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
}


/* Let XP.css render the chrome; we only position and size the window. */
.window {
  position: absolute;
  top: 20px;
  left: 20px;
  width: calc(95% - 40px);
  height: calc(95% - 40px);
  min-width: 500px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
  padding: 0; /* avoid inner gap between border and content */
  background: transparent;
  overflow: hidden; /* keep content flush inside the frame */
}

.title-bar {
  cursor: move;
  user-select: none;
  height: 32px;
  padding: 6px 10px;
  /* Pull the title bar into the border so the bezel flows seamlessly */
  margin: 0;
  border-radius: 8px 8px 0 0;
  line-height: 20px;
  font-size: 13px;
  align-items: center;
}

.title-bar .title-bar-text {
  font-size: 14px;
}

.title-bar-controls {
  margin-left: auto;
  gap: 4px;
}

.title-bar-controls button {
  height: 22px;
  width: 22px;
  padding: 0;
}

/* Mac-specific window tweaks for better alignment */
body[data-theme="macos"] .window {
  border: 1px solid #b9b9b9 !important;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  background: #e9e9e9;
}

body[data-theme="macos"] .title-bar {
  background: linear-gradient(180deg, #f5f5f5, #dfdfdf);
  color: #000;
  border-radius: 10px 10px 0 0;
  border: 1px solid #c9c9c9 !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  margin: 0;
  position: relative;
}

body[data-theme="macos"] .title-bar-controls {
  gap: 6px;
  align-items: center;
  margin-right: 8px;
  position: absolute;
  top: 8px;
  right: 8px;
}

body[data-theme="macos"] .title-bar-controls button {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0;
  margin: 0;
}

body[data-theme="macos"] .title-bar-controls button[aria-label="Close"] {
  background: #ff5f57;
}

body[data-theme="macos"] .title-bar-controls button[aria-label="Minimize"] {
  background: #febc2e;
}

body[data-theme="macos"] .title-bar-controls button[aria-label="Maximize"] {
  background: #28c840;
}

body[data-theme="win7"] .title-bar-controls button:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body[data-theme="win98"] .title-bar-controls button:hover {
  filter: brightness(1.1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

body[data-theme="macos"] .title-bar-controls button:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.window-body {
  flex: 1;
  padding: 0;
  margin: 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #ffffff;
}

/* Resize hit areas (transparent but expand the mouse target). */
.resize-handle {
  position: absolute;
  z-index: 10;
  background: transparent;
}

.resize-right {
  top: 0;
  right: -4px;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
}

.resize-left {
  top: 0;
  left: -4px;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
}

.resize-bottom {
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 12px;
  cursor: ns-resize;
}

.resize-corner {
  right: -6px;
  bottom: -6px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}
.title-bar {
  display: flex;
  align-items: center;
}
