/* Scrabble screen */
.sc-screen { display: flex; flex-direction: column; gap: 8px; max-width: 640px; margin: 0 auto; color: #fff; }

.sc-topbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 600 13px system-ui; }
.sc-player { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .25); }
.sc-player .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.sc-player.turn .dot { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.sc-bag { margin-left: auto; opacity: .9; }

/* Board: full width, square, 15 columns. Squares are ~23px on a phone. */
.sc-board { display: grid; grid-template-columns: repeat(15, 1fr); gap: 1px; width: 100%; aspect-ratio: 1;
  background: #2f2a26; padding: 2px; border-radius: 8px; touch-action: manipulation; user-select: none; }
.sc-cell { position: relative; background: #d9d1bf; display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-width: 0; }
.sc-cell.m-DL { background: #9ccbe7; }
.sc-cell.m-TL { background: #2f7fc1; }
.sc-cell.m-DW, .sc-cell.m-STAR { background: #f2a8b5; }
.sc-cell.m-TW { background: #d9412f; }
.sc-cell .mlabel { font: 700 8px system-ui; color: rgba(0, 0, 0, .55); }
.sc-cell.m-TL .mlabel, .sc-cell.m-TW .mlabel { color: rgba(255, 255, 255, .85); }
.sc-cell.m-STAR .mlabel { font-size: 12px; }
.sc-cell.glow .sc-tile { outline: 2px solid #ffe14d; outline-offset: -2px; }

/* Tiles (board size; rack/loupe scale up below) */
.sc-tile { position: relative; width: 100%; height: 100%; background: #f4e4b8; color: #222; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font: 800 12px system-ui;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
.sc-tile .v { position: absolute; right: 1px; bottom: 0; font: 600 6px system-ui; }
.sc-tile.blank { color: #6b5b3e; }
.sc-tile.blank::after { content: '?'; position: absolute; left: 1px; top: 0; font: 600 6px system-ui; }
.sc-tile.staged { background: #fff3b0; outline: 2px solid #ffb703; outline-offset: -2px; }

.sc-preview { min-height: 22px; font: 700 14px system-ui; text-align: center; padding: 4px; }
.sc-preview.warn { color: #ffe08a; }
.sc-preview.bad { color: #ffb4a8; }

/* Rack */
.sc-rack { display: flex; gap: 4px; justify-content: center; padding: 10px 4px; background: #5b4636;
  border-radius: 12px; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35); flex-wrap: wrap; }
.sc-slot { width: 44px; height: 52px; border-radius: 6px; background: rgba(0, 0, 0, .18); flex: 0 0 auto; }
.sc-slot .sc-tile { font-size: 22px; border-radius: 6px; cursor: pointer; }
.sc-slot .sc-tile .v { font-size: 10px; right: 3px; bottom: 2px; }
.sc-slot .sc-tile.blank::after { font-size: 10px; left: 3px; top: 2px; }
.sc-tile.picked { outline: 3px solid #ffd84d; outline-offset: 1px; transform: translateY(-4px); }
.sc-tile.sel { outline: 3px solid #667eea; outline-offset: 1px; }

/* Actions */
.sc-actions { display: flex; flex-direction: column; gap: 8px; }
.sc-play { width: 100%; }
.sc-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sc-row button { padding: 10px 12px; }

/* Overlays: loupe, letter picker, exchange, history */
.sc-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center;
  justify-content: center; z-index: 100; }
.sc-box { background: #fff; color: #222; border-radius: 14px; padding: 16px; display: flex; flex-direction: column;
  gap: 12px; align-items: center; max-width: 92vw; max-height: 80vh; overflow-y: auto; }
.sc-box-title { font: 700 16px system-ui; }
.sc-loupe { display: grid; grid-template-columns: repeat(3, 56px); grid-auto-rows: 56px; gap: 2px;
  background: #2f2a26; padding: 2px; border-radius: 8px; }
.sc-loupe .sc-cell { cursor: pointer; }
.sc-loupe .sc-cell.off { background: #2f2a26; }
.sc-loupe .sc-tile { font-size: 22px; }
.sc-loupe .sc-tile .v { font-size: 10px; }
.sc-loupe .mlabel { font-size: 12px; }
.sc-letters { display: grid; grid-template-columns: repeat(6, 44px); gap: 6px; }
.sc-letters button { padding: 0; min-height: 44px; }
.sc-xrack { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sc-history { display: flex; flex-direction: column; gap: 6px; min-width: 240px; font: 500 14px system-ui; }
.sc-history .h { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #eee; padding: 4px 0; }

/* Tablets: bigger glyphs; squares are >= 40px so the loupe is skipped (see view.js) */
@media (min-width: 600px) {
  .sc-tile { font-size: 18px; }
  .sc-tile .v { font-size: 9px; }
  .sc-cell .mlabel { font-size: 10px; }
}
