.gr-shell {
  --gr-cw: 72px;
  --gr-ch: calc(var(--gr-cw) * 1.4);
  --gr-mini: 24px;
  --gr-felt: #1a6047;
  --gr-felt-dark: #0c3527;
  --gr-gold: #f0c04a;
  --gr-cream: #fbf6ea;
  max-width: min(100%, 880px);
  margin: 0 auto;
  padding: 2px 0 20px;
  color: var(--cg-ink);
  font-family: Inter, system-ui, Arial, sans-serif;
}

.gr-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.gr-stats {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.gr-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f0f3ee);
  box-shadow: 0 3px 8px rgba(20, 48, 38, 0.08);
}

.gr-stat span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cg-muted);
}

.gr-stat strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.gr-actions {
  display: flex;
  gap: 6px;
}

.gr-icon,
.gr-btn,
.gr-chip,
.gr-close {
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f0f3ee);
  color: var(--cg-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(20, 48, 38, 0.08);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.gr-icon,
.gr-close {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.15rem;
}

.gr-btn {
  padding: 0 18px;
}

.gr-icon:hover,
.gr-btn:hover:not(:disabled),
.gr-chip:hover {
  border-color: var(--cg-teal);
}

.gr-icon:focus-visible,
.gr-btn:focus-visible,
.gr-chip:focus-visible,
.gr-close:focus-visible,
.gr-card:focus-visible,
.gr-pile:focus-visible {
  outline: 3px solid #f0c04a;
  outline-offset: 2px;
}

.gr-btn:disabled,
.gr-icon:disabled,
.gr-card:disabled,
.gr-pile:disabled {
  cursor: default;
}

.gr-btn:disabled {
  opacity: 0.45;
}

.gr-btn-primary {
  background: linear-gradient(180deg, #34c79f, #1c9273);
  border-color: transparent;
  color: #fff;
}

.gr-btn-primary:not(:disabled) {
  box-shadow: 0 6px 16px rgba(28, 146, 115, 0.45);
  animation: gr-pulse 1.4s ease-in-out infinite;
}

.gr-btn-primary:disabled {
  background: #a5b9b1;
}

.gr-ico {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gr-icon {
  position: relative;
}

.gr-board {
  position: relative;
  padding: 12px 14px 14px;
  border-radius: 22px;
  border: 7px solid #3a2616;
  background:
    radial-gradient(90% 70% at 50% 40%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0) 65%),
    radial-gradient(120% 90% at 50% 120%, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 2px, rgba(0, 0, 0, 0.025) 2px 4px),
    linear-gradient(180deg, var(--gr-felt), var(--gr-felt-dark));
  box-shadow: 0 22px 44px rgba(10, 34, 26, 0.4), inset 0 0 0 2px rgba(255, 220, 140, 0.18), inset 0 0 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.gr-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.gr-house {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.gr-house-head {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.gr-house-name {
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gr-gold);
}

.gr-house-info {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

.gr-think::after {
  content: "...";
  animation: gr-blink 1s steps(3) infinite;
}

.gr-house-cards {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 14px;
}

.gr-back {
  flex: 0 0 auto;
  width: 30px;
  height: 42px;
  margin-left: -14px;
  border-radius: 5px;
  background:
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.18) 0 2px, rgba(0, 0, 0, 0) 2px 5px),
    linear-gradient(160deg, #a63248, #5b1a29);
  box-shadow: inset 0 0 0 2px #f5eadb, 0 3px 6px rgba(0, 0, 0, 0.4);
  animation: gr-deal-in 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 25ms);
}

.gr-back-lg {
  width: 100%;
  height: 100%;
  margin: 0;
}

.gr-house-cards.gr-open {
  flex-wrap: wrap;
  gap: 2px;
  padding-left: 0;
}

.gr-house-cards.gr-open .gr-card {
  margin: 0;
  animation: gr-flip 0.45s ease both;
}

.gr-center {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vw, 44px);
  padding: 2px 0;
}

.gr-pilewrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gr-pile {
  position: relative;
  width: var(--gr-cw);
  height: var(--gr-ch);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  font-family: Georgia, 'Times New Roman', serif;
  transition: transform 0.14s ease;
}

.gr-pile-stock {
  background:
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.18) 0 3px, rgba(0, 0, 0, 0) 3px 7px),
    linear-gradient(160deg, #a63248, #5b1a29);
  box-shadow: inset 0 0 0 3px #f5eadb, 1px 1px 0 #d9ccb8, 2px 2px 0 #c9bba5, 3px 3px 0 #b7a98f, 5px 12px 20px rgba(0, 0, 0, 0.45);
}

.gr-pile.gr-empty {
  opacity: 0.35;
}

.gr-pile.gr-glow:not(:disabled) {
  animation: gr-glow 1.3s ease-in-out infinite;
}

.gr-pile:not(:disabled):hover {
  transform: translateY(-3px);
}

.gr-pile .gr-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(160deg, #fffdf6, #f3ead6);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.gr-toss {
  animation: gr-toss 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.gr-pile-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.gr-pile-label b {
  color: var(--gr-gold);
}

.gr-status {
  flex: 1 1 0;
  max-width: 260px;
  margin: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
}

.gr-handrow {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 18px 4px 6px;
  min-height: calc(var(--gr-ch) + 24px);
}

.gr-handrow .gr-card + .gr-card {
  margin-left: calc(var(--gr-cw) * -0.2);
}

.gr-handrow .gr-card:hover,
.gr-handrow .gr-card:focus-visible {
  z-index: 3;
}

.gr-sep {
  width: 8px;
  height: 1px;
}

.gr-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
}

.gr-meter {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.gr-meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #e0526b, #f0c04a);
  transition: width 0.4s ease, background 0.3s ease;
}

.gr-meter b {
  position: absolute;
  left: 25%;
  top: 0;
  width: 2px;
  height: 100%;
  background: #fff;
}

.gr-meter.gr-ok i {
  background: linear-gradient(90deg, #2fb98a, #7be0b4);
}

.gr-dead {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.gr-dead span {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.gr-dead strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.gr-dead-soft strong {
  color: var(--gr-gold);
}

.gr-foot .gr-btn-primary {
  margin-left: auto;
  min-width: 110px;
}

.gr-hint {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.gr-card {
  position: relative;
  width: var(--gr-cw);
  height: var(--gr-ch);
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--gr-cream);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  overflow: hidden;
  transition: transform 0.13s ease;
}

button.gr-card {
  cursor: pointer;
}

button.gr-card:not(:disabled):hover {
  transform: translateY(-8px);
}

.gr-meld {
  box-shadow: 0 0 0 2px rgba(120, 220, 170, 0.8), 0 5px 12px rgba(0, 0, 0, 0.35);
}

.gr-ten {
  box-shadow: 0 0 0 2px rgba(227, 178, 60, 0.85), 0 5px 12px rgba(0, 0, 0, 0.35);
}

.gr-tile {
  width: var(--gr-mini);
  height: calc(var(--gr-mini) * 1.4);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.gr-face {
  position: absolute;
  inset: 0;
  color: #1a1a1a;
  background: linear-gradient(160deg, #fffdf6, #f3ead6);
}

.gr-red .gr-face {
  color: #c32b26;
}

.gr-ix {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.gr-ix b {
  font-size: calc(var(--gr-cw) * 0.26);
  font-weight: 700;
}

.gr-ix i {
  font-size: calc(var(--gr-cw) * 0.2);
  font-style: normal;
  margin-top: 1px;
}

.gr-tl {
  left: 4%;
  top: 4%;
}

.gr-br {
  right: 4%;
  bottom: 4%;
  transform: rotate(180deg);
}

.gr-tile .gr-ix b {
  font-size: calc(var(--gr-mini) * 0.36);
}

.gr-tile .gr-ix i {
  font-size: calc(var(--gr-mini) * 0.3);
}

.gr-pips {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 10%;
  bottom: 10%;
}

.gr-pip {
  position: absolute;
  font-size: calc(var(--gr-cw) * 0.24);
  font-style: normal;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.gr-flip {
  transform: translate(-50%, -50%) rotate(180deg);
}

.gr-big {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: calc(var(--gr-cw) * 0.55);
  font-style: normal;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.gr-court {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 20%;
  bottom: 20%;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.04);
}

.gr-court b {
  font-size: calc(var(--gr-cw) * 0.42);
  font-weight: 700;
}

.gr-court i {
  position: absolute;
  right: 3%;
  bottom: 2%;
  font-size: calc(var(--gr-cw) * 0.22);
  font-style: normal;
}

.gr-tile .gr-pips {
  display: none;
}

.gr-tile .gr-big {
  font-size: calc(var(--gr-mini) * 0.62);
}

.gr-tile .gr-court b {
  font-size: calc(var(--gr-mini) * 0.6);
}

.gr-tile .gr-court i {
  font-size: calc(var(--gr-mini) * 0.34);
}


.gr-handrow.gr-live .gr-card {
  cursor: pointer;
}

.gr-handrow .gr-card {
  --gr-lift: 0px;
  transform: translateY(var(--gr-lift));
}

.gr-handrow.gr-live .gr-card:hover,
.gr-handrow.gr-live .gr-card:focus-visible {
  --gr-lift: -10px;
}

.gr-handrow .gr-meld::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: linear-gradient(90deg, #2fb98a, #7be0b4);
}

.gr-handrow .gr-ten:not(.gr-meld)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #f0c04a;
}

.gr-deal {
  animation: gr-deal-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.gr-new {
  animation: gr-draw 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.gr-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.gr-modes {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--cg-line);
}

.gr-chip {
  padding: 0 16px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--cg-muted);
}

.gr-chip.gr-on {
  background: #fff;
  border-color: var(--cg-teal);
  color: var(--cg-ink);
}

.gr-result {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 26, 19, 0.7);
  backdrop-filter: blur(2px);
  animation: gr-fade 0.3s ease both;
}

.gr-result[hidden] {
  display: none;
}

.gr-result-card {
  width: min(100%, 420px);
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf6, #f1e9d3);
  border: 2px solid var(--gr-gold);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  color: #1c2a24;
}

.gr-result-card h2 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.gr-won .gr-result-card h2 {
  color: #157a5c;
}

.gr-restext {
  margin: 0 0 10px;
  color: #4d5d55;
  font-size: 0.92rem;
  font-weight: 700;
}

.gr-reslist {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.gr-reslist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.86rem;
}

.gr-reslist span {
  font-weight: 900;
  min-width: 46px;
  text-align: left;
}

.gr-reslist b {
  flex: 1 1 auto;
  text-align: left;
  font-weight: 700;
  color: #4d5d55;
}

.gr-reslist em {
  font-style: normal;
  font-weight: 900;
  font-size: 1.05rem;
  color: #157a5c;
}

.gr-resactions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

@keyframes gr-deal-in {
  from { opacity: 0; transform: translateY(-40px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

@keyframes gr-draw {
  0% { opacity: 0; transform: translateY(-90px) scale(0.8) rotate(-6deg); }
  70% { opacity: 1; transform: translateY(4px) scale(1.06); }
  100% { transform: none; }
}

@keyframes gr-toss {
  0% { transform: translateY(150px) rotate(-14deg) scale(1.05); }
  100% { transform: none; }
}

@keyframes gr-flip {
  from { transform: rotateY(90deg); }
  to { transform: none; }
}

@keyframes gr-pulse {
  50% { box-shadow: 0 6px 24px rgba(52, 199, 159, 0.9); }
}

@keyframes gr-glow {
  50% { box-shadow: 0 0 0 3px rgba(240, 192, 74, 0.9), 0 10px 26px rgba(240, 192, 74, 0.45); }
}

@keyframes gr-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gr-blink {
  0% { content: "."; }
  33% { content: ".."; }
  66% { content: "..."; }
}

@media (max-width: 640px) {
  .gr-shell {
    --gr-cw: calc((100vw - 32px - 24px - 5 * 6px) / 6);
    --gr-mini: 20px;
  }
  .gr-board {
    padding: 10px 8px 12px;
    border-width: 5px;
    gap: 8px;
  }
  .gr-stat {
    padding: 0 8px;
    gap: 5px;
  }
  .gr-stat span {
    font-size: 9px;
  }
  .gr-status {
    font-size: 0.8rem;
    padding: 7px 8px;
  }
  .gr-back {
    width: 26px;
    height: 36px;
    margin-left: -12px;
  }
  .gr-dead {
    padding: 0 9px;
  }
  .gr-dead-soft {
    display: none;
  }
  .gr-foot .gr-btn-primary {
    min-width: 0;
    flex: 1 1 auto;
  }
  .gr-dead span {
    font-size: 0.58rem;
  }
  .gr-handrow {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-content: center;
    gap: 8px 6px;
    padding: 10px 2px 4px;
  }
  .gr-handrow .gr-card + .gr-card {
    margin-left: 0;
  }
  .gr-handrow .gr-card {
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 7;
  }
  .gr-sep {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gr-shell * {
    animation: none !important;
    transition: none !important;
  }
}

.gr-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(12, 26, 21, 0.66);
}

.gr-overlay[hidden] {
  display: none;
}

.gr-modal {
  width: min(94vw, 520px);
  max-height: 84vh;
  overflow-y: auto;
  border-radius: 16px;
  background: var(--cg-panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.gr-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 6px;
}

.gr-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.gr-close {
  min-width: 44px;
  padding: 0 12px;
}

.gr-modal-body {
  padding: 0 16px 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--cg-ink);
}

.gr-modal-body p {
  margin: 0 0 10px;
}

