/* Clock Solitaire — Playnesta original (MIT). Clock face, hour piles, cards. */
:root {
  --pn-vh: 1vh;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: radial-gradient(circle at 50% 12%, #22344f, #0f1a2b 78%);
  color: #eef3fb;
  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;
  height: 100vh;
  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;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  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: 8px;
  flex-wrap: wrap;
}
.hud {
  font-size: 13px;
  opacity: 0.95;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}
.hud b {
  color: #ffd166;
}
.clockwrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.clock {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.07), transparent 55%),
    conic-gradient(from -90deg, #243756, #1a2a44, #243756, #1a2a44, #243756, #1a2a44, #243756, #1a2a44, #243756, #1a2a44, #243756, #1a2a44, #243756);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.1), inset 0 16px 40px rgba(0, 0, 0, 0.35);
}
.pile {
  position: absolute;
  width: 15%;
  padding-top: 15%;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  cursor: default;
}
.pile .tag {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(12px, 3.4vw, 18px);
  font-weight: 800;
  color: #93a7c9;
  pointer-events: none;
}
.pile .back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: repeating-linear-gradient(45deg, #33415e 0 5px, #2b3853 5px 10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
  transition: opacity 200ms, transform 200ms;
}
.pile .back::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
}
.pile.empty .back {
  opacity: 0.22;
  transform: scale(0.88);
}
.pile .count {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #9fb3d9;
  pointer-events: none;
}
.pile.hit .back {
  animation: pop 240ms ease-out;
}
@keyframes pop {
  0% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.9); }
  100% { box-shadow: 0 0 0 14px rgba(255, 209, 102, 0); }
}
.msg {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  min-height: 22px;
}
.nowslot {
  display: flex;
  justify-content: center;
  min-height: 96px;
}
.card {
  width: 72px;
  height: 96px;
  border-radius: 10px;
  background: linear-gradient(160deg, #fdfdf7, #eceada);
  color: #1d2433;
  border: 1px solid #c9c6b4;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease-out;
}
.card:active {
  transform: scale(0.96);
}
.card .rank {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.card .suit {
  font-size: 24px;
  line-height: 1;
}
.card.red {
  color: #c0392b;
}
.card.king {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(255, 209, 102, 0.75);
}
.hidden {
  display: none !important;
}
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #5b7bb0;
  background: #24406b;
  color: #eef3fb;
  cursor: pointer;
}
.btn.primary {
  background: #ffd166;
  color: #3a2c05;
  border-color: #ffe7a8;
}
.btn.on {
  background: #4d7cc1;
  border-color: #9dc0f0;
}
.btn:active {
  transform: scale(0.97);
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 22, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay.hidden {
  display: none;
}
.panel {
  background: #16233a;
  border: 1px solid #5b7bb0;
  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;
}
.rules-list b {
  color: #ffd166;
}
@media (max-height: 560px) {
  .nowslot {
    min-height: 72px;
  }
  .card {
    width: 56px;
    height: 76px;
  }
  .card .rank {
    font-size: 22px;
  }
  .card .suit {
    font-size: 18px;
  }
}
