/* ── Reset & Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #008080;
  font-family: 'MS Sans Serif', 'Arial', sans-serif;
  font-size: 11px;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  color: #000;
}

/* ── Menu Bar ────────────────────────────────────────────────────────────────── */
#menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 22px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  display: flex;
  align-items: center;
  z-index: 9999;
  padding: 0 4px;
}

.menu-item {
  padding: 2px 10px;
  cursor: pointer;
  font-size: 11px;
  line-height: 18px;
}
.menu-item:hover { background: #000080; color: #fff; }

/* ── Desktop ─────────────────────────────────────────────────────────────────── */
#desktop {
  position: fixed;
  top: 22px; left: 0; right: 0; bottom: 0;
}

/* ── Win3.1 Window Base ──────────────────────────────────────────────────────── */
.win31-window {
  position: absolute;
  background: #c0c0c0;
  border-top:    2px solid #ffffff;
  border-left:   2px solid #ffffff;
  border-right:  2px solid #404040;
  border-bottom: 2px solid #404040;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  resize: both;
  overflow: hidden;
  min-width: 160px;
  min-height: 80px;
}

/* Modal dialog shouldn't be resizable */
#modal-dialog, #intro-dialog {
  resize: none;
  overflow: visible;
}

.win31-titlebar {
  background: linear-gradient(to right, #000080, #0000aa);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 18px;
  cursor: default;
  user-select: none;
}

.draggable .win31-titlebar { cursor: move; }

.win31-close-btn {
  background: #c0c0c0;
  color: #000;
  border-top:    1px solid #fff;
  border-left:   1px solid #fff;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  width: 14px; height: 14px;
  font-size: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Marlett', 'Arial';
}
.win31-close-btn:active {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #fff;
  border-bottom: 1px solid #fff;
}

.win31-inner {
  padding: 4px;
  overflow: auto;
}

/* ── Dungeon Window ──────────────────────────────────────────────────────────── */
#dungeon-window {
  left: 4px; top: 4px;
  z-index: 100;
  width: 1040px;
  height: 840px;
  display: flex;
  flex-direction: column;
}

#dungeon-canvas {
  display: block;
  image-rendering: pixelated;
  cursor: default;
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #000;
}

/* ── Stats Window ────────────────────────────────────────────────────────────── */
#stats-window {
  left: 1050px; top: 4px;
  width: 360px;
  height: 840px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* Stats panel styled like the original LAD cyan-on-black strip */
#stats-content {
  padding: 4px;
  font-size: 11px;
  line-height: 1.5;
  background: #000;
  color: #66eeee;
  font-family: 'Courier New', monospace;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.stat-line    { color: #ffdd44; font-weight: bold; }
.stat-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 6px; margin: 3px 0; }
.stat-grid span { font-family: 'Courier New', monospace; font-size: 10px; color: #66eeee; }

.equip-section { margin-top: 4px; border-top: 1px solid #228888; padding-top: 3px; }
.equip-row { margin: 1px 0; color: #aaffff; }
.equip-label { color: #ffdd44; }

.hp-good { color: #44ff44; font-weight: bold; }
.hp-mid  { color: #ffff44; font-weight: bold; }
.hp-low  { color: #ff4444; font-weight: bold; }
.sp-val  { color: #ff88ff; font-weight: bold; }

#stat-artifact {
  color: #ffdd00;
  font-weight: bold;
  font-size: 11px;
  text-align: center;
  margin-top: 4px;
}

#stat-identify { margin-top: 2px; font-size: 10px; text-align: center; }
.stat-id-ready   { color: #44ff44; font-weight: bold; }
.stat-id-cooling { color: #ff8844; }

.time-warning { color: #cc0000; font-weight: bold; }

/* ── Messages Window ─────────────────────────────────────────────────────────── */
#messages-window {
  left: 4px; top: 860px;
  width: 1280px;
  height: 200px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #000;
  padding: 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.4;
}

.msg { white-space: nowrap; }

/* ── Inventory Window ────────────────────────────────────────────────────────── */
#inventory-window {
  left: 660px; top: 4px;
  width: 280px;
  z-index: 200;
}

#inventory-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.inv-item {
  border-bottom: 1px solid #808080;
  padding: 3px 0;
}
.inv-name { display: block; }
.inv-dur  { color: #808080; font-size: 10px; }
.inv-btns { margin-top: 2px; }
.inv-btns button { margin-right: 2px; }
.inv-empty { color: #808080; padding: 4px; }
.broken  { color: #cc0000; font-weight: bold; }
.equipped { color: #005500; font-weight: bold; }

/* ── Spells Window ───────────────────────────────────────────────────────────── */
#spells-window {
  left: 660px; top: 4px;
  width: 240px;
  z-index: 200;
}

#spells-list { padding: 4px; max-height: 350px; overflow-y: auto; }

.spell-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border-bottom: 1px solid #b0b0b0;
}
.spell-name { flex: 1; }
.spell-cost { color: #0000cc; font-family: monospace; }
.spell-disabled { opacity: 0.5; }

/* ── Effects Window ──────────────────────────────────────────────────────────── */
#effects-window {
  left: 660px; top: 380px;
  width: 220px;
  z-index: 200;
}

#effects-list { padding: 4px; max-height: 200px; overflow-y: auto; }
.effect-item { padding: 2px 0; border-bottom: 1px solid #b0b0b0; color: #660066; }

/* ── Win3.1 Buttons ──────────────────────────────────────────────────────────── */
button, .win31-btn-action {
  background: #c0c0c0;
  border-top:    1px solid #ffffff;
  border-left:   1px solid #ffffff;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
  padding: 2px 8px;
  font-family: 'MS Sans Serif', 'Arial', sans-serif;
  font-size: 11px;
  cursor: pointer;
  min-width: 28px;
}
button:active, .win31-btn-action:active {
  border-top:    1px solid #404040;
  border-left:   1px solid #404040;
  border-right:  1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}
button:disabled { color: #808080; cursor: default; }

/* ── Modal / Dialog ──────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
}

#modal-dialog {
  position: relative;
  min-width: 260px;
  max-width: 540px;
}

#modal-body {
  padding: 10px 12px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 12px;
}

#modal-btns {
  padding: 6px 12px;
  display: flex;
  gap: 6px;
  border-top: 1px solid #808080;
  justify-content: flex-end;
}

.win31-btn-action {
  min-width: 60px;
  text-align: center;
}

/* ── Intro Screen ────────────────────────────────────────────────────────────── */
#intro-screen {
  position: fixed;
  top: 22px; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9980;
}

#intro-dialog {
  position: relative;
  width: 420px;
}

.intro-art {
  background: #000;
  color: #cc2200;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 8px;
  text-align: center;
  white-space: pre;
  line-height: 1.3;
  margin: 6px 4px;
}

.intro-body {
  padding: 8px 12px;
  font-size: 12px;
}

.intro-body p { margin-bottom: 6px; }

.diff-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 8px 12px 10px;
  border-top: 1px solid #808080;
}

.diff-btns button {
  min-width: 80px;
  padding: 4px 12px;
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.help-table { border-collapse: collapse; width: 100%; font-size: 11px; }
.help-table td { padding: 2px 6px; border-bottom: 1px solid #d0d0d0; }
.help-table td:first-child { font-family: 'Courier New', monospace; color: #000080; }

.college-table { border-collapse: collapse; width: 100%; font-size: 11px; }
.college-table th, .college-table td { padding: 2px 6px; border: 1px solid #c0c0c0; }
.college-table th { background: #c0c0c0; }

.shop-list { max-height: 300px; overflow-y: auto; }
.shop-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #d0d0d0; }
.shop-item span:first-child { flex: 1; }
.shop-price { color: #884400; font-weight: bold; }

.sell-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #d0d0d0; }
.sell-item span:first-child { flex: 1; }

.id-item, .tp-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid #d0d0d0; }
.id-item span, .tp-item span { flex: 1; }

.death-msg { color: #cc0000; font-size: 14px; font-weight: bold; text-align: center; margin: 6px 0; }
.win-msg   { color: #cc8800; font-size: 14px; font-weight: bold; text-align: center; margin: 6px 0; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 14px; }
::-webkit-scrollbar-track { background: #c0c0c0; border: 1px inset #808080; }
::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-top:    1px solid #fff;
  border-left:   1px solid #fff;
  border-right:  1px solid #404040;
  border-bottom: 1px solid #404040;
}

hr { border: none; border-top: 1px solid #808080; margin: 6px 0; }
