/* ============================== */
/* Win95 CD Player — full styles  */
/* ============================== */

/* MS Sans Serif replica (map W95FA → your files) */
@font-face{
  font-family: 'W95FA';
  src: url('../fonts/w95font.woff2') format('woff2'),
       url('../fonts/w95font.woff')  format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: 'W95FA';
  src: url('../fonts/w95font-bold.woff2') format('woff2'),
       url('../fonts/w95font-bold.woff')  format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- layout constants ---- */
:root {
  --lcd-h: 110px;
  --pad-gap: 12px;
  --pad-top-h: 52px;
  --pad-bot-h: calc(var(--lcd-h) - var(--pad-top-h) - var(--pad-gap));
}

/* Enlarge transport button glyphs by ~30% */
.pad-row .btn95 {
  font-size: 20.8px;  /* was 16px */
  line-height: 1;
}

/* -------------------------- */
/* Desktop / page container   */
/* -------------------------- */
html, body { height: 100%; }

/* iOS viewport-safe min-height with fallbacks */
body {
  margin: 0;
  /* use custom --vh for old Safari, overridden by dvh/svh if supported */
  min-height: calc(var(--vh, 1vh) * 100);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #008080;
  font-family: 'MS Sans Serif', Arial, sans-serif;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

@supports (min-height: 100dvh) {
  body { min-height: 100dvh; }
}
@supports (min-height: 100svh) {
  body { min-height: 100svh; }
}

/* Reserve space for the fixed Win95 taskbar (with safe-area) */
body.has-taskbar {
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
}

/* -------------------------- */
/* App window shell           */
/* -------------------------- */
.window {
  position: relative;
  width: 540px;
  background: #C0C0C0;
  border: 2px solid #FFF;
  box-shadow:
    2px 2px 0 #000,
    inset -1px -1px 0 #808080,
    inset  1px  1px 0 #000;
}

/* -------------------------- */
/* Title bar (Win95 bevel)    */
/* -------------------------- */

/* window title icon + taskbar icon share same sizing */
.title-bar .title-icon,
.task-button .task-icon {
  width: 16px;                 /* Win95-sized icon */
  height: 16px;
  display: block;
  object-fit: contain;         /* SVG keeps aspect */
  pointer-events: none;
}

/* title text + icon inline */
.title-bar .title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding-left: 4px;
  line-height: 24px;
}

/* title bar container */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  padding: 0 4px;
  color: #fff;
  font: bold 12px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  background: linear-gradient(90deg, #000087 0%, #0738A2 40%, #0D68BF 100%);
  box-shadow: inset 0 -1px 0 #2148A3;
}

/* buttons touch each other; black seam between [-] and [□] lives on container */
.title-bar .buttons {
  position: relative;
  display: flex;
  gap: 0;
}

/* 1px black seam after the first button (between [-] and [□]) */
.title-bar .buttons::before {
  content: "";
  position: absolute;
  left: 20px;                   /* width of the first button */
  top: 0;
  bottom: 0;
  width: 1px;
  background: #000;
  pointer-events: none;
}

/* --- Base button: Win95 bevel like STOP --- */
.title-bar .button {
  position: relative;
  width: 20px;
  height: 18px;
  margin: 0;
  padding: 0;
  background: #c9c9c9;
  border-top: 2px solid #ffffff;  /* bevel */
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #404040;
  border-right: 2px solid #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;                  /* hide any text glyphs (–, □, ×) */
  line-height: 1;
  user-select: none;
}

/* pressed (sunken) variant — invert bevel */
.title-bar .button:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-bottom: 2px solid #ffffff;
  border-right: 2px solid #ffffff;
}

/* small spacing before Close (X), like Win95 */
.title-bar .button[title="Close"] {
  margin-left: 4px;
}

/* -------------------------- */
/* Per-button icons (flat)    */
/* -------------------------- */

/* Minimize: solid bar anchored to the bottom */
.title-bar .button[title="Minimize"]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;              /* distance from bottom edge */
  transform: translateX(-50%);
  width: 14px;              /* bar length */
  height: 3px;              /* bar thickness (block, not hyphen) */
  background: #000;
  pointer-events: none;
}

/* optional: nudge 1px on press to feel sunken */
.title-bar .button[title="Minimize"]:active::before {
  bottom: 2px;
}

/* safety: kill any old pseudos on the 2nd button */
.title-bar .button:nth-child(2)::before {
  content: none !important;
}

/* Maximize — inner square: top thick dark, top thin white below it,
   left white, bottom/right ultra-thin dark; subtle grey contour */
.title-bar .button[title="Maximize"] {
  background-image: none !important;
}

.title-bar .button[title="Maximize"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 10px;
  background: #dcdcdc;           /* light grey fill (not blending into #c9c9c9) */
  box-shadow:
    0 0 0 1px #6e6e6e,           /* subtle contour (not black) */
    inset 0 2px 0 #6e6e6e,       /* TOP dark band (thick) */
    inset 0 3px 0 #ffffff,       /* TOP white highlight just under dark */
    inset 1px 0 0 #ffffff,       /* LEFT white (Γ) */
    inset -0.5px 0 0 #9a9a9a,    /* RIGHT thin dark */
    inset 0 -0.5px 0 #9a9a9a;    /* BOTTOM thin dark */
  pointer-events: none;
  z-index: 1;
}

/* pressed state — keep geometry, slightly darker */
.title-bar .button[title="Maximize"]:active::after {
  box-shadow:
    0 0 0 1px #666,
    inset 0 2px 0 #5f5f5f,
    inset 0 1px 0 #ffffff,
    inset 1px 0 0 #ffffff,
    inset -0.5px 0 0 #888,
    inset 0 -0.5px 0 #888;
}

/* Close: thicker X via CSS vars (background gradients, no outline) */
.title-bar .button[title="Close"] {
  --x-stroke: 1.5px;         /* make X bolder: 1.5px, 2px, 3px, 4px... */
  --x-size: 12px;
  background-image:
    linear-gradient(45deg,
      transparent calc(50% - var(--x-stroke)),
      #000       calc(50% - var(--x-stroke)),
      #000       calc(50% + var(--x-stroke)),
      transparent calc(50% + var(--x-stroke))
    ),
    linear-gradient(-45deg,
      transparent calc(50% - var(--x-stroke)),
      #000       calc(50% - var(--x-stroke)),
      #000       calc(50% + var(--x-stroke)),
      transparent calc(50% + var(--x-stroke))
    );
  background-repeat: no-repeat;
  background-size: calc(var(--x-size) + var(--x-stroke)) calc(var(--x-size) + var(--x-stroke));
  background-position: center;
}

/* -------------------------- */
/* Menubar                    */
/* -------------------------- */
.menu95 {
  display: flex;
  gap: 20px;
  padding: 4px 8px 0 12px;
}

.menu95 .mitem {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: default;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  color: #000;
}

.menu95 .mitem:hover {
  text-decoration: underline;
}

/* -------------------------- */
/* Window body                */
/* -------------------------- */
.cdp95-body {
  padding: 10px;
  border-top: 1px solid #808080;
}

/* ========================== */
/* Top: LCD + transport pads  */
/* ========================== */
.top-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* LCD (pixel look) */
.lcd {
  position: relative;
  flex: 1 1 auto;
  height: var(--lcd-h);
  background: #000;
  color: #c6d700;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 42px/1 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  letter-spacing: 1px;
  border: 1px solid #000;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
  font-variant-numeric: tabular-nums;
  font-kerning: none;
}

.lcd::before {
  content: "";
  position: absolute;
  inset: -3px;
  pointer-events: none;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-bottom: 1px solid #808080;
  border-right: 1px solid #808080;
}

.lcd::after {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  border: 1px solid #c0c0c0;
}

.lcd span {
  letter-spacing: inherit;
}

/* Transport pad stack */
.pad-stack {
  width: 220px;
  height: var(--lcd-h);
  display: flex;
  flex-direction: column;
}

.pad-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-column-gap: 0;
  box-shadow: 2px 2px 0 #000;
}

.pad-row + .pad-row {
  margin-top: var(--pad-gap);
}

.pad-row.top .btn95 {
  height: var(--pad-top-h);
}

#btnPlay {
  grid-column: 1 / span 3;
}

#btnPause {
  grid-column: 4;
}

#btnStop {
  grid-column: 5;
}

.pad-row.bottom .btn95 {
  height: var(--pad-bot-h);
}

/* Transport buttons */
.btn95 {
  background: #c9c9c9;
  color: #414141;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #404040;
  border-right: 2px solid #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
}

.btn95:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
}

.btn95:disabled {
  color: #8a8a8a;
  text-shadow: 1px 1px 0 #fff;
  cursor: default;
}

.btn95.dotted {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

/* -------------------------- */
/* Form rows                  */
/* -------------------------- */
.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.f-label {
  width: 60px;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
}

/* Sunken white field with inline dropdown capsule */
.sunken {
  position: relative;
  --ic-w: 22px;
  min-height: 24px;
  background: #fff;
  padding: 2px 6px;
  color: #000;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
  box-shadow:
    inset  1px  1px 0 #c0c0c0,
    inset -1px -1px 0 #c0c0c0;
  display: flex;
  align-items: center;
}

.sunken.has-inline-combo {
  padding-right: calc(var(--ic-w) + 6px);
}

.fill {
  flex: 1;
}

/* Inline combo capsule (arrow) */
.icombo {
  position: absolute;
  top: 2px;
  right: 2px;
  height: calc(100% - 4px);
  width: var(--ic-w);
  display: flex;
  align-items: stretch;
  background: #cfcfcf;
  box-shadow:
    inset  1px  1px 0 #fff,
    inset -1px -1px 0 #808080;
}

.ic-face {
  display: none;
  width: 0;
  padding: 0;
  flex: 0 0 0;
}

.ic-arrow {
  position: relative;
  width: 22px;
  border: 0;
  background: #c9c9c9;
  cursor: default;
  border-left: 1px solid #7f7f7f;
  box-shadow:
    inset  1px  1px 0 #fff,
    inset -1px -1px 0 #000;
  font-size: 0;
  line-height: 0;
}

.ic-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -15%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #000;
}

/* Hide native <select> */
#disc.native-select {
  display: none !important;
}

/* Custom dropdown menu */
.combo-menu {
  position: absolute;
  z-index: 1000;
  display: none;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  box-shadow:
    1px 1px 0 #808080,
    -1px -1px 0 #fff,
    inset  1px  1px 0 #fff,
    inset -1px -1px 0 #808080;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
}

.combo-menu .item {
  height: 22px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  cursor: default;
}

.combo-menu .item .mark {
  width: 12px;
  text-align: center;
}

.combo-menu .item:hover,
.combo-menu .item[aria-selected="true"] {
  background: #000080;
  color: #fff;
}

/* -------------------------- */
/* Volume slider              */
/* -------------------------- */
.vol-range {
  margin-top: 10px;
  width: 100%;
  height: 4px;
  background: #808080;
  border: 1px solid #000;
}

.vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #C0C0C0;
  border: 2px solid #000;
  cursor: pointer;
}

/* -------------------------- */
/* Status bar                 */
/* -------------------------- */
.statusbar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
  background: #c0c0c0;
  height: 22px;
}

.statusbar .pane {
  flex: 1;
  padding: 0 8px;
  font: 16px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  line-height: 22px;
}

.statusbar .splitter {
  width: 1px;
  height: 100%;
  background: #808080;
  box-shadow: inset 1px 0 0 #fff;
}

/* ============================== */
/* Win95 Taskbar (fixed & safe)   */
/* ============================== */
.taskbar {
  position: fixed;
  left: 0;
  right: 0;                      /* more robust than width:100% with safe-areas */
  bottom: 0;
  width: auto;
  height: calc(30px + env(safe-area-inset-bottom));
  background: #C0C0C0;
  border-top: 2px solid #FFF;
  border-left: 2px solid #FFF;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
  z-index: 1000;

  /* iOS visual fix so it doesn't "float" during rubber-band scroll */
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.task-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Start button */
.start-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  background: #C0C0C0;
  color: #000;
  font: bold 12px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  border: 1px solid #3f3f3f;
  box-shadow: 1px 1px 0 #000;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.start-button::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-top: 1px solid #FFF;
  border-left: 1px solid #FFF;
  pointer-events: none;
}

.start-icon {
  width: 16px;
  height: 16px;
  display: block;
  image-rendering: pixelated;
}

/* Task button with inner light line */
.task-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
  height: 22px;
  padding: 0 10px;
  font: bold 12px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  color: #000;
  border: 1px solid #3f3f3f;
  position: relative;
  box-shadow: none;
}

.task-button::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid #fff;
  pointer-events: none;
}

.task-button .task-icon {
  width: 16px;
  height: 16px;
  display: block;
  image-rendering: pixelated;
}

/* Cross-hatch fill like Win95 */
.task-button.task--xlines {
  background-color: #e7e7e7;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4' fill='none'><path d='M0 4 L4 0' stroke='%23d2d2d2' stroke-width='1'/><path d='M0 0 L4 4' stroke='%23d2d2d2' stroke-width='1'/></svg>");
  background-repeat: repeat;
  background-size: 3px 3px;
  background-position: 0 0;
}

.task-button.task--xlines::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 2px;
  height: 1px;
  background: #000;
  opacity: .6;
  pointer-events: none;
}

/* Clock on the right */
.clock-tile {
  margin-left: auto;
  background: #C0C0C0;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #FFFFFF;
  border-right: 1px solid #FFFFFF;
  padding: 1px;
  margin-right: 4px;
}

.clock-face {
  position: relative;
  background: #C0C0C0;
  padding: 2px 10px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: none;
  box-shadow: none;
  background-image: none;
}

.clock {
  font: normal 12px 'W95FA', 'MS Sans Serif', Arial, sans-serif;
  color: #000;
  white-space: nowrap;
  line-height: 1;
}

/* iOS: hide the volume slider completely */
html.ios #volume,
html.ios input[type="range"].vol-range { display: none !important; }
html.ios .form-row:has(#volume),
html.ios .form-row:has(input[type="range"].vol-range) { display: none !important; }
