/* Taki — green felt table, colorful cards. Phone-first. */

:root {
  --taki-red: #e11d2e;
  --taki-yellow: #fbbf24;
  --taki-green: #16a34a;
  --taki-blue: #1d4ed8;
  --felt: #14532d;
}

.page-taki {
  background:
    radial-gradient(circle at 50% 35%, #1f7a44 0%, var(--felt) 60%, #0b2e19 100%);
  min-height: 100dvh;
}

.taki-logo {
  margin: 0;
  font-family: 'Arial Black', var(--font);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(3rem, 14vw, 5rem);
  letter-spacing: -2px;
  direction: ltr;
  background: linear-gradient(90deg, var(--taki-red), var(--taki-yellow), var(--taki-green), var(--taki-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.35));
}
.name-input { letter-spacing: normal; font-size: 1.6rem; direction: rtl; }
.taki-lobby-players { text-align: right; font-size: 1.2rem; font-weight: 700; min-width: 200px; margin: 0; }
.taki-lobby-players li { padding: 4px 0; }

/* ---------- game layout ---------- */

.taki-game {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  max-width: 900px;
  margin: 0 auto;
}

.taki-players { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.taki-player {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid transparent;
}
.taki-player.me { background: rgba(255, 255, 255, 0.15); }
.taki-player.current { border-color: var(--taki-yellow); box-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
.taki-player-count { color: #d1fae5; font-weight: 600; }
.taki-direction { font-size: 1.2rem; }

.taki-table {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 190px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
}
.taki-deck, .taki-pile {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.taki-deck { position: absolute; top: 12px; right: 12px; display: grid; justify-items: center; gap: 4px; }
.taki-deck small { font-size: 0.7rem; color: #bbf7d0; }
.taki-deck:disabled { cursor: default; opacity: 0.75; }
body.my-turn .taki-deck:not(:disabled) .taki-card { animation: nudge 2s ease-in-out infinite; }
.taki-pile { border-radius: 16px; transition: box-shadow 0.2s; }
.taki-pile.ready { box-shadow: 0 0 0 4px var(--taki-yellow), 0 0 24px rgba(251, 191, 36, 0.7); }
.taki-status { position: absolute; bottom: 10px; left: 12px; display: grid; gap: 6px; justify-items: start; }
.active-color {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}
.pending-badge {
  font-size: 1.3rem;
  font-weight: 900;
  padding: 2px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--taki-red);
  animation: nudge 1s ease-in-out infinite;
}

.taki-status-line { margin: 0; text-align: center; font-weight: 800; font-size: 1.05rem; }
.taki-status-line.mine { color: var(--taki-yellow); }
.taki-last { margin: 0; text-align: center; font-size: 0.85rem; min-height: 1.2em; }
.taki-actions { display: flex; justify-content: center; }
.taki-actions .btn { min-width: 180px; }
.taki-actions .btn:disabled { opacity: 0.4; }

/* Your hand: small cards side by side, wraps into rows; tap to pick, drag to reorder */
.taki-hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  min-height: 110px;
}
.taki-hand .taki-card { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.taki-hand .taki-card.selected { transform: translateY(-12px); box-shadow: 0 0 0 3px var(--taki-yellow), 0 10px 18px rgba(0, 0, 0, 0.45); }
.taki-hand .taki-card.dragging { z-index: 10; opacity: 0.9; cursor: grabbing; transition: none; }

/* ---------- cards ---------- */

.taki-card {
  position: relative;
  width: 58px;
  height: 86px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  overflow: hidden;
  direction: ltr;
}
.taki-card.big { width: 116px; height: 172px; border-radius: 16px; border-width: 5px; }
.taki-card .symbol {
  font-family: 'Arial Black', var(--font);
  font-weight: 900;
  font-size: 1.9rem;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  z-index: 1;
}
.taki-card.big .symbol { font-size: 3.8rem; }
.taki-card .corner { position: absolute; top: 3px; left: 5px; font-size: 0.6rem; font-weight: 900; z-index: 1; }
.taki-card.big .corner { font-size: 1rem; top: 6px; left: 9px; }
.taki-card .label {
  position: absolute;
  bottom: 3px;
  font-size: 0.5rem;
  font-weight: 800;
  direction: rtl;
  z-index: 1;
  white-space: nowrap;
}
.taki-card.big .label { font-size: 0.85rem; bottom: 8px; }
.taki-card::before {
  /* the white oval in the middle, like printed cards */
  content: '';
  position: absolute;
  inset: 18% 12%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(-20deg);
}
.taki-card.value-taki .symbol, .taki-card.value-super .symbol { font-size: 0.95rem; font-style: italic; }
.taki-card.big.value-taki .symbol, .taki-card.big.value-super .symbol { font-size: 1.9rem; }
.taki-card.value-stop .symbol, .taki-card.value-direction .symbol { font-family: var(--font); }

.color-red { background: var(--taki-red); }
.color-yellow { background: var(--taki-yellow); }
.color-green { background: var(--taki-green); }
.color-blue { background: var(--taki-blue); }
.taki-card.color-yellow { color: #422006; }
.color-wild { background: conic-gradient(var(--taki-red) 0 25%, var(--taki-yellow) 0 50%, var(--taki-green) 0 75%, var(--taki-blue) 0); }
.taki-card.value-super { background: #111; }
.taki-card.value-super .symbol {
  background: linear-gradient(90deg, var(--taki-red), var(--taki-yellow), var(--taki-green), var(--taki-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.taki-back {
  background: repeating-linear-gradient(45deg, #111 0 8px, #1f2937 8px 16px);
  border-color: #f8fafc;
}
.taki-back span {
  font-family: 'Arial Black', var(--font);
  font-weight: 900;
  font-style: italic;
  font-size: 0.8rem;
  background: linear-gradient(90deg, var(--taki-red), var(--taki-yellow), var(--taki-green), var(--taki-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  z-index: 1;
}
.taki-back::before { display: none; }

/* color picker */
.color-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.color-choice {
  font: inherit;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 14px;
  padding: 18px 10px;
  cursor: pointer;
}
.color-choice.color-yellow { color: #422006; }

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (min-width: 700px) {
  .taki-card { width: 70px; height: 104px; }
  .taki-card .symbol { font-size: 2.3rem; }
  .taki-card.big { width: 140px; height: 208px; }
  .taki-table { min-height: 240px; }
}
.taki-card.value-super .symbol { font-size: 0.72rem; }
.taki-card.big.value-super .symbol { font-size: 1.6rem; }
.taki-card.value-plus2 .label, .taki-card.value-plus .label { display: none; }

/* ---------- +3 / three-breaker ---------- */
.taki-card.value-plus3 { background: #111; }
.taki-card.value-plus3 .symbol { color: #f97316; }
.taki-card.value-breaker { background: linear-gradient(135deg, #111 0 50%, #374151 50%); }
.taki-card.value-breaker .symbol { color: #38bdf8; font-size: 1.5rem; }
.taki-card.big.value-breaker .symbol { font-size: 3rem; }
.plus3-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  font-weight: 800;
  text-align: center;
}
.plus3-bar.urgent { background: #b91c1c; animation: nudge 1s ease-in-out infinite; }
.plus3-bar .btn { background: #fff; color: #7f1d1d; }

/* ---------- a card you can't play right now shakes ---------- */
.taki-card.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { translate: 0; }
  25% { translate: -6px; }
  75% { translate: 6px; }
}

/* ---------- Super Taki → Taki in the current color (flip) ---------- */
.taki-card.from-super::after {
  content: '';
  position: absolute;
  inset: 0;
  background: conic-gradient(var(--taki-red) 0 25%, var(--taki-yellow) 0 50%, var(--taki-green) 0 75%, var(--taki-blue) 0);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}
.taki-card.from-super.morph { animation: super-flip 1.1s ease both; }
.taki-card.from-super.morph::after { animation: super-rainbow 1.1s ease both; }
@keyframes super-flip {
  0% { transform: rotateY(0) scale(1.05); }
  45% { transform: rotateY(90deg) scale(1.1); }
  55% { transform: rotateY(90deg) scale(1.1); }
  100% { transform: rotateY(0) scale(1); }
}
@keyframes super-rainbow {
  0%, 45% { opacity: 1; }
  55%, 100% { opacity: 0; }
}
/* the +3 banner glows instead of bouncing, so its button stays easy to tap */
.plus3-bar.urgent { animation: urgent-glow 1.2s ease-in-out infinite; }
@keyframes urgent-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.0); }
  50% { box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.6), 0 0 24px rgba(248, 113, 113, 0.7); }
}
