/* Egyptian Rat Screw table — Playnesta original (MIT, see LICENSE.txt). */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: #0b2018;
  color: #f2ede3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100vh;
  min-height: calc(var(--pn-vh, 1vh) * 100);
  user-select: none;
  -webkit-user-select: none;
}
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100vh;
  min-height: calc(var(--pn-vh, 1vh) * 100);
}
.hidden {
  display: none !important;
}
i {
  opacity: 0.5;
  font-style: normal;
}

/* topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  background: #10362a;
  border: 1px solid #1e4d3d;
  border-radius: 10px;
  padding: 8px 12px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand small {
  font-weight: 400;
  opacity: 0.55;
  margin-left: 4px;
}
.meta {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* table */
.table {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.opp-row {
  display: flex;
  justify-content: center;
}
.opp,
.you-stack {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #10362a;
  border: 1px solid #1e4d3d;
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 52px;
}
.opp .who,
.you-stack .who {
  font-size: 13px;
  opacity: 0.85;
}
.opp {
  cursor: default;
}
.you-stack {
  cursor: pointer;
  -webkit-user-select: none;
  touch-action: manipulation;
  border-color: #2b7a5e;
}
.you-stack:active {
  background: #14523e;
}

/* felt + pile */
.felt {
  background: #14523e;
  background: radial-gradient(ellipse at 50% 30%, #1a6549, #0f3d2e 75%);
  border: 1px solid #1e4d3d;
  border-radius: 14px;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.challenge {
  min-height: 20px;
  font-size: 13px;
  opacity: 0.85;
  text-align: center;
}
.challenge.live {
  color: #ffd98a;
  font-weight: 600;
}
.pile {
  position: relative;
  width: 100%;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  -webkit-user-select: none;
  touch-action: none;
  border-radius: 10px;
  outline: none;
}
.pile:active {
  background: rgba(255, 255, 255, 0.05);
}
.pile-empty {
  opacity: 0.4;
  font-size: 13px;
  border: 1px dashed #2b5a48;
  border-radius: 10px;
  padding: 28px 36px;
}
.pile-slot {
  display: inline-block;
}
.pile-slot.s0 {
  transform: translateX(-54px) rotate(-4deg);
}
.pile-slot.s1 {
  transform: translateX(-18px) rotate(2deg);
}
.pile-slot.s2 {
  transform: translateX(18px) rotate(-2deg);
}
.pile-slot.s3 {
  transform: translateX(54px) rotate(4deg);
}
.pile-hint {
  font-size: 11px;
  opacity: 0.45;
}

/* cards */
.card {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 68px;
  height: 96px;
  border-radius: 8px;
  padding: 6px 7px;
  background: #f8f4e8;
  color: #14231c;
  font-size: 14px;
  line-height: 1.1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.card.red {
  color: #b3282d;
}
.card .corner {
  font-weight: 700;
}
.card .pip {
  align-self: center;
  font-size: 30px;
}
.back-card {
  background: repeating-linear-gradient(45deg, #27584a, #27584a 6px, #1d453a 6px, #1d453a 12px);
  border: 2px solid #f2ede3;
  width: 52px;
  height: 72px;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}
.stack-card {
  width: 44px;
  height: 62px;
}

/* message */
.msg {
  text-align: center;
  font-size: 14px;
  min-height: 20px;
  opacity: 0.95;
}

/* hand bar */
.hand-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.you-stack {
  flex: 1;
  justify-content: center;
}
.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn {
  appearance: none;
  border: 1px solid #2b5a48;
  background: #10362a;
  color: #f2ede3;
  border-radius: 8px;
  min-height: 44px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn.primary {
  background: #1f7a55;
  border-color: #35a97c;
  font-weight: 700;
}
.btn.big {
  min-height: 56px;
  font-size: 17px;
  letter-spacing: 0.04em;
}
.btn:active {
  filter: brightness(1.15);
}

/* overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 10, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}
.panel {
  background: #10362a;
  border: 1px solid #1e4d3d;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.panel-wide {
  max-width: 560px;
  text-align: left;
}
.panel h2 {
  margin: 0 0 10px;
}
.panel .btn {
  margin-top: 14px;
  width: 100%;
}
.rules-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 1.45;
}
.rules-list li::marker {
  color: #6fbf9a;
}

/* narrow phones */
@media (max-width: 430px) {
  .card {
    width: 58px;
    height: 82px;
  }
  .pile-slot.s0 {
    transform: translateX(-44px) rotate(-4deg);
  }
  .pile-slot.s3 {
    transform: translateX(44px) rotate(4deg);
  }
  .hand-bar {
    flex-direction: column;
  }
  .controls {
    flex-direction: row;
  }
  .btn.big {
    flex: 1;
  }
}
