/* Tangram — Playnesta original (MIT, see LICENSE.txt). */
:root {
  --bg1: #1b2129;
  --bg2: #101418;
  --ink: #e9eef5;
  --dim: #93a1b3;
  --accent: #5ad6a8;
  --gold: #e8c469;
  --slot: #232c37;
  --slotline: #2f3a47;
  --pn-vh: 1vh;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
}
body {
  background: radial-gradient(circle at 50% 0%, var(--bg1), var(--bg2) 70%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#app {
  height: 100vh;
  height: calc(var(--pn-vh, 1vh) * 100);
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  font-size: 20px;
  font-weight: 800;
}
.brand small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  margin-left: 6px;
  text-transform: lowercase;
}
.meta {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--dim);
}
.meta b { color: var(--gold); }
.board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.16));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  overflow: hidden;
}
#board { width: 100%; height: 100%; display: block; }
.slot-poly { fill: var(--slot); stroke: var(--slotline); stroke-width: 0.06; }
.piece { cursor: grab; }
.piece.dragging { cursor: grabbing; }
.piece.selected .piece-poly { stroke: var(--gold); stroke-width: 0.14; }
.piece.placed { cursor: default; }
.piece-placed-glow { fill: rgba(90, 214, 168, 0); }
.msg {
  text-align: center;
  font-size: 14px;
  min-height: 20px;
  color: var(--dim);
}
.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid #3a4653;
  background: #232c37;
  color: var(--ink);
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  color: #06231a;
  border-color: #7fe4c2;
}
.btn:active { transform: scale(0.97); }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 16, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay.hidden { display: none; }
.panel {
  background: #1a222c;
  border: 1px solid #3a4653;
  border-radius: 16px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}
.panel-wide { max-width: 540px; }
.panel h2 { margin: 0 0 10px; font-size: 20px; color: var(--gold); }
.panel p { margin: 0 0 14px; font-size: 15px; line-height: 1.5; }
.rules-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
}
.rules-list li { margin-bottom: 8px; }
.rules-list b { color: var(--gold); }
@media (max-height: 560px) {
  .brand { font-size: 17px; }
  .msg { font-size: 12px; }
}
