/* Original Win98-styled chrome. No Microsoft assets. */

:root {
  color-scheme: light;
  --face: #c0c0c0;
  --light: #ffffff;
  --mid: #dfdfdf;
  --shadow: #808080;
  --dark: #000000;
  --title-a: #000080;
  --title-b: #1084d0;
  --text: #000000;
  --font: "Liberation Sans", "Nimbus Sans", Verdana, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font: 13px/1.35 var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 32px 20px 40px;
}

button, select { font: inherit; color: inherit; }
button { cursor: pointer; }

#app { width: min(920px, 100%); display: flex; justify-content: center; }

.win {
  width: min(440px, 100%);
  background: var(--face);
  padding: 2px;
  border: 2px solid;
  border-color: var(--mid) var(--dark) var(--dark) var(--mid);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}

.win.is-details { width: min(880px, 100%); }

.titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 2px 3px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  user-select: none;
}

.title-gap { flex: 1; }

.mark {
  width: 16px;
  height: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding: 1px;
  background: #000080;
  flex: none;
}
.mark i { display: block; }
.mark i:nth-child(1) { background: #0000ff; }
.mark i:nth-child(2) { background: #ff0000; }
.mark i:nth-child(3) { background: #00ff00; }
.mark i:nth-child(4) { background: #fff; }

.tbtn {
  width: 16px;
  height: 14px;
  padding: 0;
  line-height: 12px;
  font-weight: 700;
  background: var(--face);
  border: 1px solid;
  border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  box-shadow: 1px 1px 0 #000;
}

.client { padding: 12px 12px 10px; }

.lead { margin: 0 0 10px; }

.field, fieldset label, .mute-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field { margin: 8px 0; }
.field select, fieldset { width: 100%; }

select, .sunken {
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
}

select { padding: 3px 4px; min-height: 26px; }

fieldset {
  margin: 8px 0;
  padding: 8px 10px;
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
}
fieldset label { margin: 4px 0; }
fieldset legend { padding: 0 4px; }

.scores {
  margin: 8px 0;
  padding: 6px 8px 6px 22px;
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  font-size: 12px;
}
.scores:empty { display: none; }

.status { margin: 0 0 8px; min-height: 1.35em; }

.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.meter {
  flex: 1;
  height: 18px;
  padding: 1px;
}
.meter i {
  display: block;
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(90deg, #000080 0 8px, #ffffff 8px 10px);
}

.pct { margin: 0; min-width: 7.5em; font-variant-numeric: tabular-nums; }

.map-frame { margin: 4px 0 8px; padding: 2px; background: #c0c0c0; }
#grid {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  background: #c0c0c0;
  touch-action: none;
  cursor: crosshair;
}

.legend, .files {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 14px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 12px;
}
.legend li, .files li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.legend i, .files i {
  width: 13px;
  height: 13px;
  flex: none;
  border: 1px solid #808080;
  background: #fff;
}
.files { max-height: 112px; overflow: auto; }
.files em { margin-left: auto; color: #303030; font-style: normal; }
.files .is-hot { outline: 1px dotted #000; }

.powers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.stats { margin: 0 0 8px; font-variant-numeric: tabular-nums; font-size: 12px; }

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.spacer { flex: 1; }

.btn {
  min-height: 26px;
  padding: 3px 12px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset -1px -1px 0 var(--shadow), inset 1px 1px 0 var(--mid);
}
.btn:active, .btn[aria-pressed="true"] {
  border-color: var(--dark) var(--light) var(--light) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shadow);
  padding: 4px 11px 2px 13px;
}
.btn:disabled { color: #808080; text-shadow: 1px 1px 0 #fff; }
.btn.default { outline: 1px solid #000; outline-offset: 2px; }
.btn:focus-visible, .tbtn:focus-visible, select:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -3px;
}

.shade {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.28);
}
.dialog { width: min(460px, 100%); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); }
.dialog p { margin: 0 0 8px; }
.dialog .share {
  margin: 0 0 10px;
  padding: 8px;
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  font-weight: 700;
}
.legend.pop { margin-bottom: 10px; }
.ach { margin: 0 0 8px; padding-left: 18px; }
.ach li { margin: 3px 0; }

.dim {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.82);
  color: #d0d0d0;
  text-align: center;
  transition: opacity 600ms linear;
}
.dim p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 7;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 10px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
}

.pad {
  display: none;
  grid-template-columns: repeat(3, 52px);
  grid-template-areas: ". up ." "left use right" ". down .";
  justify-content: center;
  gap: 6px;
  margin: 4px 0 8px;
}
.pad button {
  min-width: 48px;
  min-height: 48px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
}
.pad [data-dir="up"] { grid-area: up; }
.pad [data-dir="left"] { grid-area: left; }
.pad [data-dir="right"] { grid-area: right; }
.pad [data-dir="down"] { grid-area: down; }
.pad [data-use] { grid-area: use; }

body.mode-game .pad { display: grid; }

body.is-saver {
  padding: 0;
}
body.is-saver #app { width: 100%; }
body.is-saver .win {
  width: 100vw;
  min-height: 100vh;
  border: 0;
  box-shadow: none;
  background: #000;
}
body.is-saver .titlebar,
body.is-saver .status,
body.is-saver .meter-row,
body.is-saver .legend,
body.is-saver .files,
body.is-saver .powers,
body.is-saver .stats,
body.is-saver .buttons,
body.is-saver .pad { display: none !important; }
body.is-saver .client { padding: 0; }
body.is-saver .map-frame { border: 0; margin: 0; padding: 0; background: #000; }
body.is-saver #grid { width: 100vw; height: 100vh; aspect-ratio: auto; }

@media (min-width: 800px) and (pointer: fine) {
  body.mode-game .pad { display: none; }
}

@media (max-width: 700px) {
  body { padding: 8px 8px 12px; }
  .client { padding: 8px 8px 6px; }
  .btn, select { min-height: 44px; }
  .files { grid-template-columns: 1fr; max-height: 72px; }
  .legend, .stats { margin-bottom: 4px; }
  .meter-row { flex-direction: column; align-items: stretch; }
  .tbtn { width: 28px; height: 24px; }
  .pad { gap: 4px; margin: 2px 0 4px; }
  .pad button { min-width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .dim { transition: none; }
}

.reduce .dim { transition: none; }
