:root {
  color-scheme: light;
  --teal: #008080;
  --yellow: #ffff80;
  --maroon: #800000;
  --olive: #c0c000;
  --face: #ece9d8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--teal);
  color: #000;
  font-family: "Times New Roman", "PMingLiU", "Microsoft JhengHei", serif;
}

.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-family: Tahoma, "Microsoft JhengHei", sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.titlebar a {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.5);
  padding: 1px 10px;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
}

.desk {
  min-height: calc(100vh - 32px);
  padding: 18px 12px 32px;
}

.stage {
  position: relative;
  width: min(980px, 100%);
  min-height: 640px;
  margin: 0 auto;
}

.welcome {
  position: absolute;
  left: 16px;
  top: 8px;
  width: 360px;
  padding: 8px 10px;
  background: #00c0c0;
  border: 1px solid #000;
  font-weight: 700;
  font-size: 22px;
}

button.vb {
  position: absolute;
  background: var(--face);
  border: 1px solid #000;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

button.vb:active { background: #ddd; }
button.vb:disabled { color: #888; cursor: default; }

.rules { left: 620px; top: 8px; width: 110px; height: 40px; }
.qbadge {
  position: absolute;
  left: 24px;
  top: 78px;
  min-width: 52px;
  padding: 6px 4px;
  text-align: center;
  background: var(--olive);
  border: 1px solid #000;
  font-weight: 700;
  font-size: 20px;
}
.peek {
  position: absolute;
  left: 96px;
  top: 74px;
  width: 110px;
  height: 42px;
  background: #fff;
  border: 1px solid #000;
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
  cursor: pointer;
}
.peep { left: 230px; top: 78px; width: 170px; height: 36px; }
.timer {
  position: absolute;
  left: 620px;
  top: 70px;
  width: 120px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #000;
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 20px;
}
#guess {
  position: absolute;
  left: 96px;
  top: 132px;
  width: 160px;
  height: 48px;
  border: 1px solid #000;
  font-family: "Courier New", monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
}
.go { left: 276px; top: 138px; width: 110px; height: 36px; }
.restart { left: 620px; top: 128px; width: 100px; height: 36px; }
.board-btn { left: 732px; top: 128px; width: 130px; height: 36px; }
.start { left: 620px; top: 176px; width: 242px; height: 42px; font-size: 22px; }

.log, .sheet, .board {
  position: absolute;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Courier New", "Microsoft JhengHei", monospace;
  font-size: 18px;
  line-height: 1.45;
  font-weight: 700;
}
.log {
  left: 16px;
  top: 230px;
  width: 460px;
  height: 390px;
  padding: 10px 12px;
  background: var(--yellow);
  border: 2px solid #000;
}
.sheet, .board {
  left: 500px;
  top: 230px;
  width: 372px;
  height: 390px;
  padding: 10px 12px;
  background: #fff;
  border: 2px solid #000;
}
.board {
  background: var(--maroon);
  color: #fff4cc;
  z-index: 2;
  white-space: pre;
  font-size: 15px;
  line-height: 1.35;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .35);
}
.modal[hidden] { display: none; }
.dlg {
  width: min(520px, 100%);
  padding: 14px;
  background: var(--face);
  border: 2px solid #000;
  box-shadow: 6px 6px 0 rgba(0,0,0,.25);
}
.dlg.wide { width: min(720px, 100%); }
.dlg-title {
  margin: -14px -14px 12px;
  padding: 6px 10px;
  background: #000080;
  color: #fff;
  font-family: Tahoma, "Microsoft JhengHei", sans-serif;
  font-weight: 700;
}
.dlg-body, .dlg p {
  white-space: pre-wrap;
  font-family: "PMingLiU", "Microsoft JhengHei", serif;
  font-size: 16px;
  line-height: 1.55;
}
.dlg .en {
  margin-top: 12px;
  color: #333;
  font-family: "Times New Roman", serif;
  font-size: 15px;
}
.dlg img {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 0 auto 8px;
  background: #fff;
  image-rendering: auto;
}
.dlg button.vb { position: static; min-width: 88px; height: 34px; margin-top: 8px; }
.dlg input {
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  font-size: 20px;
  font-family: "Microsoft JhengHei", sans-serif;
}

@media (max-width: 860px) {
  .stage { min-height: 0; display: flex; flex-direction: column; }
  .stage .welcome,
  .stage button.vb,
  .stage .qbadge,
  .stage .peek,
  .stage .timer,
  .stage #guess,
  .stage .log,
  .stage .sheet,
  .stage .board {
    position: static;
    display: block;
    width: 100%;
    margin: 8px 0 0;
    left: auto;
    top: auto;
    height: auto;
  }
  .stage .log, .stage .sheet, .stage .board { height: 240px; }
  .stage .welcome { font-size: 18px; }
  .stage button.vb, .stage .peek, .stage #guess { height: 44px; }
  .stage .log { order: 8; }
  .stage .sheet, .stage .board { order: 9; }
}
