/* Draw & guess page. Builds on styles.css (buttons, top bar, dialogs, chat, toast). */

body.dg { height: auto; min-height: 100vh; min-height: 100dvh; overflow: auto; }
.dg-main {
  flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start;
}
.dg-create { grid-column: 1 / -1; max-width: 460px; margin: 24px auto; }
.dg-create .btn { width: 100%; }

.dg-game { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.dg-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
}
.dg-round { color: var(--muted); font-size: 13px; }
.dg-word { font: 800 20px/1.2 var(--ui); letter-spacing: .18em; text-transform: uppercase; text-align: center; white-space: nowrap; }
.dg-word.known { color: var(--brass-2); letter-spacing: .06em; }
.dg-word small { display: block; font-size: 11px; letter-spacing: 0; color: var(--muted); font-weight: 600; text-transform: none; }
.dg-timer { justify-self: end; font: 800 18px/1 var(--ui); font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: right; }
.dg-timer.low { color: #ff8a7a; }

.dg-status { margin: 0; text-align: center; font-weight: 700; min-height: 1.5em; }
.dg-choices { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.dg-choices .btn { min-height: 48px; min-width: 110px; font-weight: 800; text-transform: capitalize; }

/* The canvas is a square; drawing coordinates are 0-1000 whatever its size on screen. */
.dg-board { position: relative; width: 100%; max-width: 620px; margin: 0 auto; aspect-ratio: 1; }
.dg-board canvas {
  display: block; width: 100%; height: 100%; border-radius: 14px; background: #fffdf7;
  border: 1px solid var(--line); touch-action: none; cursor: default;
}
.dg-board canvas.can-draw { cursor: crosshair; box-shadow: 0 0 0 3px rgba(217, 179, 106, .45); }
.dg-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px; border-radius: 14px; background: rgba(13, 18, 16, .82); color: #fff; text-align: center;
}
.dg-overlay h3 { margin: 0; font: 700 22px/1.2 var(--display); }
.dg-overlay strong { font-size: 28px; color: var(--brass-2); text-transform: uppercase; letter-spacing: .06em; }
.dg-overlay ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 15px; display: grid; gap: 2px; }
.dg-overlay .gain { color: #8fe3a8; font-weight: 800; }

.dg-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.dg-colors, .dg-sizes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dg-swatch, .dg-size {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--panel-2);
}
.dg-swatch.on, .dg-size.on { border-color: var(--brass-2); box-shadow: 0 0 0 2px rgba(217, 179, 106, .5); }
.dg-swatch.eraser { background: #fffdf7; font-size: 16px; }
.dg-size i { display: block; border-radius: 50%; background: var(--text); }
.dg-tools .btn { min-height: 40px; }

.dg-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.dg-actions:empty { display: none; }
.dg-actions .btn { min-height: 44px; }

.dg-players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dg-players li {
  display: flex; flex-direction: column; padding: 6px 12px; min-width: 88px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); font-size: 13.5px;
}
.dg-players li span { color: var(--muted); font-size: 12.5px; }
.dg-players li.drawing { border-color: var(--brass); }
.dg-players li.guessed { border-color: #3a9f62; }
.dg-players li.me b { color: var(--brass-2); }
.dg-players li.away { opacity: .55; }
.dg-players li.winner { box-shadow: 0 0 0 3px var(--brass); }

.dg-chat {
  display: flex; flex-direction: column; height: min(560px, 70dvh);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.dg-chat .log b { color: var(--brass-2); margin-right: 4px; }
.dg-chat .log li.correct { color: #8fe3a8; font-weight: 700; }
.dg-chat .log li.secret { color: var(--muted); font-style: italic; }
.dg-chat .log li.close { color: #f3c96a; }

.dg .sound-btn { padding: 0 10px; min-width: 40px; font-size: 1rem; }
.dg-howto { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.dg-howto summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.dg-howto ol { margin: 6px 0 4px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.dg-howto b { color: var(--text); }

/* Phones: one column, and the board is sized to the screen's height so the guess box sits just
   below it (tools, then chat, then scores) instead of a scroll away. */
@media (max-width: 760px) {
  .dg-main { grid-template-columns: minmax(0, 1fr); padding: 8px 10px 16px; gap: 8px; }
  .dg-game { display: contents; }
  .dg-bar { order: 1; padding: 6px 10px; }
  .dg-status { order: 2; font-size: 14.5px; }
  .dg-choices { order: 3; }
  .dg-board { order: 4; width: min(100%, max(240px, calc(100dvh - 370px))); }
  .dg-tools { order: 5; gap: 6px; }
  .dg-actions { order: 6; }
  .dg-chat { order: 7; height: 190px; }
  .dg-players { order: 8; }
  .dg-howto { order: 9; }
  .dg-word { font-size: 17px; letter-spacing: .12em; }
  .dg-swatch, .dg-size { width: 32px; height: 32px; }
  .dg-tools .btn { min-height: 36px; padding: 0 12px; }
}
.dg-remove {
  margin-left: 6px; min-width: 28px; min-height: 28px; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--line, rgba(255,255,255,.2)); background: transparent; color: inherit;
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer; vertical-align: middle;
}
.dg-remove:hover { border-color: var(--brass); }
