.karambol.table {
  height: 100vh;
  height: var(--app-h);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'bar' 'seats' 'felt' 'me';
  gap: 6px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.karambol .topbar { grid-area: bar; }
.karambol .timer { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.karambol .timer-fill { height: 100%; width: 0; background: var(--amber); }
.karambol .timer-fill.low { background: var(--danger); }

.karambol-seats {
  grid-area: seats;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.karambol-seats .seat {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.karambol-seats .seat.is-active {
  background: rgba(255, 179, 71, .15);
  border-color: var(--amber);
}
.karambol-seats .seat-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.karambol-seats .seat-score {
  font-size: 12px;
  color: var(--amber);
  font-weight: 700;
}

.felt {
  grid-area: felt;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background: #100b08;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.karambol .status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(20, 14, 10, .85);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}
.karambol .status.mine {
  background: var(--amber);
  color: #1a1612;
  font-weight: 700;
}

.canvas-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#boardCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .7);
}

.me {
  grid-area: me;
  display: grid;
  gap: 6px;
}
.me-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 13px;
}

.controls-panel {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
}
@media (max-width: 600px) {
  .controls-panel {
    grid-template-columns: 1fr 1fr;
  }
}
.control-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, .7);
}
.control-row input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}
.strike-btn {
  font-weight: 800;
  padding: 8px 16px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.result {
  background: #1c140d;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 16px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}
.result h2 {
  margin: 0;
  font-size: 20px;
}
.result-sub {
  color: var(--ink-2);
  font-size: 13px;
  margin: 2px 0 0;
}
.result-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  font-size: 14px;
}
.result-row.win {
  background: rgba(255, 179, 71, .15);
  border: 1px solid var(--amber);
  font-weight: 700;
}
.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* Papan 3D */
.canvas-wrap { position: relative; }
.board3d { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 12px; overflow: hidden; background: radial-gradient(80% 80% at 50% 40%, #3a2818, #130c07); touch-action: none; }
.board3d[hidden] { display: none; }
