:root {
  --page-bg: #008080;
  --window-bg: #c0c0c0;
  --panel-bg: #bdbdbd;
  --light: #ffffff;
  --mid-dark: #808080;
  --dark: #000000;
  --digit-bg: #1b0000;
  --digit-fg: #ff3030;
  --text: #111111;
  --cell-size: 28px;
  font-family: "Tahoma", "MS Sans Serif", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100vw - 12px));
  margin: 0 auto;
  padding: 8px 0 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  color: #ffffff;
}

.topbar strong {
  display: block;
  font-size: 18px;
}

.topbar-copy {
  display: block;
  opacity: 0.92;
}

.banner {
  background: #ffffcc;
  color: #000000;
  border: 2px solid #000000;
  padding: 6px 10px;
  min-height: 34px;
}

.workspace,
.app-view,
.sidebar,
.compact-stack,
.stack-form,
.preset-list,
.list-block,
.friends-grid {
  display: grid;
  gap: 8px;
}

.window {
  background: var(--window-bg);
  border-top: 2px solid var(--light);
  border-left: 2px solid var(--light);
  border-right: 2px solid var(--dark);
  border-bottom: 2px solid var(--dark);
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  font-weight: 700;
}

.window-body {
  padding: 8px;
}

.sub-panel,
.inset-panel {
  background: var(--panel-bg);
  border-top: 2px solid var(--mid-dark);
  border-left: 2px solid var(--mid-dark);
  border-right: 2px solid var(--light);
  border-bottom: 2px solid var(--light);
  padding: 6px;
}

.sub-panel h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.info-row,
.status-strip,
.list-item,
.preset-card,
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.info-row {
  padding: 4px 6px;
  background: #d6d6d6;
  border: 1px solid var(--mid-dark);
}

.stack-form label,
.select-row {
  display: grid;
  gap: 4px;
}

input,
select {
  width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  border-top: 2px solid var(--mid-dark);
  border-left: 2px solid var(--mid-dark);
  border-right: 2px solid var(--light);
  border-bottom: 2px solid var(--light);
  background: #ffffff;
  color: #000000;
}

.classic-button {
  min-height: 30px;
  padding: 4px 10px;
  border: none;
  background: var(--window-bg);
  border-top: 2px solid var(--light);
  border-left: 2px solid var(--light);
  border-right: 2px solid var(--dark);
  border-bottom: 2px solid var(--dark);
  cursor: pointer;
}

.classic-button:active,
.classic-button.active {
  border-top: 2px solid var(--dark);
  border-left: 2px solid var(--dark);
  border-right: 2px solid var(--light);
  border-bottom: 2px solid var(--light);
}

.small-button {
  min-height: 26px;
  padding: 2px 8px;
}

.preset-card,
.list-item {
  background: #d6d6d6;
  border: 1px solid var(--mid-dark);
  padding: 6px;
}

.preset-text,
.list-text {
  display: grid;
  gap: 2px;
}

.list-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.presence.online {
  color: #006400;
}

.presence.in_match {
  color: #000080;
}

.presence.offline {
  color: #5a5a5a;
}

.game-window .window-body {
  padding: 10px;
}

.mine-panel {
  background: var(--window-bg);
  border-top: 2px solid var(--light);
  border-left: 2px solid var(--light);
  border-right: 2px solid var(--dark);
  border-bottom: 2px solid var(--dark);
  padding: 10px;
}

.score-strip,
.status-strip {
  margin-bottom: 8px;
}

.score-strip {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.digit-box {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--digit-bg);
  color: var(--digit-fg);
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 2px;
  border-top: 2px solid var(--mid-dark);
  border-left: 2px solid var(--mid-dark);
  border-right: 2px solid var(--light);
  border-bottom: 2px solid var(--light);
}

.face-button {
  justify-self: center;
  width: 42px;
  height: 42px;
  border: none;
  background: var(--window-bg);
  border-top: 2px solid var(--light);
  border-left: 2px solid var(--light);
  border-right: 2px solid var(--dark);
  border-bottom: 2px solid var(--dark);
  font-weight: 700;
  cursor: pointer;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.status-item {
  min-height: 48px;
  background: #d6d6d6;
  border: 1px solid var(--mid-dark);
  padding: 4px 6px;
  display: grid;
  gap: 2px;
  align-content: center;
}

.status-item span {
  font-size: 12px;
}

.board-wrap {
  overflow: auto;
  padding: 8px;
}

.board {
  display: grid;
  gap: 0;
  justify-content: start;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  background: var(--window-bg);
  border: none;
  border-top: 3px solid var(--light);
  border-left: 3px solid var(--light);
  border-right: 3px solid var(--mid-dark);
  border-bottom: 3px solid var(--mid-dark);
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.cell.revealed {
  border: 1px solid var(--mid-dark);
  background: #c6c6c6;
  cursor: default;
}

.cell.flagged {
  color: #cc0000;
}

.cell.mine {
  background: #ffb3b3;
  color: #000000;
}

.cell.number-1 {
  color: #0000ff;
}

.cell.number-2 {
  color: #008200;
}

.cell.number-3 {
  color: #ff0000;
}

.cell.number-4 {
  color: #000084;
}

.cell.number-5 {
  color: #840000;
}

.cell.number-6 {
  color: #008284;
}

.cell.number-7 {
  color: #000000;
}

.cell.number-8 {
  color: #808080;
}

@media (min-width: 900px) {
  .app-view {
    grid-template-columns: 360px minmax(0, 1fr);
    align-items: start;
  }

  .friends-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  :root {
    --cell-size: 24px;
  }

  .score-strip {
    grid-template-columns: 64px 1fr 64px;
  }

  .digit-box {
    font-size: 24px;
    min-height: 38px;
  }

  .face-button {
    width: 38px;
    height: 38px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }
}
