.remi41.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;
}
.remi41 .topbar { grid-area: bar; }
.remi41 .timer { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.remi41 .timer-fill { height: 100%; width: 0; background: var(--amber); }
.remi41 .timer-fill.low { background: var(--danger); }

.remi-seats {
  grid-area: seats;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
}
.remi-seats .seat {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.remi-seats .seat.is-active {
  background: rgba(255, 179, 71, .14);
  border-color: var(--amber);
}
.remi-seats .seat-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.remi-seats .seat-score {
  font-size: 11px;
  color: var(--amber);
  font-weight: 700;
}
.remi-seats .seat-cards {
  font-size: 11px;
  color: var(--ink-2);
}

.felt {
  grid-area: felt;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background: radial-gradient(85% 85% at 50% 45%, #1b382b, #0d1e16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 40px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 12px 12px;
}
.remi41 .status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 30, 24, .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: 5;
}
.remi41 .status.mine {
  background: var(--amber);
  color: #1a1612;
  font-weight: 700;
}
.suit-icon {
  width: 14px;
  height: 16px;
  flex: none;
  background: var(--ivory);
  border-radius: 3px;
  padding: 1px;
}

.piles-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.pile-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pile-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, .6);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pile-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 68px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .15s ease, filter .15s ease;
}
.pile-btn:not([disabled]):hover {
  transform: translateY(-4px) scale(1.04);
}
.pile-btn.can-take {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
  border-radius: 8px;
  animation: pulse-glow 1.2s infinite alternate;
}
@keyframes pulse-glow {
  from { filter: drop-shadow(0 0 4px rgba(255, 179, 71, .4)); }
  to { filter: drop-shadow(0 0 12px rgba(255, 179, 71, .9)); }
}
.pile-count {
  position: absolute;
  bottom: -8px;
  background: rgba(15, 15, 15, .85);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .2);
}

.card-svg { display: block; width: 100%; height: auto; overflow: visible; }
.card-body { fill: #fffdf7; stroke: #cbbb9c; stroke-width: 1.2; }

.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;
}
.my-eval-badge {
  background: rgba(255, 255, 255, .1);
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.my-eval-badge.target-near {
  background: rgba(255, 179, 71, .25);
  color: var(--amber);
  border: 1px solid var(--amber);
}
.my-eval-badge.is-41 {
  background: #27ae60;
  color: #fff;
  font-weight: 900;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
}
.action-hint {
  font-size: 12px;
  color: var(--amber);
  font-weight: 700;
}
.btn-accent {
  background: #27ae60;
  color: #fff;
  border: 1px solid #2ecc71;
  font-weight: 700;
}
.btn-accent:hover {
  background: #2ecc71;
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 0 8px;
  min-height: 100px;
}
.card-btn {
  background: none;
  border: none;
  padding: 0;
  width: 64px;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease;
  position: relative;
}
.card-btn.can-discard {
  cursor: pointer;
}
.card-btn.can-discard:hover {
  transform: translateY(-12px) scale(1.06);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .4));
}
.card-btn.discard-hint::after {
  content: 'Buang';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.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: #1e1915;
  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;
}
