* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, sans-serif;
  background: #1a1d24; color: #e8eaf0; min-height: 100vh;
}
#app { max-width: 900px; margin: 0 auto; padding: 20px 12px; }
.view { text-align: center; }
.hidden { display: none !important; }
h1 { font-size: 3rem; letter-spacing: .3em; margin: 60px 0 8px; color: #f1c40f; }
h2 { margin: 10px 0; }
h3 { margin: 12px 0 6px; font-size: .95rem; color: #9aa3b8; font-weight: 600; }
.sub { color: #9aa3b8; margin-bottom: 30px; }
.hint { color: #9aa3b8; font-size: .85rem; max-width: 480px; margin: 4px auto 14px; }
.code { font-size: .8rem; color: #f1c40f; letter-spacing: .15em; }
input[type=text], #inp-name, #inp-code {
  background: #262a35; border: 1px solid #3a4152; color: #e8eaf0;
  padding: 10px 14px; border-radius: 8px; font-size: 1rem; margin: 4px;
}
#inp-code { width: 90px; text-transform: uppercase; text-align: center; letter-spacing: .2em; }
button {
  background: #313746; color: #e8eaf0; border: 1px solid #454e63;
  padding: 10px 18px; border-radius: 8px; font-size: .95rem; cursor: pointer; margin: 4px;
}
button:hover:not(:disabled) { background: #3d4457; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #f1c40f; color: #1a1d24; border-color: #f1c40f; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #ffd32e; }
button.mode.on { border-color: #f1c40f; color: #f1c40f; }
.row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; }
.link-btn { font-size: .8rem; padding: 5px 12px; }
.game-list { list-style: none; padding: 0; max-width: 440px; margin: 8px auto; }
.game-list li {
  display: flex; justify-content: space-between; align-items: center;
  background: #262a35; border: 1px solid #3a4152; border-radius: 8px;
  padding: 8px 14px; margin: 6px 0; text-align: left;
}
.game-list li.empty { justify-content: center; color: #5a6377; }
.game-list li i { color: #9aa3b8; font-size: .82rem; font-style: normal; }
.join-req {
  background: #24352a; border: 1px solid #2ecc71; border-radius: 8px;
  padding: 10px 16px; margin: 8px auto; max-width: 480px;
}
.chk { display: block; color: #9aa3b8; font-size: .85rem; margin: 8px 0 20px; }
.or { color: #5a6377; margin: 14px 0; }
.msg { color: #9aa3b8; }
.err { color: #ff7b72; min-height: 1.2em; font-size: .9rem; }
.turn { font-weight: 600; min-height: 1.4em; }
.turn.mine { color: #2ecc71; }
.turn.theirs { color: #e67e22; }

.board-wrap { display: inline-block; margin: 6px; }
.board-wrap svg { display: block; touch-action: manipulation; }
svg .cell { fill: #242833; stroke: #3a4152; stroke-width: 1; }
svg .cell.hover { fill: #2e3444; }
svg .cell.queryable { cursor: pointer; }
svg .cell.queryable:hover { fill: #35507a; }
svg .emit {
  fill: #262a35; stroke: #454e63; cursor: pointer; rx: 4;
}
svg .emit:hover { fill: #35507a; }
svg .emit-txt { fill: #9aa3b8; font-size: 11px; pointer-events: none; }
svg .emit.active { stroke: #f1c40f; }
svg .gem { stroke: rgba(0,0,0,.45); stroke-width: 1.5; }
svg .gem.sel { stroke: #fff; stroke-width: 2.5; stroke-dasharray: 4 2; }
svg .mark { pointer-events: none; }
svg .wave-dot { stroke: #1a1d24; stroke-width: 1; }

.tray { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.tray .piece { background: #262a35; border: 2px solid #3a4152; border-radius: 8px; padding: 6px; cursor: pointer; }
.tray .piece.sel { border-color: #f1c40f; }
.tray .piece.placed { opacity: .45; }
.tray .piece svg { display: block; }

.play-cols { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; align-items: flex-start; text-align: center; }
.log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; text-align: left;
       background: #21242e; border-radius: 8px; padding: 8px 12px; font-size: .82rem; min-width: 220px; }
.log li { padding: 3px 0; border-bottom: 1px solid #2b2f3c; }
.log li:last-child { border: 0; }
.log .me { color: #2ecc71; }
.log .op { color: #e67e22; }
.log .sys { color: #9aa3b8; font-style: italic; }
.swatch { display: inline-block; width: .8em; height: .8em; border-radius: 50%; vertical-align: -0.1em; margin: 0 .25em; border: 1px solid #000; }

@media (max-width: 640px) {
  h1 { font-size: 2.2rem; }
  .play-cols { gap: 8px; }
}
