/* =========================================================
   ACID UNO — EDITABLE DESIGN TOKENS

   Start here when changing the look. Layout rules live at
   the bottom of this file and in v9.1.css; game rules live
   in game.js. Card ratio is always 2:3.
   ========================================================= */

:root {
  --bg: #06030d;
  --bg2: #0c0619;

  --purple: #8b3dff;
  --magenta: #ff2bd6;
  --cyan: #20eaff;
  --acid: #b7ff24;
  --orange: #ff7a18;

  --red: #ff3158;
  --yellow: #ffe83d;
  --green: #48ff77;
  --blue: #32a8ff;

  --white: #f8f7ff;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --card-w: 84px;
  --card-h: 126px;

  --table-max-w: 940px;
  --table-max-h: 520px;
  --panel-line: rgba(183, 255, 36, .24);
  --panel-line-purple: rgba(186, 73, 255, .42);
  --ui-cut: 14px;
}


/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;

  /*
    100vh в Safari на айфоне — это высота страницы с убранными
    панелями браузера. Нижняя панель поверх неё не сжимает
    экран, а накрывает его: у стола срезало низ руки, у правил —
    кнопку «понятно». dvh считает по тому, что видно сейчас.
  */
  height: 100%;
  height: 100dvh;

  overflow: hidden;
  background: #05020b;
}

body {
  position: fixed;
  inset: 0;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Arial Black",
    Arial,
    sans-serif;

  color: var(--white);

  touch-action: none;

  user-select: none;
  -webkit-user-select: none;

  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
}


/* =========================================================
   GAME
   ========================================================= */

#game {
  position: fixed;
  inset: 0;

  overflow: hidden;

  isolation: isolate;

  background:
    radial-gradient(
      circle at 50% 43%,
      rgba(122, 40, 255, .24),
      transparent 30%
    ),
    radial-gradient(
      circle at 18% 30%,
      rgba(0, 238, 255, .11),
      transparent 32%
    ),
    radial-gradient(
      circle at 85% 67%,
      rgba(255, 24, 205, .13),
      transparent 34%
    ),
    linear-gradient(
      180deg,
      #070a0d 0%,
      #040309 46%,
      #09030f 100%
    );
}

#game::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 1;
  pointer-events: none;
  opacity: .72;
  clip-path: polygon(0 var(--ui-cut), var(--ui-cut) 0, calc(100% - var(--ui-cut)) 0, 100% var(--ui-cut), 100% calc(100% - var(--ui-cut)), calc(100% - var(--ui-cut)) 100%, var(--ui-cut) 100%, 0 calc(100% - var(--ui-cut)));
  border: 1px solid var(--panel-line-purple);
  box-shadow: inset 0 0 28px rgba(114, 34, 189, .08);
}


/* =========================================================
   AMBIENT LIGHTS
   ========================================================= */

.ambient {
  position: absolute;

  width: 330px;
  height: 330px;

  border-radius: 50%;

  filter: blur(80px);

  pointer-events: none;

  opacity: .3;

  z-index: -1;
}

.ambientPurple {
  left: -160px;
  top: 27%;

  background: #8b2cff;
}

.ambientGreen {
  right: -180px;
  bottom: 5%;

  background: #30ffbb;

  opacity: .17;
}

.noise {
  position: absolute;
  inset: 0;

  pointer-events: none;

  opacity: .06;

  z-index: 100;

  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,.09) 0,
      rgba(255,255,255,.09) 1px,
      transparent 1px,
      transparent 3px
    );

  mix-blend-mode: overlay;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
  position: absolute;

  top: calc(var(--safe-top) + 7px);
  left: 13px;
  right: 13px;

  height: 48px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  z-index: 40;
}

.logo {
  display: flex;
  align-items: baseline;

  gap: 5px;

  transform: skew(-5deg);
}

.logoAcid {
  font-size: 21px;
  font-weight: 1000;

  letter-spacing: -1px;

  color: var(--acid);

  text-shadow:
    0 0 5px rgba(183,255,36,.95),
    0 0 15px rgba(183,255,36,.65),
    0 0 30px rgba(183,255,36,.28);
}

.logoUno {
  font-size: 21px;
  font-weight: 1000;

  letter-spacing: -1px;

  color: #fff;

  text-shadow:
    0 0 7px #fff,
    0 0 18px var(--magenta);
}

.iconButton {
  width: 39px;
  height: 39px;

  border-radius: 12px;

  border:
    1px solid rgba(255,255,255,.17);

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.1),
      rgba(255,255,255,.025)
    );

  box-shadow:
    inset 0 0 13px rgba(255,255,255,.04),
    0 0 18px rgba(155,48,255,.16);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  font-size: 20px;

  display: grid;
  place-items: center;
}

.penalty {
  position: absolute;

  left: 50%;
  transform: translateX(-50%);

  padding: 7px 15px;

  border-radius: 999px;

  font-size: 12px;
  font-weight: 1000;

  letter-spacing: 1px;

  color: #fff;

  background:
    linear-gradient(
      90deg,
      #ff174f,
      #ff2ec8
    );

  border:
    1px solid rgba(255,255,255,.5);

  box-shadow:
    0 0 12px rgba(255,30,100,.85),
    0 0 30px rgba(255,30,200,.38);
}


/* =========================================================
   PLAYER ZONES
   ========================================================= */

.playerZone {
  position: absolute;

  left: 0;
  right: 0;

  pointer-events: none;
}

.botZone {
  top: calc(var(--safe-top) + 58px);

  height: 103px;

  z-index: 12;
}

.playerZoneBottom {
  bottom: calc(var(--safe-bottom) + 0px);

  height: 206px;

  z-index: 30;
}


/* =========================================================
   TURN GLOW
   ========================================================= */

.turnGlow {
  position: absolute;

  left: 50%;

  width: 75%;
  height: 74px;

  transform: translateX(-50%);

  border-radius: 50%;

  opacity: 0;

  filter: blur(24px);

  background:
    radial-gradient(
      ellipse,
      rgba(39,235,255,.5),
      rgba(130,45,255,.2) 45%,
      transparent 72%
    );

  transition:
    opacity .55s ease;
}

.botZone .turnGlow {
  top: -17px;
}

.playerZoneBottom .turnGlow {
  bottom: -23px;

  background:
    radial-gradient(
      ellipse,
      rgba(183,255,36,.42),
      rgba(255,37,213,.18) 45%,
      transparent 72%
    );
}

.turnGlow.active {
  opacity: 1;
}


/* =========================================================
   BOT
   ========================================================= */

.botTitle {
  position: absolute;

  left: 17px;
  top: 5px;

  display: flex;
  align-items: center;

  gap: 9px;
}

.botAvatar {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  border-radius: 12px;

  font-size: 20px;

  background:
    linear-gradient(
      145deg,
      rgba(40,235,255,.22),
      rgba(132,48,255,.25)
    );

  border:
    1px solid rgba(73,239,255,.38);

  box-shadow:
    0 0 17px rgba(29,225,255,.22),
    inset 0 0 13px rgba(255,255,255,.07);
}

.botInfo {
  display: flex;
  flex-direction: column;

  gap: 1px;
}

.botInfo strong {
  font-size: 12px;
  font-weight: 950;

  letter-spacing: 1px;

  color: #fff;

  text-shadow:
    0 0 8px rgba(38,235,255,.55);
}

#botCount {
  font-size: 9px;

  letter-spacing: 1.1px;

  color: rgba(255,255,255,.52);
}


/* =========================================================
   BOT CARDS
   ========================================================= */

.botCards {
  position: absolute;

  top: 3px;
  left: 50%;

  width: 170px;
  height: 62px;

  transform: translateX(-50%);

  display: flex;
  align-items: flex-start;
  justify-content: center;

  pointer-events: none;
}

.botCard {
  width: 36px;
  height: 54px;

  margin-left: -22px;

  border-radius: 7px;

  border:
    1px solid rgba(255,255,255,.65);

  background:
    radial-gradient(
      circle at 50% 45%,
      #e52dff 0%,
      #821aff 28%,
      #180529 70%
    );

  box-shadow:
    0 0 6px rgba(232,45,255,.8),
    0 0 15px rgba(93,42,255,.5);

  transform-origin: 50% 120%;
}

.botCard:first-child {
  margin-left: 0;
}


/* =========================================================
   TABLE
   ========================================================= */

#table {
  position: absolute;

  left: 50%;
  top: 47%;

  width:
    min(
      calc(100vw - 24px),
      500px
    );

  height:
    min(
      44vh,
      360px
    );

  min-height: 275px;

  transform:
    translate(-50%, -50%)
    perspective(850px)
    rotateX(4deg);

  z-index: 10;
}

.tableOuterGlow {
  position: absolute;

  inset: -5px;

  border-radius: 44px;

  background:
    conic-gradient(
      from 30deg,
      var(--cyan),
      var(--purple),
      var(--magenta),
      var(--acid),
      var(--cyan)
    );

  filter: blur(13px);

  opacity: .46;

  animation:
    tableGlowBreath 4s ease-in-out infinite;

  pointer-events: none;
}

.tableInner {
  position: absolute;
  inset: 0;

  overflow: hidden;

  border-radius: 40px;

  border:
    2px solid rgba(170,104,255,.78);

  background:
    radial-gradient(
      ellipse at 50% 48%,
      rgba(91,27,144,.55),
      rgba(21,7,38,.92) 53%,
      rgba(8,4,16,.98) 100%
    );

  box-shadow:
    inset 0 0 35px rgba(153,46,255,.28),
    inset 0 0 80px rgba(23,222,255,.055),
    0 0 8px rgba(187,72,255,.8),
    0 0 34px rgba(122,35,255,.4),
    0 25px 60px rgba(0,0,0,.62);

  transition:
    border-color .6s ease,
    box-shadow .6s ease,
    filter .6s ease;
}

.tableInner::before {
  content: "";

  position: absolute;
  inset: 11px;

  border-radius: 31px;

  border:
    1px solid rgba(35,233,255,.23);

  pointer-events: none;

  box-shadow:
    inset 0 0 20px rgba(28,225,255,.05);
}

.tableGrid {
  position: absolute;
  inset: 0;

  opacity: .12;

  background-image:
    linear-gradient(
      rgba(118,63,255,.6) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(37,225,255,.42) 1px,
      transparent 1px
    );

  background-size:
    27px 27px;

  transform:
    perspective(350px)
    rotateX(14deg)
    scale(1.15);

  mask-image:
    radial-gradient(
      ellipse,
      #000,
      transparent 72%
    );

  -webkit-mask-image:
    radial-gradient(
      ellipse,
      #000,
      transparent 72%
    );
}

.tableLogo {
  position: absolute;

  left: 50%;
  top: 48%;

  transform:
    translate(-50%, -50%)
    rotate(-8deg);

  font-size:
    clamp(
      58px,
      18vw,
      90px
    );

  font-weight: 1000;

  font-style: italic;

  letter-spacing: -7px;

  color: transparent;

  -webkit-text-stroke:
    1px rgba(191,80,255,.13);

  text-shadow:
    0 0 24px rgba(174,54,255,.08);

  pointer-events: none;
}


/* =========================================================
   CURRENT COLOR TABLE REACTION
   ========================================================= */

.tableInner.color-red {
  box-shadow:
    inset 0 0 50px rgba(255,39,81,.16),
    0 0 10px rgba(255,39,81,.55),
    0 0 34px rgba(150,45,255,.34),
    0 25px 60px rgba(0,0,0,.62);
}

.tableInner.color-yellow {
  box-shadow:
    inset 0 0 50px rgba(255,231,51,.13),
    0 0 10px rgba(255,226,47,.45),
    0 0 34px rgba(150,45,255,.34),
    0 25px 60px rgba(0,0,0,.62);
}

.tableInner.color-green {
  box-shadow:
    inset 0 0 50px rgba(72,255,119,.14),
    0 0 10px rgba(72,255,119,.5),
    0 0 34px rgba(150,45,255,.34),
    0 25px 60px rgba(0,0,0,.62);
}

.tableInner.color-blue {
  box-shadow:
    inset 0 0 50px rgba(50,168,255,.17),
    0 0 10px rgba(50,168,255,.55),
    0 0 34px rgba(150,45,255,.34),
    0 25px 60px rgba(0,0,0,.62);
}


/* =========================================================
   CENTER / DROP ZONE
   ========================================================= */

#center {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 230px;
  height: 175px;

  transform: translate(-50%, -50%);

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 23px;

  border-radius: 44px;

  z-index: 6;

  transition:
    background .28s ease,
    box-shadow .28s ease,
    transform .28s cubic-bezier(.2,.8,.2,1);
}

#center::before {
  content: "";

  position: absolute;

  inset: -12px;

  border-radius: 50px;

  border:
    1px dashed rgba(255,255,255,0);

  pointer-events: none;

  transition:
    border-color .25s ease,
    box-shadow .25s ease,
    background .25s ease;
}


/*
  Включается game.js во время drag.
*/

#center.drop-ready::before {
  border-color:
    rgba(40,234,255,.38);

  background:
    rgba(70,26,130,.08);

  box-shadow:
    inset 0 0 25px rgba(43,228,255,.06),
    0 0 18px rgba(150,52,255,.12);
}


/*
  Палец с картой находится над зоной.
*/

#center.drop-hover {
  transform:
    translate(-50%, -50%)
    scale(1.035);

  background:
    radial-gradient(
      circle,
      rgba(183,255,36,.11),
      rgba(31,235,255,.07) 40%,
      transparent 72%
    );

  box-shadow:
    0 0 30px rgba(38,232,255,.12);
}

#center.drop-hover::before {
  border:
    2px solid var(--acid);

  background:
    rgba(151,255,37,.035);

  box-shadow:
    0 0 8px var(--acid),
    0 0 23px rgba(183,255,36,.7),
    0 0 50px rgba(35,235,255,.28),
    inset 0 0 30px rgba(183,255,36,.08);
}


/*
  Если карту сюда положить нельзя.
*/

#center.drop-invalid::before {
  border:
    2px solid #ff3158;

  box-shadow:
    0 0 8px #ff3158,
    0 0 28px rgba(255,30,80,.65);

  background:
    rgba(255,25,70,.07);
}


/* =========================================================
   DECK
   ========================================================= */

.deckArea {
  position: relative;

  width: 86px;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 7px;

  z-index: 3;
}

#deck {
  position: relative;

  width: 79px;
  height: 117px;

  padding: 0;

  border: none;

  border-radius: 13px;

  background: transparent;

  transform: rotate(-4deg);

  touch-action: manipulation;
}

#deck::before,
#deck::after {
  content: "";

  position: absolute;

  width: 75px;
  height: 113px;

  border-radius: 12px;

  background: #16051e;

  border:
    1px solid rgba(255,255,255,.38);

  pointer-events: none;
}

#deck::before {
  left: 5px;
  top: -4px;

  transform: rotate(5deg);

  opacity: .65;
}

#deck::after {
  left: 2px;
  top: -2px;

  transform: rotate(2deg);

  opacity: .8;
}

.deckBack {
  position: absolute;
  inset: 0;

  z-index: 2;

  overflow: hidden;

  border-radius: 13px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  transform: rotate(0deg);

  border:
    2px solid rgba(255,255,255,.86);

  background:
    radial-gradient(
      ellipse at 40% 30%,
      #ff3fe1 0%,
      #8c27ff 30%,
      #26073c 70%,
      #100319 100%
    );

  box-shadow:
    0 0 7px rgba(255,42,221,.9),
    0 0 20px rgba(135,39,255,.65),
    inset 0 0 22px rgba(255,255,255,.08);
}

.deckBack::before {
  content: "";

  position: absolute;

  width: 115px;
  height: 55px;

  border-radius: 50%;

  transform: rotate(-31deg);

  background:
    linear-gradient(
      90deg,
      rgba(26,234,255,.9),
      rgba(180,255,36,.8)
    );

  opacity: .14;

  filter: blur(2px);
}

.deckAcid,
.deckUno {
  position: relative;

  z-index: 2;

  font-weight: 1000;

  font-style: italic;

  line-height: .9;

  transform: rotate(-9deg);
}

.deckAcid {
  font-size: 20px;

  color: var(--acid);

  text-shadow:
    0 0 7px rgba(183,255,36,.9);
}

.deckUno {
  font-size: 25px;

  color: #fff;

  text-shadow:
    0 0 8px #fff,
    0 0 16px var(--magenta);
}

#deckCount {
  font-size: 8px;
  font-weight: 850;

  letter-spacing: 1px;

  color:
    rgba(255,255,255,.48);
}


/* =========================================================
   DISCARD
   ========================================================= */

.discardPile {
  position: relative;

  width: 84px;
  height: 126px;

  display: grid;
  place-items: center;

  z-index: 4;

  transform: rotate(3deg);

  filter:
    drop-shadow(
      0 13px 11px rgba(0,0,0,.38)
    );
}

.discardPile::before {
  content: "";

  position: absolute;

  inset: 6px 1px -5px 5px;

  border-radius: 13px;

  border:
    1px solid rgba(255,255,255,.12);

  background:
    rgba(255,255,255,.025);

  transform: rotate(-6deg);

  z-index: -1;
}


/* =========================================================
   GENERIC CARD
   ========================================================= */

.card,
.handCard,
.flyingCard {
  position: relative;

  width: var(--card-w);
  height: var(--card-h);

  border-radius: 14px;

  overflow: hidden;

  border:
    2px solid rgba(255,255,255,.92);

  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.16),
    inset 0 0 24px rgba(255,255,255,.11),
    0 10px 18px rgba(0,0,0,.38);

  color: #fff;
}

.card::before,
.handCard::before,
.flyingCard::before {
  content: "";

  position: absolute;

  width: 120%;
  height: 58%;

  left: -10%;
  top: 21%;

  border-radius: 50%;

  transform: rotate(-33deg);

  background:
    rgba(255,255,255,.87);

  box-shadow:
    0 0 13px rgba(255,255,255,.2);
}

.card::after,
.handCard::after,
.flyingCard::after {
  content: "";

  position: absolute;

  inset: 5px;

  border-radius: 10px;

  border:
    1px solid rgba(255,255,255,.25);

  pointer-events: none;
}

.card .value,
.handCard .value,
.flyingCard .value {
  position: absolute;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%)
    rotate(-6deg);

  z-index: 3;

  font-size: 35px;
  font-weight: 1000;

  letter-spacing: -2px;

  color: #101016;

  text-shadow:
    0 1px 0 rgba(255,255,255,.3);
}

.cardCorner {
  position: absolute;
  z-index: 6;
  display: none;
  min-width: 22px;
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -1px;
  text-align: center;
  -webkit-text-stroke: 1px rgba(0, 0, 0, .72);
  text-shadow: 0 1px 2px #000, 0 0 8px rgba(255,255,255,.48);
  pointer-events: none;
}

.cardCornerTop {
  top: 8px;
  left: 7px;
}

.cardCornerBottom {
  right: 7px;
  bottom: 8px;
  transform: rotate(180deg);
}

/* At 14+ cards the centres overlap; persistent corner values
   keep every card identifiable without opening the hand. */
.hand.is-crowded .handCard .cardCorner {
  display: block;
}

.hand.is-crowded .handCard .value {
  opacity: .48;
}


/* =========================================================
   CARD COLORS
   ========================================================= */

.card.red,
.handCard.red,
.flyingCard.red {
  background:
    radial-gradient(
      circle at 30% 18%,
      #ff7892,
      #ff254e 35%,
      #b40035 100%
    );

  box-shadow:
    inset 0 0 22px rgba(255,255,255,.12),
    0 0 7px rgba(255,49,88,.8),
    0 0 18px rgba(255,49,88,.35),
    0 11px 18px rgba(0,0,0,.42);
}

.card.yellow,
.handCard.yellow,
.flyingCard.yellow {
  background:
    radial-gradient(
      circle at 30% 18%,
      #fff585,
      #ffe332 36%,
      #e49500 100%
    );

  box-shadow:
    inset 0 0 22px rgba(255,255,255,.15),
    0 0 7px rgba(255,230,45,.75),
    0 0 18px rgba(255,209,33,.3),
    0 11px 18px rgba(0,0,0,.42);
}

.card.green,
.handCard.green,
.flyingCard.green {
  background:
    radial-gradient(
      circle at 30% 18%,
      #8affaa,
      #31ee68 36%,
      #00963f 100%
    );

  box-shadow:
    inset 0 0 22px rgba(255,255,255,.12),
    0 0 7px rgba(64,255,113,.78),
    0 0 18px rgba(50,255,105,.3),
    0 11px 18px rgba(0,0,0,.42);
}

.card.blue,
.handCard.blue,
.flyingCard.blue {
  background:
    radial-gradient(
      circle at 30% 18%,
      #77d7ff,
      #259dff 36%,
      #174ec4 100%
    );

  box-shadow:
    inset 0 0 22px rgba(255,255,255,.12),
    0 0 7px rgba(48,170,255,.82),
    0 0 18px rgba(42,167,255,.34),
    0 11px 18px rgba(0,0,0,.42);
}


/* =========================================================
   WILD
   ========================================================= */

.card.wild,
.handCard.wild,
.flyingCard.wild {
  background:
    conic-gradient(
      from -30deg,
      #ff3158,
      #ff3158 24%,
      #ffe43d 25%,
      #ffe43d 49%,
      #45ff77 50%,
      #45ff77 74%,
      #2da9ff 75%,
      #2da9ff 100%
    );

  box-shadow:
    0 0 7px rgba(255,255,255,.75),
    0 0 20px rgba(202,46,255,.55),
    0 11px 18px rgba(0,0,0,.42);
}

.card.wild::before,
.handCard.wild::before,
.flyingCard.wild::before {
  background:
    rgba(18,10,27,.9);

  box-shadow:
    0 0 12px rgba(255,255,255,.18);
}

.card.wild .value,
.handCard.wild .value,
.flyingCard.wild .value {
  color: #fff;

  text-shadow:
    0 0 5px #fff,
    0 0 13px rgba(255,47,220,.8);
}


/* =========================================================
   PLAYER HAND
   ========================================================= */

.hand {
  position: absolute;

  left: 50%;
  bottom: 23px;

  width: 100%;
  height: 180px;

  transform: translateX(-50%);

  pointer-events: auto;

  touch-action: none;
}

.handCard {
  position: absolute;

  left: 50%;
  bottom: 0;

  margin-left:
    calc(var(--card-w) / -2);

  transform-origin:
    50% 150%;

  transform:
    translate3d(
      var(--x, 0px),
      var(--y, 0px),
      0
    )
    rotate(
      var(--rot, 0deg)
    )
    scale(
      var(--scale, 1)
    );

  transition:
    transform
      .42s
      cubic-bezier(.18,.82,.22,1),
    filter .28s ease,
    opacity .28s ease;

  will-change:
    transform;

  cursor: grab;

  touch-action: none;
}

.handCard.playable {
  filter:
    brightness(1.05)
    drop-shadow(
      0 0 4px rgba(255,255,255,.22)
    );
}


/*
  Не прыгаем резко вверх при обычном тапе.
  Только лёгкая реакция.
*/

.handCard.playable:active {
  filter:
    brightness(1.14)
    drop-shadow(
      0 0 8px rgba(183,255,36,.5)
    );
}


/* =========================================================
   DRAGGING CARD

   JS во время pointermove переводит карту в fixed
   и задаёт transform напрямую.
   ========================================================= */

.handCard.dragging {
  position: fixed !important;

  left: 0 !important;
  top: 0 !important;
  bottom: auto !important;

  margin: 0 !important;

  z-index: 10000 !important;

  transform-origin:
    50% 50% !important;

  transition:
    filter .18s ease,
    box-shadow .18s ease !important;

  pointer-events: none;

  cursor: grabbing;

  filter:
    brightness(1.12)
    saturate(1.12)
    drop-shadow(
      0 20px 17px rgba(0,0,0,.45)
    );

  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.1),
    inset 0 0 25px rgba(255,255,255,.15),
    0 0 8px rgba(255,255,255,.65),
    0 0 25px rgba(47,231,255,.38),
    0 25px 35px rgba(0,0,0,.48);
}


/*
  Когда drag-карта допустима и находится
  над центральной зоной.
*/

.handCard.drag-valid {
  filter:
    brightness(1.2)
    saturate(1.16)
    drop-shadow(
      0 0 11px rgba(183,255,36,.8)
    )
    drop-shadow(
      0 20px 17px rgba(0,0,0,.45)
    );
}

.handCard.drag-invalid {
  filter:
    brightness(.82)
    saturate(.75)
    drop-shadow(
      0 0 11px rgba(255,30,75,.8)
    );
}


/* =========================================================
   PLACEHOLDER WHILE DRAGGING
   ========================================================= */

.handCard.drag-placeholder {
  opacity: .12;

  filter:
    grayscale(.5)
    brightness(.7);

  pointer-events: none;
}


/* =========================================================
   PLAYER HUD
   ========================================================= */

.playerHUD {
  position: absolute;

  left: 15px;
  right: 15px;
  bottom: calc(var(--safe-bottom) + 2px);

  height: 23px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  pointer-events: none;

  font-size: 9px;

  letter-spacing: 1px;

  color:
    rgba(255,255,255,.55);
}

.youLabel {
  font-size: 11px;
  font-weight: 1000;

  color: var(--acid);

  text-shadow:
    0 0 8px rgba(183,255,36,.7);
}


/* =========================================================
   ACTION HUD
   ========================================================= */

.actionHUD {
  position: absolute;

  left: 50%;
  bottom:
    calc(
      var(--safe-bottom) + 194px
    );

  transform: translateX(-50%);

  min-width: 230px;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 9px;

  z-index: 22;

  pointer-events: none;
}

.status {
  padding: 7px 12px;

  border-radius: 999px;

  background:
    rgba(11,5,22,.75);

  border:
    1px solid rgba(166,92,255,.3);

  box-shadow:
    inset 0 0 12px rgba(255,255,255,.025),
    0 0 16px rgba(121,45,255,.12);

  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);

  font-size: 9px;
  font-weight: 900;

  letter-spacing: .9px;

  white-space: nowrap;

  color:
    rgba(255,255,255,.82);
}

.currentColor {
  display: flex;
  align-items: center;

  gap: 5px;

  font-size: 8px;

  letter-spacing: .7px;

  color:
    rgba(255,255,255,.38);
}

.colorDot {
  display: block;

  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: var(--red);

  box-shadow:
    0 0 7px currentColor,
    0 0 14px currentColor;
}


/* =========================================================
   ANIMATION LAYER
   ========================================================= */

.animationLayer {
  position: fixed;
  inset: 0;

  z-index: 5000;

  pointer-events: none;

  overflow: visible;
}

.flyingCard {
  position: fixed;

  margin: 0;

  will-change:
    transform,
    opacity;
}


/* =========================================================
   OVERLAYS
   ========================================================= */

.overlay {
  position: fixed;
  inset: 0;

  z-index: 20000;

  display: grid;
  place-items: center;

  padding:
    calc(var(--safe-top) + 20px)
    20px
    calc(var(--safe-bottom) + 20px);

  background:
    radial-gradient(
      circle at 50% 45%,
      rgba(110,31,181,.28),
      rgba(3,1,8,.88) 60%
    );

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.window {
  width:
    min(
      340px,
      calc(100vw - 36px)
    );

  padding: 25px 20px;

  border-radius: 28px;

  text-align: center;

  border:
    1px solid rgba(181,93,255,.68);

  background:
    linear-gradient(
      155deg,
      rgba(31,11,52,.98),
      rgba(8,4,16,.98)
    );

  box-shadow:
    0 0 10px rgba(173,64,255,.5),
    0 0 45px rgba(125,40,255,.28),
    inset 0 0 28px rgba(255,255,255,.035);
}

.windowEyebrow,
.endAcid {
  color: var(--acid);

  font-size: 10px;
  font-weight: 1000;

  letter-spacing: 3px;

  text-shadow:
    0 0 10px rgba(183,255,36,.75);
}

.window h2,
.window h1 {
  margin:
    8px 0 21px;

  font-weight: 1000;

  letter-spacing: -1px;

  text-shadow:
    0 0 14px rgba(255,255,255,.18);
}


/* =========================================================
   COLOR PICKER
   ========================================================= */

.colors {
  display: grid;

  grid-template-columns:
    repeat(2, 1fr);

  gap: 12px;
}

.pick {
  height: 72px;

  border-radius: 20px;

  border:
    2px solid rgba(255,255,255,.75);

  box-shadow:
    0 0 15px rgba(255,255,255,.08),
    inset 0 0 20px rgba(255,255,255,.12);

  position: relative;

  overflow: hidden;
}

.pick span {
  position: absolute;

  width: 55px;
  height: 110px;

  left: 50%;
  top: 50%;

  transform:
    translate(-50%, -50%)
    rotate(35deg);

  border-radius: 50%;

  background:
    rgba(255,255,255,.22);
}

.pick.red {
  background: var(--red);
}

.pick.yellow {
  background: var(--yellow);
}

.pick.green {
  background: var(--green);
}

.pick.blue {
  background: var(--blue);
}


/* =========================================================
   END SCREEN
   ========================================================= */

.endWindow h1 {
  margin-bottom: 14px;
}

.endLine {
  width: 80px;
  height: 2px;

  margin:
    0 auto 20px;

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--cyan),
      var(--magenta),
      transparent
    );

  box-shadow:
    0 0 10px var(--magenta);
}

#again {
  width: 100%;

  padding: 14px;

  border-radius: 16px;

  border:
    1px solid rgba(255,255,255,.65);

  background:
    linear-gradient(
      90deg,
      #7e2cff,
      #e527d9
    );

  font-size: 12px;
  font-weight: 1000;

  letter-spacing: 1px;

  box-shadow:
    0 0 20px rgba(211,39,255,.34);
}


/* =========================================================
   UTILITIES
   ========================================================= */

.hidden {
  display: none !important;
}


/* =========================================================
   TABLE BREATH
   ========================================================= */

@keyframes tableGlowBreath {
  0%,
  100% {
    opacity: .35;
    filter: blur(13px);
  }

  50% {
    opacity: .56;
    filter: blur(17px);
  }
}


/* =========================================================
   SMALL iPHONES
   ========================================================= */

@media
(max-height: 720px) {

  #table {
    top: 45%;

    height: 255px;

    min-height: 255px;
  }

  .botZone {
    height: 82px;
  }

  .botCards {
    transform:
      translateX(-50%)
      scale(.88);

    transform-origin: top center;
  }

  .playerZoneBottom {
    height: 184px;
  }

  .hand {
    height: 160px;

    bottom: 18px;
  }

  .actionHUD {
    bottom:
      calc(
        var(--safe-bottom) + 174px
      );
  }

}


/* =========================================================
   VERY NARROW
   ========================================================= */

@media
(max-width: 350px) {

  :root {
    --card-w: 77px;
    --card-h: 115px;
  }

  #center {
    width: 205px;

    gap: 17px;
  }

  #deck {
    transform:
      rotate(-4deg)
      scale(.93);
  }

  .discardPile {
    transform:
      rotate(3deg)
      scale(.93);
  }

}


/* =========================================================
   REDUCED MOTION

   Не выключаем анимации полностью:
   иначе логика игры становится непонятной.
   ========================================================= */

@media
(prefers-reduced-motion: reduce) {

  .tableOuterGlow {
    animation-duration: 8s;
  }

  .handCard {
    transition-duration: .25s;
  }

}


/* =========================================================
   DESKTOP / LARGE TABLET
   Spacious screen = larger physical cards, wider table and
   a shallower, easier-to-read hand fan.
   ========================================================= */

@media (min-width: 900px) and (min-height: 620px) {
  :root {
    --card-w: 112px;
    --card-h: 168px;
  }

  .topbar {
    padding: 22px 30px;
  }

  .logo {
    font-size: 34px;
  }

  .botZone {
    top: calc(var(--safe-top) + 74px);
    height: 178px;
  }

  .botTitle {
    left: 30px;
    top: 16px;
  }

  .botAvatar {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    font-size: 27px;
  }

  .botInfo strong {
    font-size: 15px;
  }

  #botCount {
    font-size: 11px;
  }

  #table {
    top: 45%;
    width: min(66vw, var(--table-max-w));
    height: min(56vh, var(--table-max-h));
    min-height: 390px;
  }

  #center {
    width: 320px;
    height: 245px;
    gap: 34px;
  }

  .deckArea {
    width: 112px;
  }

  #deck {
    width: 104px;
    height: 156px;
  }

  .discardPile,
  .discardPile .card {
    width: 112px;
    height: 168px;
  }

  .playerZoneBottom {
    height: 286px;
  }

  .hand {
    height: 250px;
    bottom: 2px;
  }

  .actionHUD {
    bottom: calc(var(--safe-bottom) + 254px);
  }

  .status {
    padding: 9px 16px;
    font-size: 11px;
  }

  .playerHUD {
    left: 28px;
    right: 28px;
    font-size: 11px;
  }
}

@media (min-width: 1500px) and (min-height: 760px) {
  :root {
    --card-w: 122px;
    --card-h: 183px;
  }
}
