/* Windows 98 look */
:root {
  --face: #c0c0c0;
  --light: #ffffff;
  --mid: #dfdfdf;
  --shadow: #808080;
  --dark: #0a0a0a;
  --title1: #000080;
  --title2: #1084d0;
  --title-off1: #808080;
  --title-off2: #b5b5b5;
  --desk: #008080;
  --font: Tahoma, "Leelawadee UI", Leelawadee, "Noto Sans Thai", Thonburi, "MS Sans Serif", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: var(--font); font-size: 12px; color: #000; -webkit-font-smoothing: none; }

#stage { position: fixed; inset: 0; background: #000; }
#game {
  position: absolute; left: 0; top: 0; width: 1024px; height: 768px;
  transform-origin: 0 0; overflow: hidden; background: var(--desk);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#game.lang-th { font-size: 13px; }

.hidden { display: none !important; }

/* bevels */
.raised { background: var(--face); box-shadow: inset -1px -1px var(--dark), inset 1px 1px var(--light), inset -2px -2px var(--shadow), inset 2px 2px var(--mid); }
.sunken { background: var(--face); box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--shadow), inset -2px -2px var(--mid), inset 2px 2px var(--dark); }
.field { background: #fff; box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--shadow), inset -2px -2px var(--mid), inset 2px 2px var(--dark); padding: 3px 4px; }

.btn {
  font: inherit; color: #000; background: var(--face); border: 0; border-radius: 0;
  min-width: 75px; min-height: 23px; padding: 2px 10px;
  box-shadow: inset -1px -1px var(--dark), inset 1px 1px var(--light), inset -2px -2px var(--shadow), inset 2px 2px var(--mid);
  cursor: default;
}
.btn:active, .btn.pressed, .btn.down { box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--dark), inset -2px -2px var(--mid), inset 2px 2px var(--shadow); padding: 3px 9px 1px 11px; }
.btn:focus { outline: 1px dotted #000; outline-offset: -4px; }
.btn:disabled { color: var(--shadow); text-shadow: 1px 1px #fff; }
.btn.default { box-shadow: inset 0 0 0 1px #000, inset -2px -2px var(--dark), inset 2px 2px var(--light), inset -3px -3px var(--shadow), inset 3px 3px var(--mid); }

/* windows */
.window {
  position: absolute; display: flex; flex-direction: column; padding: 3px;
  background: var(--face);
  box-shadow: inset -1px -1px var(--dark), inset 1px 1px var(--mid), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
}
.titlebar {
  display: flex; align-items: center; gap: 4px; height: 18px; padding: 0 2px 0 3px; flex: none;
  background: linear-gradient(90deg, var(--title-off1), var(--title-off2)); color: #d4d0c8; font-weight: bold;
}
.window.active .titlebar { background: linear-gradient(90deg, var(--title1), var(--title2)); color: #fff; }
.titlebar .tb-icon { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
.titlebar .title-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-btn {
  width: 16px; height: 14px; padding: 0; border: 0; background: var(--face); font: bold 9px/12px sans-serif; color: #000;
  box-shadow: inset -1px -1px var(--dark), inset 1px 1px var(--light), inset -2px -2px var(--shadow), inset 2px 2px var(--mid);
}
.tb-btn:active, .tb-btn.down { box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--dark), inset -2px -2px var(--mid), inset 2px 2px var(--shadow); }
.window-body { flex: 1; margin-top: 2px; min-height: 0; position: relative; display: flex; flex-direction: column; }
.statusbar { display: flex; gap: 2px; margin-top: 2px; flex: none; }
.statusbar > div { flex: 1; padding: 2px 4px; box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--shadow); }

/* taskbar */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px; z-index: 5000;
  display: flex; align-items: center; gap: 3px; padding: 2px;
  background: var(--face); box-shadow: inset 0 1px var(--mid), inset 0 2px var(--light);
}
#taskbar .btn { min-width: 0; height: 22px; display: flex; align-items: center; gap: 4px; }
.btn.start { font-weight: bold; padding-left: 4px; }
.btn.start .flag { width: 16px; height: 14px; background:
  linear-gradient(90deg, #e33 0 50%, #3b3 50%) top / 100% 50% no-repeat,
  linear-gradient(90deg, #36f 0 50%, #fc0 50%) bottom / 100% 50% no-repeat; transform: skewY(-6deg); }
#taskButtons { flex: 1; display: flex; gap: 3px; overflow: hidden; }
#taskButtons .btn { width: 150px; justify-content: flex-start; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#taskButtons .btn.pressed { background: repeating-conic-gradient(#fff 0 25%, var(--face) 0 50%) 0 0 / 2px 2px; font-weight: bold; }
#tray { height: 22px; display: flex; align-items: center; gap: 10px; padding: 0 8px; white-space: nowrap; }
#timer { font-family: "Courier New", monospace; font-weight: bold; }
@keyframes blink { 50% { visibility: hidden; } }

/* menus */
.menu { position: absolute; z-index: 6000; padding: 3px; min-width: 180px;
  background: var(--face); box-shadow: inset -1px -1px var(--dark), inset 1px 1px var(--mid), inset -2px -2px var(--shadow), inset 2px 2px var(--light); }
#startMenu { left: 2px; bottom: 28px; display: flex; }
#startMenu .side { width: 22px; background: linear-gradient(0deg, #000080, #1084d0); color: #fff; writing-mode: vertical-rl; transform: rotate(180deg);
  font: bold 16px var(--font); padding: 6px 2px; letter-spacing: 1px; }
#startMenu .items { flex: 1; }
.menu-item { padding: 6px 20px 6px 10px; white-space: nowrap; }
.menu-item.hov { background: var(--title1); color: #fff; }
.menu-sep { height: 2px; margin: 3px 2px; box-shadow: inset 0 1px var(--shadow), inset 0 -1px var(--light); }

/* title bar buttons: minimize / maximize / close (glyphs drawn with CSS) */
.tb-btn { position: relative; flex: none; }
.tb-btn.gap { margin-left: 2px; }
.tb-min::before { content: ""; position: absolute; left: 4px; bottom: 3px; width: 6px; height: 2px; background: #000; }
.tb-max::before { content: ""; position: absolute; left: 3px; top: 2px; width: 9px; height: 8px; box-sizing: border-box; border: 1px solid #000; border-top-width: 2px; }
.window.maximized .tb-max::before { left: 5px; top: 1px; width: 7px; height: 6px; }
.window.maximized .tb-max::after { content: ""; position: absolute; left: 2px; top: 4px; width: 7px; height: 6px; box-sizing: border-box; border: 1px solid #000; border-top-width: 2px; background: var(--face); }
.titlebar { user-select: none; }
.titlebar .tb-btn + .tb-btn { margin-left: 0; }

/* resize grip (bottom-right corner) */
.rs-grip { position: absolute; right: 3px; bottom: 3px; width: 13px; height: 13px; z-index: 2; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 45%, #fff 45% 52%, #808080 52% 60%, transparent 60% 70%, #fff 70% 77%, #808080 77% 85%, transparent 85%); }
.window.maximized .rs-grip, .window.maximized .rs { display: none; }
.window.maximized { box-shadow: none; padding: 2px; }

/* invisible resize zones on every edge (6px) and corner (14px), slightly outside the frame like Win98 */
.rs { position: absolute; z-index: 5; }
.rs-n { top: -5px; left: 14px; right: 14px; height: 10px; cursor: ns-resize; }
.rs-s { bottom: -5px; left: 14px; right: 14px; height: 10px; cursor: ns-resize; }
.rs-e { right: -5px; top: 14px; bottom: 14px; width: 10px; cursor: ew-resize; }
.rs-w { left: -5px; top: 14px; bottom: 14px; width: 10px; cursor: ew-resize; }
.rs-nw { left: -6px; top: -6px; width: 20px; height: 20px; cursor: nwse-resize; }
.rs-ne { right: -7px; top: -7px; width: 12px; height: 12px; cursor: nesw-resize; } /* small: the close button sits right below */
.rs-sw { left: -6px; bottom: -6px; width: 20px; height: 20px; cursor: nesw-resize; }
.rs-se { right: -6px; bottom: -6px; width: 22px; height: 22px; cursor: nwse-resize; }
/* with the CRT bulge on, the browser's own cursor would follow the unwarped layout,
   so the game picks the cursor itself (see crt.js) */
#game.crt * { cursor: inherit !important; }
