/*
 * win98.css — Retro Windows 98 theme for "Survive the Internet" web game.
 *
 * Self-contained: no @import, no external fonts/images. All bezels are drawn
 * with border + box-shadow (the classic inset trick).
 *
 * Class names follow the 98.css library so HTML clients can reuse them.
 *
 * Available classes / selectors:
 *   body.desktop        — teal desktop background + base typography
 *   .window             — raised 98 window panel
 *   .title-bar          — blue gradient window title bar
 *   .title-bar-text     — bold white title text
 *   .title-bar-controls — container for window control buttons
 *   button[aria-label="Minimize"|"Maximize"|"Close"] — window control buttons
 *   .window-body        — inner window content area
 *   button / .btn-big   — raised 98 push button (big variant)
 *   input[type=text], input[type=password], textarea, select — sunken fields
 *   .field-row          — horizontal field layout (flex)
 *   .field-row-stacked  — vertical field layout (column)
 *   fieldset / legend   — grouped controls
 *   .status-bar         — bottom status bar
 *   .status-bar-field   — sunken status cell
 *   .progress-indicator       — sunken progress track
 *   .progress-indicator-bar   — blue/segmented progress fill (set width inline)
 *   .center             — full-screen flex centering
 *   .sunken-panel       — sunken white panel
 *   .taskbar            — bottom taskbar
 *   .start-button       — Start button with pseudo-logo
 */

/* ----------------------------------------------------------------------------
 * Theme tokens
 * ------------------------------------------------------------------------- */
:root {
  --surface: #c0c0c0;
  --button-face: #c0c0c0;
  --button-highlight: #ffffff;
  --button-shadow: #808080;
  --window-frame: #0a0a0a;
  --dialog-blue: #000080;
  --dialog-blue-light: #1084d0;
  --field-bg: #ffffff;
  --text: #000000;
  --font-sans: "Pixelated MS Sans Serif", Tahoma, "MS Sans Serif", sans-serif;
  --font-mono: "Courier New", Courier, monospace;

  /* Reusable bezel shadows */
  --border-raised-outer: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff;
  --border-raised-inner: inset -2px -2px grey, inset 2px 2px #dfdfdf;
  --border-sunken-outer: inset -1px -1px #ffffff, inset 1px 1px grey;
  --border-sunken-inner: inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

/* ----------------------------------------------------------------------------
 * Base / desktop
 * ------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body.desktop {
  margin: 0;
  padding: 0;
  background: #008080;
  color: #000000;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

/* ----------------------------------------------------------------------------
 * Window
 * ------------------------------------------------------------------------- */
.window {
  position: relative;
  background: var(--surface);
  padding: 3px;
  color: var(--text);
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #ffffff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

/* ----------------------------------------------------------------------------
 * Title bar
 * ------------------------------------------------------------------------- */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 21px;
  padding: 1px 2px 1px 3px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  user-select: none;
}

.title-bar-text {
  flex: 1 1 auto;
  padding-left: 3px;
  font-weight: bold;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-bar-controls {
  display: flex;
  flex: 0 0 auto;
}

/* Window control buttons — small square grey buttons */
.title-bar-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  min-width: 16px;
  margin: 0 0 0 2px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  background: var(--surface);
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #ffffff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

.title-bar-controls button:active {
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px #0a0a0a,
    inset -2px -2px #dfdfdf,
    inset 2px 2px grey;
}

.title-bar-controls button:focus {
  outline: none;
}

/* Draw the glyphs via content so HTML needs no inner text */
.title-bar-controls button[aria-label="Minimize"]::before {
  content: "_";
  position: relative;
  top: 2px;
  font-weight: bold;
}

.title-bar-controls button[aria-label="Maximize"]::before {
  content: "\25A2"; /* ▢ white square with rounded corners */
  font-size: 11px;
}

.title-bar-controls button[aria-label="Close"]::before {
  content: "\2715"; /* ✕ multiplication x */
  font-size: 10px;
  font-weight: bold;
}

/* ----------------------------------------------------------------------------
 * Window body
 * ------------------------------------------------------------------------- */
.window-body {
  margin: 8px;
}

/* ----------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------- */
button,
.btn-big {
  display: inline-block;
  box-sizing: border-box;
  min-width: 75px;
  min-height: 23px;
  padding: 6px 14px;
  border: none;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  text-align: center;
  cursor: default;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #ffffff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
}

button:active,
.btn-big:active,
button.active,
.btn-big.active {
  padding: 7px 13px 5px 15px; /* nudge label down/right when pressed */
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px #0a0a0a,
    inset -2px -2px #dfdfdf,
    inset 2px 2px grey;
}

button:focus,
.btn-big:focus {
  outline: 1px dotted #000000;
  outline-offset: -4px;
}

button:disabled,
button[disabled],
.btn-big:disabled {
  color: var(--button-shadow);
  text-shadow: 1px 1px 0 #ffffff;
}

.btn-big {
  min-width: 140px;
  min-height: 36px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: bold;
}

.btn-big:active,
.btn-big.active {
  padding: 11px 23px 9px 25px;
}

/* ----------------------------------------------------------------------------
 * Form fields
 * ------------------------------------------------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
  box-sizing: border-box;
  padding: 3px 4px;
  border: none;
  border-radius: 0;
  background: var(--field-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px grey,
    inset -2px -2px #dfdfdf,
    inset 2px 2px #0a0a0a;
}

textarea {
  font-family: var(--font-mono);
  resize: vertical;
}

select {
  font-family: var(--font-sans);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 22px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface);
  color: var(--button-shadow);
  text-shadow: 1px 1px 0 #ffffff;
}

/* Field rows */
.field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-row > * + * {
  margin-left: 0;
}

.field-row-stacked {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-row-stacked label {
  margin-bottom: 2px;
}

label {
  user-select: none;
}

/* ----------------------------------------------------------------------------
 * Fieldset + legend
 * ------------------------------------------------------------------------- */
fieldset {
  margin: 0;
  padding: 10px;
  border: none;
  border-radius: 0;
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px grey,
    inset -2px -2px #dfdfdf,
    inset 2px 2px #0a0a0a;
}

legend {
  padding: 0 4px;
  background: var(--surface);
}

/* ----------------------------------------------------------------------------
 * Status bar
 * ------------------------------------------------------------------------- */
.status-bar {
  display: flex;
  gap: 1px;
  margin: 4px 0 0 0;
  padding: 2px 0 0 0;
  box-shadow: inset 0 1px grey, inset 0 2px #dfdfdf;
}

.status-bar-field {
  flex: 1 1 auto;
  padding: 2px 4px;
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px grey;
}

/* ----------------------------------------------------------------------------
 * Progress indicator
 * ------------------------------------------------------------------------- */
.progress-indicator {
  display: block;
  height: 18px;
  padding: 2px;
  background: var(--surface);
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px grey,
    inset -2px -2px #dfdfdf,
    inset 2px 2px #0a0a0a;
}

.progress-indicator-bar {
  height: 100%;
  width: 0%; /* HTML may override via inline style="width: NN%" */
  background-color: var(--dialog-blue);
  /* Segmented look: solid blue chunks separated by face-coloured gaps */
  background-image: linear-gradient(
    90deg,
    var(--dialog-blue) 0,
    var(--dialog-blue) 8px,
    transparent 8px,
    transparent 10px
  );
  background-size: 10px 100%;
  background-repeat: repeat-x;
  transition: width 0.2s linear;
}

/* ----------------------------------------------------------------------------
 * Layout helpers
 * ------------------------------------------------------------------------- */
.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.sunken-panel {
  background: var(--field-bg);
  color: var(--text);
  overflow: auto;
  box-shadow:
    inset -1px -1px #ffffff,
    inset 1px 1px grey,
    inset -2px -2px #dfdfdf,
    inset 2px 2px #0a0a0a;
}

/* ----------------------------------------------------------------------------
 * Taskbar + Start button
 * ------------------------------------------------------------------------- */
.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 2px;
  background: var(--surface);
  box-shadow:
    inset 0 1px #ffffff,
    inset 0 2px #dfdfdf;
}

.start-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 22px;
  padding: 2px 8px 2px 4px;
  font-weight: bold;
  font-size: 13px;
}

/* Pseudo Windows flag logo (four coloured panes) */
.start-button::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 14px;
  flex: 0 0 auto;
  transform: perspective(8px) rotateY(-12deg);
  background:
    linear-gradient(#ff3b30, #ff3b30) 0 0 / 7px 6px no-repeat,
    linear-gradient(#34c759, #34c759) 9px 0 / 7px 6px no-repeat,
    linear-gradient(#007aff, #007aff) 0 8px / 7px 6px no-repeat,
    linear-gradient(#ffcc00, #ffcc00) 9px 8px / 7px 6px no-repeat;
}

/* ----------------------------------------------------------------------------
 * Responsive — phones: windows take nearly full width
 * ------------------------------------------------------------------------- */
.window {
  width: auto;
  max-width: 100%;
}

@media (max-width: 600px) {
  .window {
    width: 95%;
    max-width: 95%;
  }

  .center {
    padding: 8px;
  }

  .btn-big {
    width: 100%;
  }
}
