@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600;700&family=Russo+One&display=swap");

:root {
  --bg-0: #07120d;
  --bg-1: #0c231b;
  --bg-2: #104235;
  --felt-0: #0b3a2b;
  --felt-1: #0f5440;
  --text-main: #eef7ee;
  --text-muted: #b7cab9;
  --panel-bg: rgba(6, 17, 12, 0.78);
  --panel-border: rgba(182, 210, 172, 0.23);
  --accent-gold: #ffd58e;
  --accent-red: #d73f53;
  --accent-black: #1d2520;
  --card-back-a: #6f1628;
  --card-back-b: #3f0f1a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Chakra Petch", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 22% 14%, #145141, #07120d 62%);
}

body {
  overflow-x: hidden;
}

.ambient-layer,
.screen-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient-layer {
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 213, 142, 0.08), transparent 40%),
    radial-gradient(circle at 88% 20%, rgba(140, 255, 210, 0.06), transparent 40%);
}

.screen-grid {
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.33;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
}

.brand-block h1 {
  margin: 0;
  font-family: "Russo One", sans-serif;
  font-size: 30px;
  letter-spacing: 0.4px;
}

.brand-block p {
  margin: 5px 0 0;
  color: var(--text-muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.controls label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

select,
button {
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  padding: 8px 11px;
  font: inherit;
}

select {
  min-width: 170px;
  color: var(--text-main);
  background: rgba(8, 23, 16, 0.92);
}

button {
  cursor: pointer;
  transition: transform 0.16s ease-out, background-color 0.16s ease-out, border-color 0.16s ease-out;
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #102314;
  font-weight: 600;
  border-color: #ffdd9d;
  background: linear-gradient(135deg, #ffeac0, #ffd58e);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fff2d5, #ffe4b3);
}

.btn-ghost {
  color: var(--text-main);
  background: rgba(15, 39, 28, 0.88);
}

.btn-ghost:hover {
  background: rgba(24, 57, 41, 0.92);
}

.promo-board {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 213, 142, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 213, 142, 0.1), rgba(126, 255, 200, 0.07)),
    rgba(7, 24, 16, 0.78);
  backdrop-filter: blur(7px);
}

.promo-copy h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
  color: #ffe3b0;
}

.promo-copy p {
  margin: 7px 0 0;
  color: #d2e8d4;
  max-width: 760px;
}

.promo-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.promo-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 222, 168, 0.42);
  padding: 3px 10px;
  font-size: 12px;
  color: #ffe7be;
  background: rgba(51, 33, 12, 0.36);
}

.promo-contact {
  display: grid;
  gap: 7px;
  min-width: 260px;
}

.promo-contact p {
  margin: 0;
  color: #f6eddd;
  font-size: 15px;
}

.promo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 235, 188, 0.45);
  background: linear-gradient(135deg, #ffeac0, #ffd58e);
  color: #1e271f;
  text-decoration: none;
  font-weight: 700;
  padding: 8px 12px;
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out;
}

.promo-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(255, 213, 142, 0.25);
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.table-felt {
  position: relative;
  border-radius: 20px;
  border: 1px solid rgba(182, 210, 172, 0.3);
  padding: 14px;
  background: radial-gradient(circle at 50% 45%, var(--felt-1), var(--felt-0) 70%);
  box-shadow: inset 0 0 72px rgba(0, 0, 0, 0.45), 0 10px 22px rgba(0, 0, 0, 0.27);
  overflow: hidden;
}

.table-felt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.43;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 4px 4px;
}

.player-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 10px;
}

.seat-card {
  border-radius: 14px;
  border: 1px solid rgba(210, 232, 206, 0.28);
  background: rgba(7, 24, 16, 0.73);
  backdrop-filter: blur(2px);
  padding: 10px;
}

.seat-card.human {
  margin-top: 12px;
  border-color: rgba(255, 213, 132, 0.45);
  background: rgba(11, 30, 21, 0.88);
}

.seat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seat-name {
  font-size: 16px;
  font-weight: 600;
}

.seat-count {
  color: #ffe5b2;
  font-weight: 600;
}

.card-stack {
  position: relative;
  height: 70px;
  margin-top: 8px;
}

.stack-card {
  position: absolute;
  width: 46px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid rgba(255, 221, 194, 0.4);
  background:
    linear-gradient(135deg, transparent 35%, rgba(255, 255, 255, 0.09) 35%, rgba(255, 255, 255, 0.09) 45%, transparent 45%),
    linear-gradient(45deg, var(--card-back-a), var(--card-back-b));
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.34);
}

.seat-last-cards {
  min-height: 54px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.seat-last-cards::-webkit-scrollbar {
  height: 4px;
}

.seat-last-cards::-webkit-scrollbar-thumb {
  background: rgba(214, 236, 204, 0.26);
  border-radius: 999px;
}

.mini-card {
  position: relative;
  min-width: 32px;
  width: 32px;
  height: 46px;
  border-radius: 6px;
  border: 1px solid #c6ccd3;
  background: linear-gradient(180deg, #ffffff, #f1f3f6 92%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  color: var(--accent-black);
  font-family: "Times New Roman", "Noto Serif SC", serif;
  overflow: hidden;
}

.mini-card.red {
  color: var(--accent-red);
}

.mini-card.joker-mini {
  min-width: 34px;
  width: 34px;
  background: linear-gradient(180deg, #fdfbff, #eef1f8 92%);
}

.mini-pass {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px dashed rgba(248, 194, 183, 0.56);
  color: #f7d3c3;
}

.seat-last,
.seat-reveal {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}

.seat-reveal {
  color: #ffd7a3;
}

.table-center {
  width: min(460px, 100%);
  margin: 10px auto 0;
  text-align: center;
  border-radius: 14px;
  border: 1px solid rgba(245, 232, 206, 0.24);
  background: rgba(8, 24, 16, 0.8);
  padding: 12px;
}

.status-line {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid rgba(247, 230, 201, 0.26);
  background: rgba(255, 207, 122, 0.14);
  font-size: 12px;
  font-weight: 600;
}

.status-chip.muted {
  background: rgba(134, 190, 153, 0.12);
  color: #d2e8d8;
}

.center-text {
  margin: 10px 0 2px;
  color: #fff1d7;
  font-size: 18px;
}

.winner-text {
  margin: 8px 0 0;
  min-height: 24px;
  color: var(--accent-gold);
  font-size: 20px;
  letter-spacing: 0.5px;
  font-family: "Russo One", sans-serif;
  text-shadow: 0 0 13px rgba(255, 210, 126, 0.35);
}

.hand-row {
  margin-top: 10px;
  min-height: 118px;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 6px;
}

.hand-row::-webkit-scrollbar {
  height: 6px;
}

.hand-row::-webkit-scrollbar-thumb {
  background: rgba(214, 236, 204, 0.34);
  border-radius: 999px;
}

.hand-actions {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.selected-text {
  margin: 0;
  color: #f7e7c2;
  font-size: 14px;
  font-weight: 600;
}

.selected-text.invalid {
  color: #ffb3b3;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.playing-card {
  width: 64px;
  min-width: 64px;
  height: 102px;
  border-radius: 8px;
  border: 1px solid #c6ccd3;
  background: linear-gradient(180deg, #ffffff, #f1f3f6 92%);
  box-shadow: 0 6px 13px rgba(0, 0, 0, 0.28);
  color: var(--accent-black);
  font-family: "Times New Roman", "Noto Serif SC", serif;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transition: transform 0.14s ease-out, box-shadow 0.14s ease-out, border-color 0.14s ease-out, z-index 0s linear 0.14s;
}

.playing-card:hover:not(:disabled) {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.34);
  z-index: 4;
  transition-delay: 0s;
}

.playing-card.selected {
  transform: translateY(-11px);
  border-color: #fdd584;
  box-shadow: 0 13px 23px rgba(255, 207, 122, 0.28);
  z-index: 6;
  transition-delay: 0s;
}

.playing-card:disabled {
  cursor: default;
}

.playing-card.red {
  color: var(--accent-red);
}

.playing-card.black {
  color: var(--accent-black);
}

.face-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 0.9;
  letter-spacing: -0.3px;
}

.face-corner-top {
  left: 6px;
  top: 4px;
}

.face-corner-bottom {
  right: 6px;
  bottom: 4px;
  transform: rotate(180deg);
}

.face-rank {
  font-weight: 700;
}

.face-rank-main {
  font-size: 31px;
  letter-spacing: -1px;
}

.face-rank-side {
  font-size: 18px;
  letter-spacing: -0.7px;
}

.face-suit-small {
  font-size: 14px;
  margin-top: -3px;
}

.face-center-suit {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  line-height: 1;
  opacity: 0.95;
}

.joker-side-label {
  position: absolute;
  left: 5px;
  top: 5px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Russo One", sans-serif;
  font-size: 11px;
  letter-spacing: 0.7px;
}

.joker-main-label {
  position: absolute;
  right: 7px;
  top: 8px;
  font-size: 16px;
  font-weight: 700;
}

.joker-mirror-label {
  position: absolute;
  left: 7px;
  bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  transform: rotate(180deg);
}

.playing-card.joker {
  background: linear-gradient(180deg, #fefcff, #eef1f8 92%);
}

.mini-card .face-corner-top {
  left: 3px;
  top: 2px;
}

.mini-card .face-corner-bottom {
  right: 3px;
  bottom: 2px;
}

.mini-card .face-rank-main {
  font-size: 16px;
}

.mini-card .face-rank-side {
  font-size: 10px;
}

.mini-card .face-suit-small {
  font-size: 9px;
  margin-top: -1px;
}

.mini-card .face-center-suit {
  font-size: 16px;
}

.mini-card .joker-side-label {
  left: 2px;
  top: 2px;
  font-size: 6px;
  letter-spacing: 0.4px;
}

.mini-card .joker-main-label {
  right: 3px;
  top: 4px;
  font-size: 9px;
}

.mini-card .joker-mirror-label {
  left: 3px;
  bottom: 4px;
  font-size: 8px;
}

.side-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.panel {
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  padding: 12px;
  min-height: 230px;
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1;
}

.move-list,
.log-list {
  overflow: auto;
  min-height: 0;
}

.move-list {
  display: grid;
  gap: 7px;
}

.move-item {
  text-align: left;
  color: #f7f6f3;
  background: rgba(25, 60, 44, 0.82);
  border: 1px solid rgba(201, 224, 186, 0.26);
  padding: 7px 9px;
  border-radius: 9px;
}

.move-item:hover:not(:disabled) {
  background: rgba(40, 85, 63, 0.88);
  border-color: rgba(255, 214, 134, 0.58);
}

.move-item.active-match {
  border-color: #ffd48a;
  box-shadow: inset 0 0 0 1px rgba(255, 223, 159, 0.35);
}

.move-item.pass {
  color: #f8d7be;
  border-style: dashed;
}

.move-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.log-line {
  padding: 7px 3px;
  border-bottom: 1px solid rgba(196, 219, 185, 0.14);
  color: #d8e8d7;
  font-size: 14px;
}

.log-line:last-child {
  border-bottom: 0;
}

.busy-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 8, 6, 0.64);
  display: grid;
  place-items: center;
}

.busy-mask.hidden {
  display: none;
}

.busy-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 225, 180, 0.4);
  background: rgba(14, 33, 23, 0.94);
  padding: 15px 22px;
  text-align: center;
}

.loader {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid rgba(255, 228, 170, 0.25);
  border-top-color: #ffd79a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-card p {
  margin: 8px 0 0;
  color: #ffe9bf;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .side-panel {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: 260px;
  }
}

@media (max-width: 820px) {
  .player-row {
    grid-template-columns: 1fr;
  }

  .brand-block h1 {
    font-size: 24px;
  }

  .controls label {
    width: 100%;
  }

  select {
    min-width: 0;
    width: 100%;
  }

  .promo-copy h2 {
    font-size: 20px;
  }

  .promo-contact {
    min-width: 100%;
  }

  .promo-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
