/* Speed — Playnesta original (MIT). Table, cards, buttons. */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: radial-gradient(circle at 50% 18%, #1a3833, #101f1c 70%);
  color: #e9f4f0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: calc(var(--pn-vh, 1vh) * 100);
  max-width: 560px;
  margin: 0 auto;
  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: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  margin-left: 6px;
  text-transform: lowercase;
}
.meta {
  display: flex;
  gap: 10px;
  font-size: 14px;
  flex-wrap: wrap;
}
.table {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side .who {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: 0.75;
}
.opp {
  display: flex;
  gap: 6px;
  justify-content: center;
  min-height: 78px;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.pilebox {
  width: 74px;
  height: 94px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed #3f6f64;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  min-height: 24px;
}
.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 78px;
}
.card {
  display: inline-flex;
  width: 62px;
  height: 78px;
  border-radius: 9px;
  background: #fdfdf6;
  color: #1d2431;
  position: relative;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.card.red {
  color: #c2233a;
}
.card .corner {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 13px;
  line-height: 1.15;
}
.card .pip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.card.back {
  background: repeating-linear-gradient(45deg, #2c5a50, #2c5a50 6px, #234a42 6px, #234a42 12px);
  border: 2px solid #5c9c8d;
  cursor: default;
}
.card.fresh {
  outline: 3px solid #ffd166;
}
.hand .card:active {
  transform: scale(0.95);
}
.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #5c9c8d;
  background: #1d443d;
  color: #e9f4f0;
  cursor: pointer;
}
.btn.primary {
  background: #5c9c8d;
  color: #fff;
  border-color: #8cc9ba;
}
.btn.flip {
  background: #a46a1f;
  border-color: #ffd166;
  color: #fff;
  animation: pulse 0.9s ease-in-out infinite;
}
.btn.flip.hidden {
  display: none;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.btn:active {
  transform: scale(0.97);
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay.hidden {
  display: none;
}
.panel {
  background: #173430;
  border: 1px solid #5c9c8d;
  border-radius: 16px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}
.panel p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
}
.panel-wide {
  max-width: 520px;
}
.rules-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
}
.rules-list li {
  margin-bottom: 8px;
}
@media (max-height: 700px) {
  .card {
    width: 54px;
    height: 68px;
  }
  .card .pip {
    font-size: 24px;
  }
  .pilebox {
    width: 62px;
    height: 78px;
  }
  .opp {
    min-height: 68px;
  }
}
