/* Стиль «старой ОС»: бирюзовый рабочий стол, серые объёмные окна, синий заголовок, панель задач. */
:root {
  --face: #c0c0c0;
  --light: #ffffff;
  --shadow: #808080;
  --dark: #000000;
  --title1: #000080;
  --title2: #1084d0;
  --desk: #008080;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.desktop {
  background: var(--desk);
  font: 13px/1.35 Tahoma, 'MS Sans Serif', 'Segoe UI', Verdana, sans-serif;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 10px 46px;
  overflow: auto;
  user-select: none;
}
[hidden] { display: none !important; }

/* объёмные рамки */
.win {
  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 #dfdfdf;
  padding: 3px;
  max-width: 100%;
}
.sunken {
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
}
.titlebar {
  background: linear-gradient(90deg, var(--title1), var(--title2));
  color: #fff;
  font-weight: 700;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
}
.titlebar > span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti { width: 14px; height: 14px; background: #2a2a2a; border: 1px solid #fff; box-shadow: inset 0 3px 0 #5c5c5c; }
.tb-x {
  width: 18px; height: 16px; background: var(--face); color: #000; text-decoration: none; font-weight: 900;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
}

.btn95 {
  font: inherit; color: #000; background: var(--face); min-width: 86px; padding: 5px 12px; cursor: pointer;
  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 #dfdfdf;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn95.default { outline: 1px solid #000; outline-offset: -5px; }
.btn95:active:not(:disabled) { border-color: var(--dark) var(--light) var(--light) var(--dark); box-shadow: inset 1px 1px 0 var(--shadow); }
.btn95:disabled { color: var(--shadow); text-shadow: 1px 1px 0 #fff; cursor: default; }
.btn95:focus-visible { outline: 1px dotted #000; outline-offset: -6px; }
.win-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 6px 4px; flex-wrap: wrap; }

/* мастер правил и диалоги */
.dialog { width: min(620px, 100%); }
.wiz-body { display: flex; gap: 14px; padding: 12px 10px 4px; }
#wizArt { width: 150px; height: 210px; image-rendering: pixelated; flex: none; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); background: #008080; }
.wiz-text { flex: 1; min-height: 214px; }
.wiz-step { color: #404040; font-size: 11px; }
.wiz-text h1 { font-size: 18px; margin: 2px 0 8px; }
.wiz-text p { margin: 5px 0; }
.wiz-text table { border-collapse: collapse; width: 100%; font-size: 12px; }
.wiz-text td { padding: 3px 4px; border-bottom: 1px solid #a0a0a0; vertical-align: top; }
.wiz-text td:first-child { font-weight: 700; white-space: nowrap; }
.legend { display: grid; grid-template-columns: 30px 1fr; gap: 6px 8px; align-items: center; }
.legend canvas { width: 28px; height: 28px; image-rendering: pixelated; }
.dlg-body { padding: 10px; }
.dlg-body p { margin: 0 0 8px; }
.group { border: 2px groove #fff; margin: 8px 0 0; padding: 6px 10px 8px; }
.group legend { padding: 0 4px; }
.group label { display: block; padding: 2px 0; cursor: pointer; }
.group.small { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 12px; }
.group.small legend { grid-column: 1 / -1; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; }
.slot { background: #fff; padding: 8px; min-height: 64px; font-size: 12px; color: #606060; }
.slot.taken { color: #000; }
.slot b { display: block; font-size: 13px; }
.slot .x { font: inherit; font-size: 11px; background: none; border: 0; color: #00c; text-decoration: underline; cursor: pointer; padding: 0; margin-top: 4px; }

/* игра */
.game { width: auto; }
.menubar { display: flex; gap: 2px; padding: 2px 0 4px; flex-wrap: wrap; }
.menubar button { font: inherit; background: none; border: 1px solid transparent; padding: 2px 8px; cursor: pointer; }
.menubar button:hover { background: var(--title1); color: #fff; }
.status { display: flex; justify-content: space-between; align-items: center; padding: 5px 6px; margin-bottom: 5px; }
.led { background: #000; color: #ff2a2a; font: 700 24px/1 'Courier New', monospace; padding: 2px 4px; letter-spacing: 1px; min-width: 52px; text-align: center;
  border: 1px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); text-shadow: 0 0 4px rgba(255,0,0,.6); }
.face { padding: 0; width: 34px; height: 34px; background: var(--face); cursor: pointer;
  border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); }
.face:active { border-color: var(--dark) var(--light) var(--light) var(--dark); }
.face canvas { width: 26px; height: 26px; image-rendering: pixelated; display: block; margin: auto; }
.scores { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.scores:empty { display: none; }
.chip { background: #fff; padding: 3px 8px; border: 1px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.chip .sw { width: 10px; height: 10px; border: 1px solid #000; }
.chip .pts { font-weight: 700; }
.chip .st { color: #a00000; }
.board-wrap { display: flex; justify-content: center; background: #bdbdbd; overflow: auto; max-width: calc(100vw - 30px); }
#board { display: block; image-rendering: pixelated; touch-action: none; cursor: default; }
.strip-wrap { margin-top: 5px; display: flex; justify-content: center; background: #d9d2bf; }
#strip { display: block; height: clamp(96px, 16vh, 160px); max-width: 100%; image-rendering: pixelated; }
.flagmode { margin-top: 6px; width: 100%; }

/* итоги */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 10; }
.res-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
#resIcon { width: 48px; height: 48px; image-rendering: pixelated; flex: none; }
#resText { font-size: 14px; }
#resText b { font-size: 16px; }
.res-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 12px; }
.res-table th, .res-table td { border: 1px solid #a0a0a0; padding: 3px 6px; text-align: left; }
.res-table th { background: var(--face); }
.res-table tr.win td { background: #fff7c0; font-weight: 700; }

/* панель задач */
.taskbar { position: fixed; left: 0; right: 0; bottom: 0; height: 36px; background: var(--face); border-top: 2px solid var(--light);
  display: flex; align-items: center; gap: 6px; padding: 3px 4px; z-index: 5; }
.taskbar .start { font-weight: 700; min-width: 70px; padding: 4px 10px; }
.task { flex: 0 1 220px; padding: 4px 8px; border: 2px solid; border-color: var(--dark) var(--light) var(--light) var(--dark); background: #d8d8d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.clock { margin-left: auto; padding: 4px 10px; }

@media (max-width: 560px) {
  body.desktop { padding: 4px 4px 42px; align-items: flex-start; }
  .wiz-body { flex-direction: column; align-items: center; }
  #wizArt { width: 120px; height: 168px; }
  .group.small { grid-template-columns: 1fr; }
  .task { display: none; }
}
