/* ================= کارت رنگارنگ ================= */

.card.rc {
  color: #fff;
  border: calc(var(--cw) * 0.05) solid #fff;
  background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--cc) 70%, #fff) 0%, var(--cc) 45%, color-mix(in srgb, var(--cc) 72%, #000) 100%);
  direction: rtl;
}

.card.rc.wild {
  background: radial-gradient(circle at 30% 22%, #574a8c 0%, #2c2552 55%, #1a1533 100%);
}

.rc-shape {
  position: absolute;
  inset: 14%;
  opacity: 0.2;
}

.rc-shape svg,
.color-dot svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #fff;
}

.rc-center,
.rc-corner {
  direction: ltr;
  unicode-bidi: isolate;
}

.rc-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.62);
  line-height: 1;
  text-shadow: 0 calc(var(--cw) * 0.03) 0 rgba(0, 0, 0, 0.35), 0 0 calc(var(--cw) * 0.1) rgba(0, 0, 0, 0.25);
}

.card.rc.act .rc-center {
  font-size: calc(var(--cw) * 0.46);
  padding-bottom: 14%;
}

.card.rc.v-draw2 .rc-center {
  font-size: calc(var(--cw) * 0.5);
}

.rc-wheel {
  position: absolute;
  inset: 0 0 14%;
  display: grid;
  place-items: center;
}

.rc-wheel svg {
  width: 64%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.rc-corner {
  position: absolute;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.19);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.rc-corner.tl {
  top: 6%;
  right: 9%;
}

.rc-corner.br {
  bottom: 6%;
  left: 9%;
  transform: rotate(180deg);
}

.rc-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13%;
  text-align: center;
  font-weight: 900;
  font-size: calc(var(--cw) * 0.15);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.color-dot {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  background: var(--cc);
}

.color-dot svg {
  width: 62% !important;
  height: 62% !important;
  margin: 19%;
}

/* ================= تلویزیون ================= */

.rr-screen {
  position: absolute;
  inset: 0;
}

.rr-felt {
  position: absolute;
  left: 320px;
  top: 290px;
  width: 1280px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, #2e9a62 0%, #1c7748 55%, #115232 100%);
  box-shadow: 0 0 0 18px #4a2d17, 0 0 0 24px #2c1a0d, 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(0, 0, 0, 0.45);
}

.rr-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rr-ring path {
  fill: none;
  stroke: rgba(255, 209, 102, 0.35);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 2 34;
  animation: rr-flow 1.2s linear infinite;
}

.rr-ring.ccw path {
  animation-direction: reverse;
}

@keyframes rr-flow {
  to {
    stroke-dashoffset: -36;
  }
}

.rr-draw,
.rr-discard {
  position: absolute;
  width: 0;
  height: 0;
}

.rr-screen .card.pile {
  --cw: 140px;
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.rr-draw .card.pile {
  left: -70px;
  top: -100px;
}

.rr-discard .card.pile.top {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.rr-discard .card.arriving {
  opacity: 0;
}

.rr-draw-count {
  position: absolute;
  top: 116px;
  left: -100px;
  width: 200px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.rr-pending {
  position: absolute;
  left: -70px;
  top: -150px;
  width: 140px;
  text-align: center;
  font-size: 54px;
  font-weight: 900;
  color: #fff;
  background: var(--danger);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(255, 77, 94, 0.6);
  animation: rr-pulse 0.9s ease-in-out infinite;
  z-index: 5;
}

@keyframes rr-pulse {
  50% {
    transform: scale(1.1);
  }
}

.rr-color {
  position: absolute;
  left: 1270px;
  top: 480px;
  transform: translate(-50%, -50%);
  width: 150px;
  padding: 18px 0 12px;
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.rr-color .color-dot {
  width: 84px;
  height: 84px;
  border: 5px solid #fff;
}

.rr-color.changed {
  background: rgba(255, 209, 102, 0.25);
  outline: 4px solid var(--gold);
  animation: rr-pulse 1.4s ease-in-out infinite;
}

.rr-turn {
  position: absolute;
  left: 50%;
  top: 638px;
  transform: translateX(-50%);
  text-align: center;
  width: 900px;
}

.rr-turn-name {
  font-size: 40px;
  font-weight: 800;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.rr-turn-hint {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.8);
}

.rr-ticker {
  position: absolute;
  left: 50%;
  top: 728px;
  transform: translateX(-50%);
  width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.6);
}

.rr-ticker div:last-child {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 700;
}

/* صندلی بازیکن‌ها */

.rr-seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.3s;
}

.rr-seat.turn {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 3;
}

.rr-seat.offline,
.rr-seat.done {
  opacity: 0.5;
}

.rr-turn-tag {
  position: absolute;
  top: -30px;
  font-size: 20px;
  font-weight: 800;
  background: var(--gold);
  color: #2b2000;
  padding: 0 14px;
  border-radius: 999px;
}

.rr-av {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 54px;
  background: color-mix(in srgb, var(--c) 30%, #1d1a3d);
  border: 5px solid var(--c);
}

.rr-seat.turn .rr-av {
  box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.5), 0 0 40px rgba(255, 209, 102, 0.7);
}

.rr-timer {
  position: absolute;
  inset: -14px;
  display: none;
}

.rr-screen.has-timer .rr-seat.turn .rr-timer {
  display: block;
}

.rr-timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.rr-timer circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-dasharray: 100;
  stroke-linecap: round;
}

.rr-seat.hurry .rr-timer circle {
  stroke: var(--danger);
}

.rr-name {
  font-size: 26px;
  font-weight: 800;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.rr-count {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rr-count b {
  font-size: 28px;
  min-width: 44px;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  padding: 0 10px;
}

.rr-mini {
  display: flex;
  direction: ltr;
}

.card.back.mini {
  --cw: 24px;
  border-width: 2px;
}

.card.back.mini .back-inner {
  display: none;
}

.rr-mini .card + .card {
  margin-left: -15px;
}

.rr-flag {
  font-size: 20px;
  font-weight: 800;
  padding: 2px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.rr-flag.gold {
  background: var(--gold);
  color: #2b2000;
}

.rr-flag.danger {
  background: var(--danger);
  animation: rr-pulse 0.8s infinite;
}

.rr-flag.muted {
  color: var(--muted);
}

/* انیمیشن‌ها و اعلان بزرگ */

.rr-fly {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.rr-fly .flying {
  position: absolute;
  left: 0;
  top: 0;
  transition: transform 0.52s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.rr-big {
  position: absolute;
  left: 50%;
  top: 250px;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: none;
}

.rr-big-msg {
  display: flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
  font-size: 52px;
  font-weight: 900;
  padding: 18px 44px;
  border-radius: 999px;
  background: rgba(20, 18, 43, 0.92);
  border: 4px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: rr-big-in 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  transition: opacity 0.25s, transform 0.25s;
}

.rr-big-msg .color-dot {
  width: 60px;
  height: 60px;
  border: 4px solid #fff;
}

.rr-big-msg.danger {
  border-color: var(--danger);
  background: rgba(120, 15, 30, 0.92);
}

.rr-big-msg.warn {
  border-color: var(--warn);
}

.rr-big-msg.gold {
  border-color: var(--gold);
  color: var(--gold);
}

.rr-big-msg.out {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
}

@keyframes rr-big-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}

.rr-footer {
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 14px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 19px;
  color: var(--muted);
}

.rr-footer b {
  color: var(--text);
}

.rr-footer i {
  font-style: normal;
  font-weight: 800;
  color: var(--gold);
}

/* نتیجه دور */

.rr-result {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(10, 8, 25, 0.82);
  display: grid;
  place-items: center;
  animation: toast-in 0.4s ease;
}

.rr-res-panel {
  position: relative;
  width: 1500px;
  max-height: 960px;
  overflow: hidden;
  padding: 40px 50px;
  border-radius: 40px;
  background: linear-gradient(180deg, #2c2665, #1d1a3d);
  border: 2px solid var(--line);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}

.rr-res-title {
  font-size: 58px;
  font-weight: 900;
  text-align: center;
}

.rr-res-sub {
  font-size: 32px;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
  margin-top: 6px;
}

.rr-res-head,
.rr-res-row {
  display: grid;
  grid-template-columns: 70px 80px 260px 1fr 190px 90px 130px;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
}

.rr-res-head {
  margin-top: 26px;
  font-size: 20px;
  color: var(--muted);
}

.rr-res-row {
  font-size: 30px;
  font-weight: 700;
  border-radius: 20px;
}

.rr-res-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.05);
}

.rr-res-row.loser {
  background: rgba(255, 77, 94, 0.18);
}

.rr-res-medal {
  font-size: 40px;
  text-align: center;
}

.rr-res-av {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 38px;
  border: 4px solid var(--c);
}

.rr-res-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-res-hand {
  display: flex;
  direction: ltr;
  justify-content: flex-end;
}

.card.tiny {
  --cw: 40px;
}

.rr-res-hand .card + .card {
  margin-left: -16px;
}

.rr-res-num {
  text-align: center;
}

.rr-res-foot {
  margin-top: 24px;
  text-align: center;
  font-size: 28px;
  color: var(--gold);
  font-weight: 700;
}

.rr-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.rr-confetti i {
  position: absolute;
  top: -40px;
  left: calc(var(--i) * 2.5%);
  width: 16px;
  height: 26px;
  border-radius: 4px;
  background: hsl(calc(var(--i) * 47), 90%, 62%);
  animation: rr-fall calc(2.5s + (var(--i) * 0.07s)) linear calc(var(--i) * -0.13s) infinite;
}

@keyframes rr-fall {
  to {
    transform: translateY(1150px) rotate(720deg);
  }
}

/* ================= گوشی ================= */

.rr-play {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.rr-status {
  margin: 0 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
  font-weight: 800;
  font-size: 17px;
  position: relative;
  overflow: hidden;
}

.rr-status.mine {
  background: linear-gradient(120deg, #ff5d8f, #ffb347);
  color: #1a0f00;
  animation: rr-glow 1.4s ease-in-out infinite;
}

.rr-status.danger {
  background: var(--danger);
  color: #fff;
}

.rr-status small {
  display: block;
  font-weight: 600;
  font-size: 13px;
  opacity: 0.85;
}

.rr-status .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.35);
  transition: width 0.25s linear;
}

@keyframes rr-glow {
  50% {
    box-shadow: 0 0 22px rgba(255, 179, 71, 0.6);
  }
}

.rr-tablerow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 12px 4px;
}

.rr-tablerow .card {
  --cw: 62px;
}

.rr-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
  min-width: 60px;
}

.rr-chip .color-dot {
  width: 36px;
  height: 36px;
  border: 3px solid #fff;
}

.rr-chip b {
  font-size: 20px;
  color: var(--text);
}

.rr-chip.alert b {
  color: var(--danger);
}

.rr-chip.changed .color-dot {
  outline: 3px solid var(--gold);
}

.rr-opps {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  scrollbar-width: none;
}

.rr-opps::-webkit-scrollbar {
  display: none;
}

.rr-opp {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  border: 2px solid transparent;
}

.rr-opp.turn {
  border-color: var(--gold);
}

.rr-opp.one b {
  color: var(--danger);
}

.rr-opp.done {
  opacity: 0.5;
}

.rr-opp span {
  font-size: 18px;
}

.rr-hand {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 8px;
  direction: ltr;
}

.rr-hand .card {
  --cw: min(76px, calc((100vw - 64px) / 5));
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.rr-hand.myturn .card:not(.playable) {
  opacity: 0.4;
}

.rr-hand.myturn .card.playable {
  box-shadow: 0 0 0 3px var(--good), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rr-hand .card.selected {
  transform: translateY(-10px) scale(1.06);
  box-shadow: 0 0 0 4px var(--gold), 0 10px 20px rgba(0, 0, 0, 0.5) !important;
  opacity: 1 !important;
}

.rr-hand .card.new {
  animation: rr-new 1.4s ease 2;
}

@keyframes rr-new {
  50% {
    box-shadow: 0 0 0 4px #8ce99a, 0 0 22px #8ce99a;
  }
}

.rr-hand .card.shake {
  animation: rr-shake 0.35s;
}

@keyframes rr-shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.rr-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  direction: rtl;
}

.rr-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}

.rr-actions:empty {
  display: none;
}

.btn {
  flex: 1;
  min-height: 54px;
  padding: 0 14px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 17px;
  background: var(--panel2);
}

.btn.primary {
  background: var(--brand);
  color: #1a0f00;
}

.btn.good {
  background: var(--good);
  color: #062b1b;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.call {
  background: var(--gold);
  color: #2b2000;
  flex: 0 0 auto;
  font-size: 20px;
  animation: rr-pulse 0.8s infinite;
}

.btn:disabled {
  background: var(--panel);
  color: var(--muted);
}

/* برگه‌های پایین (انتخاب خال، هدیه، داوری) */

.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 4, 15, 0.7);
  display: flex;
  align-items: flex-end;
  animation: toast-in 0.2s ease;
}

.sheet {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet h3 {
  margin: 0;
  font-size: 20px;
  text-align: center;
}

.sheet p {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 18px;
  background: var(--cc);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2);
}

.color-btn .color-dot {
  width: 54px;
  height: 54px;
  border: 4px solid #fff;
}

.color-btn small {
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
}

.pick-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  direction: ltr;
}

.pick-cards .card {
  --cw: 58px;
}

.pick-cards .card.selected {
  box-shadow: 0 0 0 4px var(--gold);
  transform: translateY(-4px);
}

.pick-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.pick-player {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 2px solid transparent;
  font-weight: 700;
}

.pick-player.selected {
  border-color: var(--gold);
  background: var(--panel2);
}

.pick-player small {
  color: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 30px;
  font-weight: 900;
}

.stepper button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--panel2);
  font-size: 26px;
}

.sheet-row {
  display: flex;
  gap: 8px;
}

/* نتیجه روی گوشی */

.rr-res-phone {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rr-res-phone .title {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  padding: 8px 0;
}

.rr-rp {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel);
  font-weight: 700;
}

.rr-rp.mine {
  outline: 2px solid var(--gold);
}

.rr-rp .grow {
  flex: 1;
}

.rr-rp small {
  color: var(--muted);
  font-weight: 600;
}

/* حباب کرکری روی تلویزیون */

.rr-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
}

.rr-bubble {
  position: absolute;
  max-width: 520px;
  width: max-content;
  padding: 14px 24px 16px;
  border-radius: 28px;
  background: #fff;
  color: #1d1b2e;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  border: 4px solid var(--c);
  animation: rr-bubble-in 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
  transition: opacity 0.35s, transform 0.35s;
}

.rr-bubble.above {
  transform: translate(-50%, -100%);
}

.rr-bubble.below {
  transform: translate(-50%, 0);
}

.rr-bubble::after {
  content: '';
  position: absolute;
  left: calc(50% + var(--tail) - 14px);
  width: 28px;
  height: 28px;
  background: #fff;
  border: 4px solid var(--c);
  transform: rotate(45deg);
}

.rr-bubble.above::after {
  bottom: -17px;
  border-top: 0;
  border-left: 0;
}

.rr-bubble.below::after {
  top: -17px;
  border-bottom: 0;
  border-right: 0;
}

.rr-bubble-who {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #6b668f;
}

.rr-bubble-who b {
  color: var(--c);
  filter: brightness(0.8);
  font-size: 24px;
  font-weight: 900;
}

.rr-bubble-text {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.5;
}

.rr-bubble.side-r {
  transform: translate(0, -50%);
}

.rr-bubble.side-l {
  transform: translate(-100%, -50%);
}

.rr-bubble.side-r::after,
.rr-bubble.side-l::after {
  left: auto;
  top: calc(50% - 14px);
}

.rr-bubble.side-r::after {
  left: -17px;
  border-top: 0;
  border-right: 0;
}

.rr-bubble.side-l::after {
  right: -17px;
  border-bottom: 0;
  border-left: 0;
}

.rr-bubble.out {
  opacity: 0;
}

@keyframes rr-bubble-in {
  from {
    opacity: 0;
    scale: 0.4;
  }
}
