/* ============================================================
   FLASH ARCADE 98 — early-2000s PC chrome
   Palette: desktop teal #008080, chrome grey #c0c0c0,
   titlebar navy #000080 → #1084d0, highlight navy select
   ============================================================ */

:root {
  --teal: #008080;
  --grey: #c0c0c0;
  --grey-dk: #808080;
  --grey-dkr: #404040;
  --white: #ffffff;
  --navy: #000080;
  --navy-2: #1084d0;
  --sel: #000080;
  --font: "Tahoma", "MS Sans Serif", "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 12px;
  background: var(--teal);
  overflow: hidden;
  -webkit-font-smoothing: none;
  color: #000;
  user-select: none;
}

/* ---- classic bevels ---- */
.raised, .win, .btn, .tb-btn, #startbtn, #taskbar, .task-btn {
  border-top: 2px solid var(--white);
  border-left: 2px solid var(--white);
  border-right: 2px solid var(--grey-dkr);
  border-bottom: 2px solid var(--grey-dkr);
  background: var(--grey);
}
.sunken, .field, .content, .notepad-body, .address, #tray, .game-body {
  border-top: 2px solid var(--grey-dk);
  border-left: 2px solid var(--grey-dk);
  border-right: 2px solid var(--white);
  border-bottom: 2px solid var(--white);
  background: var(--white);
}

/* ============ BOOT SCREEN ============ */
#boot {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .4s;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; color: #fff; }
.boot-logo {
  font-size: 42px; font-weight: bold; letter-spacing: 2px;
  font-family: "Trebuchet MS", var(--font);
  text-shadow: 3px 3px 0 var(--teal);
}
.boot-logo span { color: #ffd700; font-style: italic; }
.boot-sub { margin-top: 10px; color: #bbb; font-size: 13px; }
.boot-bar {
  margin: 26px auto 0; width: 240px; height: 16px;
  border: 1px solid #666; padding: 2px;
}
.boot-bar-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(90deg,
    var(--navy-2) 0 10px, transparent 10px 14px);
  animation: bootfill 1.6s steps(12) forwards;
}
@keyframes bootfill { to { width: 100%; } }

/* ============ DESKTOP ============ */
#desktop { position: fixed; inset: 0; }

.desk-icons {
  position: absolute; top: 12px; left: 12px;
  display: flex; flex-direction: column; gap: 18px;
}
.desk-icon {
  width: 76px; background: none; border: none;
  color: #fff; font-family: var(--font); font-size: 11px;
  text-align: center; cursor: pointer; text-decoration: none;
  display: block;
}
.desk-icon:focus-visible .di-label,
.desk-icon:hover .di-label { background: var(--sel); }
.di-img {
  display: block; width: 48px; height: 48px; margin: 0 auto 4px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  image-rendering: pixelated;
}
.di-label {
  display: inline-block; padding: 1px 3px; line-height: 1.25;
  text-shadow: 1px 1px 0 #000;
}
/* inline pixel-ish SVG icons */
.di-arcade  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='6' y='10' width='36' height='24' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='9' y='13' width='30' height='16' fill='%23000080'/%3E%3Ctext x='24' y='25' font-size='11' fill='%23ffd700' text-anchor='middle' font-family='monospace'%3E%E2%96%B6%3C/text%3E%3Crect x='16' y='34' width='16' height='4' fill='%23808080'/%3E%3Crect x='12' y='38' width='24' height='4' fill='%23c0c0c0' stroke='%23404040'/%3E%3C/svg%3E"); }
.di-archive { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='19' fill='%231084d0' stroke='%23003060' stroke-width='2'/%3E%3Cellipse cx='24' cy='24' rx='9' ry='19' fill='none' stroke='%23bde' stroke-width='2'/%3E%3Cline x1='5' y1='24' x2='43' y2='24' stroke='%23bde' stroke-width='2'/%3E%3Cline x1='8' y1='14' x2='40' y2='14' stroke='%23bde' stroke-width='1.5'/%3E%3Cline x1='8' y1='34' x2='40' y2='34' stroke='%23bde' stroke-width='1.5'/%3E%3C/svg%3E"); }
.di-help    { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M10 4h20l8 8v32H10z' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Cpath d='M30 4v8h8' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Cline x1='15' y1='20' x2='33' y2='20' stroke='%23808080' stroke-width='2'/%3E%3Cline x1='15' y1='26' x2='33' y2='26' stroke='%23808080' stroke-width='2'/%3E%3Cline x1='15' y1='32' x2='27' y2='32' stroke='%23808080' stroke-width='2'/%3E%3C/svg%3E"); }

/* ============ WINDOWS ============ */
.win {
  position: absolute;
  padding: 2px;
  display: flex; flex-direction: column;
  min-width: 320px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
#explorer { top: 3vh; left: 50%; transform: translateX(-50%); width: min(960px, 94vw); height: min(800px, calc(100vh - 34px - 5vh)); }
.win-notepad { top: 14vh; left: 12vw; width: min(460px, 90vw); z-index: 60; }
.win-game { width: min(880px, 94vw); height: min(680px, 84vh); }
.win.maxed { top: 0 !important; left: 0 !important; transform: none !important; width: 100vw !important; height: calc(100vh - 34px) !important; }

.titlebar {
  height: 22px; flex: 0 0 22px;
  display: flex; align-items: center; gap: 5px;
  padding: 0 3px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff; font-weight: bold; font-size: 12px;
  cursor: default;
}
.win.inactive .titlebar { background: linear-gradient(90deg, #7b7b7b, #b0b0b0); color: #d8d8d8; }
.tb-icon { font-size: 13px; line-height: 1; }
.tb-text { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb-btns { display: flex; gap: 2px; }
.tb-btn {
  width: 18px; height: 16px; font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #000; font-family: var(--font);
}
.tb-btn:active { border-top-color: var(--grey-dkr); border-left-color: var(--grey-dkr); border-right-color: var(--white); border-bottom-color: var(--white); }
.glyph-min { display: block; width: 8px; height: 2px; background: #000; margin-top: 8px; }
.glyph-max { display: block; width: 9px; height: 8px; border: 1px solid #000; border-top-width: 2px; }
.glyph-x { font-weight: bold; font-size: 13px; margin-top: -2px; }

.menubar { display: flex; gap: 2px; padding: 2px 2px 3px; }
.menu-item { padding: 2px 7px; cursor: default; }
.menu-item:hover { background: var(--sel); color: #fff; }

.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  border-top: 1px solid var(--white);
  flex-wrap: wrap;
}
.tb-label { font-size: 11px; }
.field {
  font-family: var(--font); font-size: 12px;
  padding: 3px 4px; outline: none;
  user-select: text;
}
#q { flex: 1; min-width: 140px; }
.select { padding: 2px; background: var(--white); }
.tool-sep { width: 2px; align-self: stretch; margin: 0 2px;
  border-left: 1px solid var(--grey-dk); border-right: 1px solid var(--white); }

.btn {
  font-family: var(--font); font-size: 12px;
  padding: 3px 14px; cursor: pointer; color: #000;
}
.btn:active:not(:disabled) { border-top-color: var(--grey-dkr); border-left-color: var(--grey-dkr); border-right-color: var(--white); border-bottom-color: var(--white); padding: 4px 13px 2px 15px; }
.btn:disabled { color: var(--grey-dk); text-shadow: 1px 1px 0 var(--white); cursor: default; }
.btn:focus-visible, .field:focus-visible, .tb-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.addressbar { display: flex; align-items: center; gap: 6px; padding: 0 6px 4px; }
.address { flex: 1; padding: 3px 5px; font-size: 11px; color: #222; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---- results area ---- */
/* min-height: 0 matters: without it this flex child refuses to shrink,
   the grid pushes the pager/statusbar out of the window, and the inner
   scrollbar never activates */
.content { flex: 1 1 auto; min-height: 0; margin: 0 4px; overflow-y: auto; overflow-x: hidden; position: relative; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px 8px;
  padding: 12px;
  align-content: start;
}
.game-icon {
  border: 1px solid transparent;
  background: none; font-family: var(--font); font-size: 11px;
  padding: 5px 3px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.game-icon img {
  width: 100px; height: 75px; object-fit: cover;
  border: 1px solid var(--grey-dk);
  background: #e8e8e8;
}
.game-icon .gi-title {
  line-height: 1.25; padding: 1px 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
  min-height: 2.5em;
}
.game-icon .gi-plays { color: var(--grey-dk); font-size: 10px; }
.gi-badge {
  font-size: 10px; font-weight: bold; padding: 1px 5px; color: #fff;
  border: 1px solid rgba(0,0,0,.55);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.4);
}
.mc-good { background: #2e9e43; }
.mc-mid  { background: #c8a400; }
.mc-bad  { background: #c0392b; }
.mc-rawg { background: var(--navy-2); }
.game-icon:hover, .game-icon:focus-visible { border: 1px dotted var(--sel); }
.game-icon:hover .gi-title { background: var(--sel); color: #fff; }

.notice {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; font-size: 12px; line-height: 1.6;
  background: var(--white);
}
.notice[hidden] { display: none; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 5px; }
.page-info { min-width: 110px; text-align: center; }

.statusbar { display: flex; gap: 2px; padding: 2px 2px 0; flex: 0 0 auto; }
.status-cell {
  border-top: 1px solid var(--grey-dk); border-left: 1px solid var(--grey-dk);
  border-right: 1px solid var(--white); border-bottom: 1px solid var(--white);
  padding: 2px 8px; font-size: 11px; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-right { flex: 0 0 auto; }
.game-link { color: var(--navy); }

/* ---- notepad ---- */
.notepad-body {
  font-family: "Courier New", monospace; font-size: 12px;
  white-space: pre-wrap; padding: 8px; height: 340px; overflow-y: auto;
  user-select: text; line-height: 1.45;
}

/* ---- game window ---- */
.game-body { flex: 1 1 auto; min-height: 0; margin: 0 2px; position: relative; background: #000; overflow: hidden; }
.game-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.game-loading {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: #0f0; background: #000; font-family: "Courier New", monospace; font-size: 13px;
}
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============ TASKBAR ============ */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 34px; z-index: 500;
  display: flex; align-items: center; gap: 4px; padding: 3px 4px;
  border-right: none; border-bottom: none;
}
#startbtn {
  font-family: var(--font); font-weight: bold; font-size: 12px;
  display: flex; align-items: center; gap: 4px;
  padding: 2px 10px 2px 6px; height: 26px; cursor: pointer; color: #000;
}
#startbtn:active, #startbtn.open { border-top-color: var(--grey-dkr); border-left-color: var(--grey-dkr); border-right-color: var(--white); border-bottom-color: var(--white); }
.start-flag { color: var(--navy); font-size: 15px; }
.task-sep { width: 2px; height: 24px;
  border-left: 1px solid var(--grey-dk); border-right: 1px solid var(--white); }

#tasks { flex: 1; display: flex; gap: 4px; overflow: hidden; }
.task-btn {
  font-family: var(--font); font-size: 11px; height: 26px;
  padding: 0 8px; cursor: pointer; max-width: 180px; min-width: 60px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: left; flex: 1 1 120px; color: #000;
}
.task-btn.active {
  border-top-color: var(--grey-dkr); border-left-color: var(--grey-dkr);
  border-right-color: var(--white); border-bottom-color: var(--white);
  background: repeating-conic-gradient(var(--white) 0 25%, #dcdcdc 0 50%) 0 0 / 4px 4px;
  font-weight: bold;
}

#tray { display: flex; align-items: center; gap: 8px; padding: 3px 8px; height: 26px; background: var(--grey); }
.tray-ic { font-size: 13px; cursor: default; }
#clock { font-size: 11px; min-width: 42px; text-align: right; }

/* ============ START MENU ============ */
#startmenu {
  position: fixed; left: 4px; bottom: 36px; z-index: 600;
  width: 210px; display: flex;
  border-top: 2px solid var(--white); border-left: 2px solid var(--white);
  border-right: 2px solid var(--grey-dkr); border-bottom: 2px solid var(--grey-dkr);
  background: var(--grey);
  box-shadow: 3px 3px 0 rgba(0,0,0,.35);
}
.sm-band {
  width: 26px; background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px;
}
.sm-band span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 15px; letter-spacing: 1px; }
.sm-band b { color: #ffd700; }
.sm-items { flex: 1; padding: 3px; display: flex; flex-direction: column; }
.sm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border: none; background: none;
  font-family: var(--font); font-size: 12px; cursor: pointer;
  text-align: left; color: #000; text-decoration: none;
}
.sm-item:hover, .sm-item:focus-visible { background: var(--sel); color: #fff; }
.sm-ic { font-size: 15px; width: 20px; text-align: center; }
.sm-sep { height: 2px; margin: 3px 2px;
  border-top: 1px solid var(--grey-dk); border-bottom: 1px solid var(--white); }

/* ============ misc ============ */
@media (prefers-reduced-motion: reduce) {
  .boot-bar-fill { animation-duration: .2s; }
  .blink { animation: none; }
  #boot { transition: none; }
}
@media (max-width: 600px) {
  .win-game, #explorer { min-width: 0; }
  .desk-icons { flex-direction: row; }
  .page-info { min-width: 70px; }
}
