/* Cribbage 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;
}
.scoreboard {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.chip {
  background: #0b2018;
  border: 1px solid #2b5a48;
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.chip b {
  font-size: 15px;
}
.chip.me {
  border-color: #e3b341;
}

/* the 121 track */
.board {
  background: linear-gradient(#14503c, #0f3f30);
  border: 1px solid #1e4d3d;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.track {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.track .name {
  width: 72px;
  opacity: 0.85;
  white-space: nowrap;
}
.rail {
  position: relative;
  flex: 1;
  height: 14px;
  background: #0b2018;
  border-radius: 7px;
  overflow: hidden;
}
.rail .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 7px;
  background: #2b5a48;
}
.rail .skunk {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 75.2%;
  width: 2px;
  background: #e3b341;
  opacity: 0.75;
}
.rail .peg {
  position: absolute;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f2ede3;
  border: 2px solid #0b2018;
  transform: translateX(-5px);
}
.rail .peg.me {
  background: #e3b341;
}
.rail .peg.win {
  background: #7de08a;
}

/* table */
.table {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #10362a;
  border: 1px solid #1e4d3d;
  border-radius: 10px;
  padding: 8px 12px;
}
.opp .who {
  font-weight: 700;
  font-size: 13px;
}
.opp .count {
  margin-left: 8px;
  font-size: 12px;
  opacity: 0.8;
}
.opp-row.active {
  border-color: #e3b341;
}
.opp-cards {
  margin-left: auto;
  display: flex;
  gap: 3px;
}
.back {
  width: 22px;
  height: 31px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, #1e4d3d 0 4px, #16402f 4px 8px);
  border: 1px solid #2b5a48;
}
.opp-cards .back.used {
  opacity: 0.25;
}

.felt {
  background: radial-gradient(ellipse at 50% 30%, #155a42, #0e3d2e);
  border: 1px solid #1e4d3d;
  border-radius: 10px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 150px;
}
.count-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.count-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.65;
}
#count {
  font-size: 40px;
  font-variant-numeric: tabular-nums;
}
#count.at31 {
  color: #7de08a;
}
.laid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 52px;
  align-items: center;
}
.laid .mini {
  position: relative;
}
.laid .mini.mine::after {
  content: "you";
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #e3b341;
  opacity: 0.9;
}
.laid .mini.opp::after {
  content: "opp";
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  opacity: 0.6;
}
.callout {
  min-height: 18px;
  font-size: 13px;
  font-weight: 600;
  color: #e3b341;
  text-align: center;
}
.msg {
  font-size: 13px;
  text-align: center;
  opacity: 0.92;
  min-height: 18px;
}
.msg.warn {
  color: #ff9d6b;
}

/* cards */
.card,
.mini {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: #fdfaf3;
  color: #1c1b18;
  line-height: 1;
}
.card {
  width: 56px;
  height: 80px;
  border: 1px solid #cfc7b4;
  border-bottom-width: 3px;
  font-size: 20px;
  gap: 2px;
  cursor: pointer;
  padding: 0;
}
.card .s {
  font-size: 22px;
}
.card.red {
  color: #b03030;
}
.card.black {
  color: #1c1b18;
}
.card {
  position: relative;
}
.card .pip {
  position: absolute;
  bottom: 4px;
  font-size: 9px;
  opacity: 0.6;
}
.card.dim {
  opacity: 0.35;
  cursor: default;
}
.card.sel {
  outline: 3px solid #e3b341;
  outline-offset: 1px;
  transform: translateY(-6px);
}
.card.hinted {
  outline: 3px dashed #7de08a;
  outline-offset: 1px;
}
.mini {
  width: 42px;
  height: 52px;
  font-size: 15px;
  border: 1px solid #cfc7b4;
}
.mini .s {
  font-size: 17px;
}
.mini.red {
  color: #b03030;
}
.mini.starter {
  outline: 2px solid #e3b341;
}

/* hand + controls */
.hand-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hand {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 86px;
  padding: 6px 2px 2px;
}
.hand.nudge {
  animation: nudge 0.3s;
}
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
}
.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid #2b5a48;
  background: #10362a;
  color: #f2ede3;
  font-size: 14px;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn.primary {
  background: #e3b341;
  border-color: #e3b341;
  color: #221a06;
  font-weight: 700;
}

/* 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 #2b5a48;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}
.panel-wide {
  max-width: 560px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
#overlay-body {
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.show-entry {
  background: #0b2018;
  border: 1px solid #1e4d3d;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.show-entry b {
  display: block;
  margin-bottom: 2px;
}
.show-entry .items {
  opacity: 0.85;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.show-entry .items span {
  background: #10362a;
  border-radius: 5px;
  padding: 1px 6px;
}
.show-entry .pts {
  color: #e3b341;
  font-weight: 700;
  float: right;
}
.rules-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
}
.panel .btn {
  margin-top: 10px;
  width: 100%;
}

@media (max-width: 420px) {
  .card {
    width: 46px;
    height: 68px;
    font-size: 16px;
  }
  .card .s {
    font-size: 18px;
  }
  .mini {
    width: 34px;
    height: 44px;
    font-size: 13px;
  }
  .track .name {
    width: 60px;
  }
  .meta {
    font-size: 11px;
  }
}
