:root {
  color-scheme: dark;
  --bg: #181611;
  --panel: #242018;
  --panel-2: #312a1f;
  --line: #6b5b3f;
  --gold: #e0ba59;
  --amber: #f19a3e;
  --green: #58b47b;
  --blue: #5ea7d8;
  --red: #d85a55;
  --pink: #dc70b5;
  --white: #f4ead3;
  --muted: #b7a98b;
  --shadow: rgba(0, 0, 0, .38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 15%, rgba(224, 186, 89, .14), transparent 28rem),
    linear-gradient(140deg, #15130f, #211b14 56%, #151410);
  color: var(--white);
}

button {
  border: 1px solid rgba(244, 234, 211, .18);
  border-radius: 7px;
  background: #3b3124;
  color: var(--white);
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, opacity .14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #4a3d2c;
}

button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2fr;
  gap: 18px;
  align-items: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 54px);
  line-height: .95;
  color: var(--gold);
}

.topbar p,
#turnHint {
  color: var(--muted);
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.score-card {
  border: 1px solid rgba(244, 234, 211, .14);
  border-radius: 8px;
  padding: 10px;
  background: rgba(36, 32, 24, .88);
  box-shadow: 0 10px 22px var(--shadow);
}

.score-card.active {
  outline: 2px solid var(--gold);
}

.score-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.score-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.table-scene {
  height: min(58vh, 690px);
  min-height: 440px;
  margin: 16px 0;
  perspective: 1250px;
}

.mine-table {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(244, 234, 211, .12);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(0deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(ellipse at center, #49371f 0%, #2e251a 55%, #1e1913 100%);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .42), 0 26px 70px var(--shadow);
  transform: rotateX(8deg);
  transform-style: preserve-3d;
}

.bonus-track {
  position: absolute;
  z-index: 4;
  top: 22px;
  left: 50%;
  display: flex;
  gap: 12px;
  transform: translateX(-50%);
}

.bonus-slot {
  width: 132px;
  min-height: 108px;
  border: 1px solid rgba(224, 186, 89, .38);
  border-radius: 8px;
  padding: 8px;
  background: rgba(18, 16, 12, .78);
  box-shadow: 0 12px 28px var(--shadow);
}

.bonus-slot.empty {
  opacity: .32;
}

.bonus-money {
  color: var(--gold);
  font-size: 20px;
  font-weight: 950;
}

.card-name {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.card-effect {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.bag {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 142px;
  height: 142px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 45% 30%, #775b32, #302416 72%);
  box-shadow: inset 0 -18px 26px rgba(0, 0, 0, .34), 0 18px 34px var(--shadow);
  transform: translate(-50%, -50%) translateZ(34px);
}

.bag-count {
  display: block;
  color: var(--gold);
  font-size: 42px;
  font-weight: 950;
  line-height: 1;
}

.bag-label {
  position: absolute;
  bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.day-marker {
  position: absolute;
  z-index: 5;
  right: 22px;
  top: 22px;
  border: 1px solid rgba(224, 186, 89, .38);
  border-radius: 7px;
  padding: 10px 12px;
  background: rgba(18, 16, 12, .82);
  color: var(--gold);
  font-weight: 950;
}

.player-seat {
  position: absolute;
  z-index: 5;
  width: min(280px, 24vw);
  min-width: 210px;
  border: 1px solid rgba(244, 234, 211, .16);
  border-radius: 10px;
  padding: 10px;
  background: rgba(36, 32, 24, .9);
  box-shadow: 0 16px 28px var(--shadow);
  transform: translate(-50%, -50%) translateZ(48px);
}

.player-seat.pos-0 { left: 50%; bottom: 8px; transform: translateX(-50%) translateZ(60px); }
.player-seat.pos-1 { left: 10%; top: 50%; }
.player-seat.pos-2 { left: 50%; top: 25%; }
.player-seat.pos-3 { right: 10%; top: 50%; transform: translate(50%, -50%) translateZ(48px); }

.player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 950;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(224, 186, 89, .14);
  color: var(--gold);
  font-size: 12px;
}

.cart {
  margin-top: 8px;
  border: 1px solid rgba(244, 234, 211, .12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, .18);
}

.cart.out {
  filter: grayscale(.6);
  opacity: .72;
}

.crystal-row,
.chest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 26px;
}

.chest-row {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(244, 234, 211, .18);
}

.crystal {
  width: 22px;
  height: 22px;
  border-radius: 6px 6px 9px 9px;
  transform: rotate(45deg);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, .34), 0 4px 10px rgba(0, 0, 0, .28);
}

.crystal::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
}

.q { background: #e7dfc7; }
.ru { background: var(--pink); }
.e { background: var(--green); }
.s { background: var(--blue); }
.rb { background: var(--red); }
.a { background: var(--amber); }
.u { background: #222; border: 2px solid #9b8f7a; }

.control-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
}

.panel {
  border: 1px solid rgba(244, 234, 211, .14);
  border-radius: 10px;
  background: rgba(36, 32, 24, .92);
  box-shadow: 0 16px 34px var(--shadow);
  padding: 14px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.hand {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 10px;
}

.action-card {
  border: 1px solid rgba(244, 234, 211, .16);
  border-radius: 8px;
  padding: 10px;
  min-height: 122px;
  text-align: left;
  background: linear-gradient(155deg, #24526c, #1e2f3a);
}

.action-card.defense {
  background: linear-gradient(155deg, #5c3b74, #2d2238);
}

.action-card strong {
  display: block;
  margin-bottom: 6px;
  line-height: 1.15;
}

.action-card span {
  display: block;
  color: #ded3bd;
  font-size: 12px;
  line-height: 1.28;
}

.log-view {
  height: 218px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.45;
}

.log-view li:first-child {
  color: var(--white);
}

dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: var(--white);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .62);
}

.dialog-card {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(244, 234, 211, .16);
  border-radius: 10px;
  padding: 18px;
  background: #262117;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .5);
}

.dialog-card p {
  margin: 8px 0 14px;
  color: var(--muted);
}

.dialog-options {
  display: grid;
  gap: 8px;
}

@media (max-width: 920px) {
  .topbar,
  .control-deck {
    grid-template-columns: 1fr;
  }

  .score-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-scene {
    min-height: 620px;
  }

  .mine-table {
    transform: none;
  }

  .player-seat {
    width: 42vw;
    min-width: 0;
  }

  .player-seat.pos-1 { left: 24%; top: 53%; }
  .player-seat.pos-3 { right: 24%; top: 53%; }
  .player-seat.pos-2 { top: 31%; }
}

.card-art,
.mini-card-art {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 8px 18px rgba(0, 0, 0, .28);
}

.card-art {
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 9px;
}

.mini-card-art {
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 7px;
}

.card-art::after,
.mini-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, .34));
  pointer-events: none;
}

.action-card {
  padding: 8px;
}

.action-card strong {
  font-size: 13px;
}

.bonus-slot {
  width: 146px;
  min-height: 142px;
}

.card-art,
.mini-card-art {
  background-image: none;
  background-color: #15110d;
}

.card-art img,
.mini-card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hand {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.action-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.action-card .card-art {
  flex: 0 0 auto;
}

.action-card span:last-child {
  margin-top: auto;
}

.bonus-track {
  align-items: flex-start;
}

.bonus-slot .card-name {
  font-size: 11px;
}

.player-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.hand {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.action-card {
  min-height: 238px;
  padding: 7px;
}

.action-card .card-art {
  max-height: 146px;
}

.action-card strong {
  font-size: 12px;
}

.action-card span:last-child {
  font-size: 11px;
}

.mini-card-art {
  max-height: 112px;
}

.bonus-slot {
  width: 108px;
  min-height: 168px;
  padding: 6px;
}

.bonus-money {
  font-size: 16px;
}

.choice-option {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  background: #473a27;
}

.dialog-options {
  max-height: min(50vh, 360px);
  overflow: auto;
}

/* Quartz original-style cards */
.hand {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 12px;
  max-height: 348px;
}

.quartz-card {
  --card-face: #1d3567;
  --card-edge: #d2a440;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  width: 100%;
  aspect-ratio: 5 / 7;
  min-height: 0;
  padding: 10px 9px 9px 24px;
  border: 2px solid rgba(232, 180, 69, .78);
  border-radius: 7px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, .16), transparent 25%),
    linear-gradient(155deg, rgba(255, 255, 255, .08), transparent 36%),
    var(--card-face);
  color: #f8efd9;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .32), 0 11px 20px rgba(0, 0, 0, .34);
  text-align: left;
  transform-origin: center bottom;
}

button.quartz-card {
  cursor: pointer;
}

button.quartz-card:hover:not(:disabled) {
  transform: translateY(-4px) rotate(-1deg);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, .2), transparent 25%),
    linear-gradient(155deg, rgba(255, 255, 255, .1), transparent 36%),
    #23417b;
}

button.quartz-card:disabled {
  cursor: not-allowed;
  filter: grayscale(.22);
  opacity: .58;
}

.quartz-card.defense {
  --card-face: #4b1964;
}

.quartz-card.mini {
  width: 92px;
  padding: 7px 6px 6px 18px;
  border-width: 1px;
  pointer-events: none;
}

.card-bg-mark {
  position: absolute;
  inset: 8px 8px auto auto;
  width: 56%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, .06);
  border-radius: 16px;
  transform: rotate(28deg);
  opacity: .55;
}

.card-cost {
  position: absolute;
  z-index: 4;
  top: 5px;
  left: 7px;
  min-width: 18px;
  color: #f5dd8c;
  font-size: 12px;
  font-weight: 950;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .55);
}

.card-side-title {
  position: absolute;
  z-index: 4;
  left: 5px;
  top: 27px;
  bottom: 54px;
  width: 14px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  color: #f6e6bd;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.card-portrait {
  position: relative;
  z-index: 2;
  align-self: stretch;
  min-height: 0;
  margin: 2px 0 5px;
  border-radius: 4px;
  overflow: hidden;
}

.card-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(11, 13, 22, .45));
  pointer-events: none;
}

.card-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.card-runes {
  position: relative;
  z-index: 3;
  height: 13px;
  border: 1px solid rgba(210, 164, 64, .9);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  color: #d9ac4f;
  font-family: Georgia, serif;
  font-size: 8px;
  line-height: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  background: rgba(22, 20, 31, .88);
}

.card-effect-box {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  min-height: 45px;
  padding: 5px;
  border: 1px solid rgba(210, 164, 64, .95);
  border-radius: 0 0 4px 4px;
  background: rgba(18, 18, 27, .92);
}

.card-effect-icon {
  display: grid;
  place-items: center;
  align-self: start;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #f4eedb;
  color: #21345f;
  font-size: 14px;
  font-weight: 950;
}

.card-effect-text {
  display: -webkit-box;
  overflow: hidden;
  color: #f0e3c7;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.12;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.quartz-card.mini .card-cost {
  top: 3px;
  left: 5px;
  font-size: 9px;
}

.quartz-card.mini .card-side-title {
  left: 4px;
  top: 20px;
  bottom: 42px;
  width: 10px;
  font-size: 6px;
}

.quartz-card.mini .card-runes {
  height: 9px;
  font-size: 6px;
  line-height: 8px;
}

.quartz-card.mini .card-effect-box {
  grid-template-columns: 16px minmax(0, 1fr);
  min-height: 34px;
  gap: 3px;
  padding: 3px;
}

.quartz-card.mini .card-effect-icon {
  width: 16px;
  height: 16px;
  font-size: 10px;
}

.quartz-card.mini .card-effect-text {
  font-size: 6px;
  line-height: 1.08;
  -webkit-line-clamp: 4;
}

.bonus-slot {
  width: 106px;
  min-height: 170px;
  padding: 6px;
}

.bonus-slot .bonus-money {
  position: absolute;
  z-index: 6;
  right: 4px;
  top: 4px;
  min-width: 28px;
  border-radius: 999px;
  background: rgba(18, 16, 12, .82);
  text-align: center;
}

.action-card,
.card-art,
.mini-card-art {
  all: unset;
}

/* Table space and exit track redesign */
.app-shell {
  padding: 12px 16px;
  width: min(1500px, 100%);
}

.topbar {
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 72px;
}

.score-strip {
  display: none;
}

h1 {
  font-size: clamp(34px, 4.6vw, 58px);
}

.table-scene {
  height: min(68vh, 760px);
  min-height: 540px;
  margin: 8px 0 12px;
}

.mine-table {
  transform: rotateX(5deg);
}

.bonus-track {
  top: 34px;
  left: 50%;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(3, 100px);
  gap: 10px;
  padding: 30px 12px 12px;
  border: 1px solid rgba(224, 186, 89, .36);
  border-radius: 12px;
  background: rgba(18, 16, 12, .58);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .36);
  transform: translateX(-50%) translateZ(70px);
}

.bonus-title {
  position: absolute;
  top: 7px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.bonus-title span {
  color: var(--muted);
  font-size: 10px;
}

.bonus-slot {
  position: relative;
  width: 100px;
  min-height: 152px;
  padding: 4px;
  display: grid;
  place-items: center;
}

.bonus-slot.empty {
  min-height: 152px;
  border-style: dashed;
}

.bonus-slot.empty span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.quartz-card.mini {
  width: 86px;
}

.bonus-slot .bonus-money {
  right: -5px;
  top: -7px;
}

.bag {
  top: 50%;
  left: 50%;
  width: 118px;
  height: 102px;
  border-radius: 46% 46% 38% 38%;
  background:
    radial-gradient(circle at 44% 26%, rgba(224, 186, 89, .18), transparent 24%),
    linear-gradient(145deg, #70542f, #2b2115 78%);
  transform: translate(-50%, -25%) translateZ(38px);
}

.bag::before {
  content: "Saco da mina";
  position: absolute;
  top: -24px;
  left: 50%;
  width: 120px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.bag-count {
  font-size: 30px;
}

.bag-label {
  bottom: 19px;
  width: 100%;
  font-size: 10px;
  text-align: center;
}

.bag-label::after {
  content: " restantes";
  text-transform: none;
}

.day-marker {
  right: 28px;
  top: 20px;
}

.player-seat {
  width: min(292px, 23vw);
  min-width: 230px;
  z-index: 6;
}

.player-seat.active {
  outline: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(224, 186, 89, .13), 0 16px 28px var(--shadow);
}

.player-seat.pos-0 {
  left: 50%;
  bottom: 12px;
}

.player-seat.pos-1 {
  left: 11%;
  top: 54%;
}

.player-seat.pos-2 {
  left: 16%;
  top: 18%;
}

.player-seat.pos-3 {
  right: 11%;
  top: 54%;
}

.player-head strong {
  margin-left: auto;
  color: var(--gold);
  font-size: 18px;
}

.cart {
  min-height: 78px;
}

.control-deck {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .45fr);
}

@media (max-width: 920px) {
  .table-scene {
    min-height: 720px;
  }

  .bonus-track {
    top: 18px;
    grid-template-columns: repeat(3, 84px);
    gap: 6px;
  }

  .quartz-card.mini {
    width: 72px;
  }

  .bonus-slot {
    width: 84px;
    min-height: 132px;
  }

  .bag {
    top: 50%;
  }

  .player-seat {
    width: 44vw;
    min-width: 0;
  }

  .player-seat.pos-2 {
    left: 24%;
    top: 31%;
  }
}

/* Card inspection */
.inspect-card {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid rgba(244, 234, 211, .18);
  border-radius: 12px;
  padding: 18px;
  background: #1e1a13;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58);
}

#inspectView {
  display: grid;
  place-items: center;
}

#inspectView .quartz-card {
  width: min(340px, 78vw);
  min-height: 0;
  pointer-events: none;
}

#inspectView .card-cost {
  font-size: 18px;
  top: 9px;
  left: 10px;
}

#inspectView .card-side-title {
  left: 8px;
  top: 42px;
  bottom: 92px;
  width: 20px;
  font-size: 12px;
}

#inspectView .card-runes {
  height: 22px;
  font-size: 12px;
  line-height: 21px;
}

#inspectView .card-effect-box {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  min-height: 88px;
  padding: 10px;
}

#inspectView .card-effect-icon {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

#inspectView .card-effect-text {
  display: block;
  overflow: visible;
  font-size: 15px;
  line-height: 1.25;
  -webkit-line-clamp: unset;
}

.inspect-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.inspect-actions button:first-child {
  background: #6b4d1e;
  border-color: rgba(224, 186, 89, .72);
  color: #ffe6a3;
}

/* Inspection parity and hover overflow fixes */
.panel,
.human-panel,
.control-deck,
.hand,
.bonus-track,
.bonus-slot {
  overflow: visible;
}

.human-panel {
  position: relative;
  z-index: 12;
}

.hand {
  max-height: none;
  padding: 8px 8px 14px;
}

.quartz-card {
  will-change: transform;
}

button.quartz-card:hover:not(:disabled) {
  z-index: 20;
}

#inspectView .quartz-card {
  width: min(340px, 78vw);
  pointer-events: none;
}

#inspectView .card-cost,
#inspectView .card-side-title,
#inspectView .card-runes,
#inspectView .card-effect-box,
#inspectView .card-effect-icon,
#inspectView .card-effect-text {
  font-size: revert;
  line-height: revert;
}

#inspectView .card-cost {
  top: 5px;
  left: 7px;
  font-size: 12px;
}

#inspectView .card-side-title {
  left: 5px;
  top: 27px;
  bottom: 54px;
  width: 14px;
  font-size: 8px;
}

#inspectView .card-runes {
  height: 13px;
  font-size: 8px;
  line-height: 12px;
}

#inspectView .card-effect-box {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  min-height: 45px;
  padding: 5px;
}

#inspectView .card-effect-icon {
  width: 23px;
  height: 23px;
  font-size: 14px;
}

#inspectView .card-effect-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.12;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

@media (max-height: 780px) {
  .hand {
    max-height: 330px;
    overflow: auto;
  }
}

/* True proportional card zoom in inspect modal */
.inspect-card {
  width: min(420px, calc(100vw - 28px));
}

#inspectView {
  min-height: 430px;
  overflow: visible;
}

#inspectView .quartz-card {
  width: 170px;
  transform: scale(2);
  transform-origin: center center;
  pointer-events: none;
}

#inspectView .card-cost {
  top: 5px;
  left: 7px;
  font-size: 12px;
}

#inspectView .card-side-title {
  left: 5px;
  top: 27px;
  bottom: 54px;
  width: 14px;
  font-size: 8px;
}

#inspectView .card-runes {
  height: 13px;
  font-size: 8px;
  line-height: 12px;
}

#inspectView .card-effect-box {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  min-height: 45px;
  padding: 5px;
}

#inspectView .card-effect-icon {
  width: 23px;
  height: 23px;
  font-size: 14px;
}

#inspectView .card-effect-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.12;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

@media (max-width: 460px) {
  #inspectView {
    min-height: 380px;
  }

  #inspectView .quartz-card {
    width: 150px;
    transform: scale(1.8);
  }
}

/* Larger inspection shell around zoomed card */
.inspect-card {
  width: min(560px, calc(100vw - 24px));
  min-height: min(760px, calc(100vh - 28px));
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  padding: 34px 32px 20px;
}

#inspectView {
  min-height: 590px;
  width: 100%;
  padding-top: 14px;
}

.inspect-actions {
  width: 100%;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(244, 234, 211, .12);
}

@media (max-height: 820px) {
  .inspect-card {
    min-height: calc(100vh - 24px);
    padding-top: 22px;
  }

  #inspectView {
    min-height: 520px;
  }
}

@media (max-width: 460px) {
  .inspect-card {
    width: calc(100vw - 18px);
    min-height: calc(100vh - 18px);
    padding: 18px 16px;
  }
}

.quartz-card.mini.inspectable {
  pointer-events: auto;
  cursor: zoom-in;
}

.quartz-card.mini.inspectable:hover {
  transform: translateY(-3px) rotate(-1deg);
  z-index: 30;
}

/* Defense cards keep purple hover and show counter target */
.quartz-card {
  --card-hover: #23417b;
}

.quartz-card.defense {
  --card-face: #4b1964;
  --card-hover: #642083;
}

button.quartz-card:hover:not(:disabled) {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, .2), transparent 25%),
    linear-gradient(155deg, rgba(255, 255, 255, .1), transparent 36%),
    var(--card-hover);
}

.card-defense-target {
  position: absolute;
  z-index: 5;
  top: 7px;
  right: 9px;
  left: 31px;
  height: 16px;
  overflow: hidden;
  color: #f4dd9d;
  font-size: 7px;
  font-weight: 950;
  line-height: 16px;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .55);
}

.quartz-card.defense .card-portrait {
  margin-top: 17px;
}

.quartz-card.mini .card-defense-target {
  top: 5px;
  right: 6px;
  left: 24px;
  height: 11px;
  font-size: 5px;
  line-height: 11px;
}

.quartz-card.mini.defense .card-portrait {
  margin-top: 12px;
}

.card-defense-target {
  font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive;
  font-size: 9px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.quartz-card.mini .card-defense-target {
  font-size: 6px;
}

.card-defense-target {
  font-size: 7px;
}

.quartz-card.mini .card-defense-target {
  font-size: 5px;
}

/* Original-like card pictograms */
.card-effect-icon {
  overflow: visible;
}

.card-effect-icon svg {
  width: 86%;
  height: 86%;
  display: block;
}

.card-effect-icon .i-hand,
.card-effect-icon .i-shield,
.card-effect-icon .i-box,
.card-effect-icon .i-lid,
.card-effect-icon .i-moon {
  fill: #fff6dc;
  stroke: #24305f;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.card-effect-icon .i-tool,
.card-effect-icon .i-arrow,
.card-effect-icon .i-x,
.card-effect-icon .i-z {
  fill: none;
  stroke: #fff6dc;
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-effect-icon .i-arrow {
  stroke: #fff6dc;
  fill: #fff6dc;
}

.card-effect-icon .i-gem,
.card-effect-icon .i-spark,
.card-effect-icon .i-burst,
.card-effect-icon .i-stone {
  stroke: #24305f;
  stroke-width: 2;
  stroke-linejoin: round;
}

.card-effect-icon .i-gem.blue { fill: #54b7ff; }
.card-effect-icon .i-gem.green { fill: #7ee06f; }
.card-effect-icon .i-gem.red { fill: #ff5b5b; }
.card-effect-icon .i-gem.purple { fill: #b961ff; }
.card-effect-icon .i-spark { fill: #ffe66b; }
.card-effect-icon .i-spark.small { fill: #ffe66b; stroke-width: 1.5; }
.card-effect-icon .i-burst { fill: #ffdb5c; }
.card-effect-icon .i-stone { fill: #322a3a; stroke: #c752ff; }
.card-effect-icon .i-crack { fill: none; stroke: #d36cff; stroke-width: 3; stroke-linecap: round; }
.card-effect-icon .i-z { stroke-width: 3.2; }
.card-effect-icon .i-z.smallz { stroke-width: 2.4; }

#inspectView .card-effect-icon svg {
  width: 86%;
  height: 86%;
}

/* End-of-day sale phase */
.sale-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  border: 1px solid rgba(224, 186, 89, .35);
  border-radius: 10px;
  padding: 14px;
  background: rgba(22, 18, 12, .82);
}

.sale-head,
.sale-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sale-head h3 {
  margin: 0;
  color: var(--gold);
  font-size: 20px;
}

.sale-head p,
.sale-foot span,
.sale-chest,
.sale-empty {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.sale-preview {
  min-width: 104px;
  border: 1px solid rgba(224, 186, 89, .4);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: right;
  background: rgba(0, 0, 0, .22);
}

.sale-preview strong {
  display: block;
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
}

.sale-preview span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.sale-chest {
  min-height: 32px;
  border-top: 1px dashed rgba(244, 234, 211, .16);
  border-bottom: 1px dashed rgba(244, 234, 211, .16);
  padding: 8px 0;
}

.sale-crystals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
}

.sale-crystal {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  min-height: 64px;
  padding: 8px;
  text-align: left;
  background: rgba(48, 39, 27, .92);
}

.sale-crystal .crystal {
  grid-row: span 2;
}

.sale-crystal strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.sale-crystal small {
  color: var(--muted);
  font-weight: 800;
}

.sale-crystal.keep {
  border-color: rgba(94, 167, 216, .8);
  background: rgba(31, 63, 87, .9);
}

.sale-crystal.sell {
  border-color: rgba(224, 186, 89, .34);
}

#confirmSaleBtn {
  min-width: 150px;
  background: #6b4d1e;
  border-color: rgba(224, 186, 89, .72);
  color: #ffe6a3;
}

.sale-section-title {
  margin-top: 2px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.sale-chest-list {
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(244, 234, 211, .14);
}

.sale-crystal.chest-choice.keep {
  border-color: rgba(94, 167, 216, .8);
  background: rgba(31, 63, 87, .9);
}

.sale-crystal.chest-choice.sell {
  border-color: rgba(224, 186, 89, .7);
  background: rgba(76, 52, 25, .95);
}

/* Visual choice modal options */
.choice-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.choice-option > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-drawing {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(224, 186, 89, .35);
  border-radius: 8px;
  background: rgba(12, 12, 18, .42);
}

.choice-drawing .crystal {
  width: 20px;
  height: 20px;
}

.choice-drawing svg {
  width: 28px;
  height: 28px;
}

.choice-drawing.player-mark span {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 45% 45%;
  background: linear-gradient(#f2d28b 0 45%, #6d4b2a 46% 100%);
  box-shadow: 0 12px 0 -5px #2f6f8d;
}

.choice-drawing.defense-mark svg path:first-child {
  fill: #fff6dc;
  stroke: #4b1964;
  stroke-width: 2.3;
  stroke-linejoin: round;
}

.choice-drawing.defense-mark svg path:last-child {
  fill: none;
  stroke: #6eea8b;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choice-drawing.cancel-mark svg path {
  fill: none;
  stroke: #f07b69;
  stroke-width: 5;
  stroke-linecap: round;
}

.choice-drawing.generic-mark span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--gold);
  transform: rotate(45deg);
}

/* Suspense mining reveal */
.mining-reveal {
  position: absolute;
  z-index: 40;
  left: 50%;
  top: 52%;
  display: grid;
  grid-template-columns: 72px minmax(150px, auto) 62px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(224, 186, 89, .58);
  border-radius: 14px;
  background: rgba(18, 15, 10, .9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .58), inset 0 0 0 1px rgba(255, 255, 255, .06);
  transform: translate(-50%, -50%) translateZ(120px);
  pointer-events: none;
}

.reveal-bag {
  width: 66px;
  height: 58px;
  border-radius: 44% 44% 35% 35%;
  background: linear-gradient(145deg, #735832, #2d2114 76%);
  box-shadow: inset 0 -12px 20px rgba(0, 0, 0, .42);
  animation: bagShake .18s infinite alternate;
}

.reveal-bag span {
  display: block;
  width: 42px;
  height: 10px;
  margin: 7px auto 0;
  border-radius: 999px;
  background: #1b140c;
}

.mining-reveal.revealed .reveal-bag {
  animation: none;
}

.reveal-text strong,
.reveal-text span {
  display: block;
}

.reveal-text strong {
  color: var(--gold);
  font-size: 18px;
}

.reveal-text span {
  margin-top: 4px;
  color: var(--white);
  font-size: 14px;
  font-weight: 850;
}

.reveal-crystal-slot {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.reveal-crystal-slot .crystal {
  width: 30px;
  height: 30px;
  animation: revealPop .38s ease-out both;
}

.mystery-stone {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d1a16;
  color: var(--gold);
  font-size: 22px;
  font-weight: 950;
  animation: mysteryPulse .55s infinite alternate;
}

@keyframes bagShake {
  from { transform: rotate(-4deg) translateX(-2px); }
  to { transform: rotate(4deg) translateX(2px); }
}

@keyframes mysteryPulse {
  from { transform: scale(.92); opacity: .65; }
  to { transform: scale(1.08); opacity: 1; }
}

@keyframes revealPop {
  from { transform: scale(.2) rotate(45deg); opacity: 0; }
  to { transform: scale(1) rotate(45deg); opacity: 1; }
}

/* Final winner banner */
.winner-banner {
  position: absolute;
  z-index: 80;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100% - 32px));
  padding: 24px;
  border: 2px solid rgba(224, 186, 89, .78);
  border-radius: 16px;
  background: radial-gradient(circle at 50% 0%, rgba(224, 186, 89, .18), transparent 40%), rgba(20, 16, 10, .95);
  box-shadow: 0 32px 100px rgba(0, 0, 0, .68), inset 0 0 0 1px rgba(255, 255, 255, .08);
  text-align: center;
  transform: translate(-50%, -50%) translateZ(150px);
}

.winner-crown {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(224, 186, 89, .16);
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.winner-banner h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
}

.winner-banner p {
  margin-top: 8px;
  color: var(--white);
  font-size: 18px;
  font-weight: 850;
}

.winner-standings {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  text-align: left;
}

.winner-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 9px 11px;
  border: 1px solid rgba(244, 234, 211, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
}

.winner-row.is-winner {
  border-color: rgba(224, 186, 89, .72);
  background: rgba(224, 186, 89, .12);
}

.winner-row span,
.winner-row strong {
  font-weight: 950;
}

.winner-row strong {
  color: var(--gold);
}

.winner-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

/* Explicit action feed */
.action-panel {
  position: absolute;
  z-index: 38;
  right: 22px;
  bottom: 20px;
  width: min(360px, calc(100% - 44px));
  padding: 12px;
  border: 1px solid rgba(224, 186, 89, .52);
  border-radius: 12px;
  background: rgba(18, 15, 10, .9);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .48), inset 0 0 0 1px rgba(255, 255, 255, .06);
  transform: translateZ(96px);
  pointer-events: none;
}

.action-panel > strong {
  display: block;
  color: var(--gold);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 950;
}

.action-steps {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.action-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid rgba(244, 234, 211, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.action-step.latest {
  border-color: rgba(224, 186, 89, .42);
  background: rgba(224, 186, 89, .11);
  color: var(--white);
}

.action-step .crystal {
  width: 16px;
  height: 16px;
}

.action-dot {
  display: block;
  width: 10px;
  height: 10px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(224, 186, 89, .55);
}

@media (max-width: 760px) {
  .action-panel {
    right: 12px;
    bottom: 12px;
    width: min(320px, calc(100% - 24px));
  }
}

/* Livelier table and decision feedback */
.mine-table::before,
.mine-table::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mine-table::before {
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(94, 167, 216, .07) 19% 21%, transparent 22% 58%, rgba(88, 180, 123, .06) 59% 61%, transparent 62%),
    radial-gradient(ellipse at 50% 52%, rgba(224, 186, 89, .12), transparent 38%);
  mix-blend-mode: screen;
}

.mine-table::after {
  border: 1px solid rgba(224, 186, 89, .16);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(244, 234, 211, .04), inset 0 -40px 90px rgba(0, 0, 0, .24);
}

.score-card {
  position: relative;
  overflow: hidden;
  min-height: 82px;
}

.score-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--green);
  opacity: .78;
}

.score-card.danger::before { background: var(--amber); }
.score-card.accident::before { background: var(--red); }
.score-card.out { opacity: .68; }

.score-card.active {
  outline: 0;
  border-color: rgba(224, 186, 89, .82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .34), 0 0 0 1px rgba(224, 186, 89, .32);
}

.score-radar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(244, 234, 211, .14);
  border-radius: 999px;
  background: rgba(88, 180, 123, .13);
  color: #bde8cc;
}

.risk-chip.danger {
  background: rgba(241, 154, 62, .14);
  color: #ffd79d;
}

.risk-chip.accident {
  background: rgba(216, 90, 85, .16);
  color: #ffb4ae;
}

.turn-beacon {
  position: absolute;
  z-index: 37;
  left: 22px;
  bottom: 20px;
  width: min(340px, calc(100% - 44px));
  padding: 12px 14px;
  border: 1px solid rgba(244, 234, 211, .16);
  border-left: 4px solid var(--blue);
  border-radius: 12px;
  background: rgba(18, 15, 10, .88);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .42), inset 0 0 0 1px rgba(255, 255, 255, .05);
  transform: translateZ(92px);
  pointer-events: none;
}

.turn-beacon.human {
  border-left-color: var(--gold);
}

.turn-beacon > span,
.turn-beacon small,
.turn-risk em {
  display: block;
}

.turn-beacon > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.turn-beacon strong {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 22px;
  line-height: 1.05;
}

.turn-beacon small {
  margin-top: 5px;
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.turn-risk {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.turn-risk i {
  height: 5px;
  border-radius: 999px;
  background: rgba(88, 180, 123, .72);
}

.turn-risk.danger i:nth-child(2),
.turn-risk.danger i:nth-child(3) {
  background: rgba(216, 90, 85, .76);
}

.turn-risk em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.player-seat {
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

.player-seat.active {
  border-color: rgba(224, 186, 89, .9);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .48), 0 0 0 1px rgba(224, 186, 89, .45), 0 0 24px rgba(224, 186, 89, .14);
}

.player-seat.has-unstable:not(.accident) {
  border-color: rgba(241, 154, 62, .64);
}

.player-seat.accident {
  border-color: rgba(216, 90, 85, .85);
  background: rgba(43, 22, 20, .92);
}

.player-seat.out-seat {
  opacity: .68;
}

.crystal-row:empty::before,
.chest-row:empty::before {
  content: "vazio";
  color: rgba(183, 169, 139, .42);
  font-size: 11px;
  font-weight: 850;
}

.card-state-chip {
  position: absolute;
  z-index: 6;
  right: 6px;
  top: 6px;
  max-width: calc(100% - 34px);
  padding: 3px 6px;
  border: 1px solid rgba(244, 234, 211, .18);
  border-radius: 999px;
  background: rgba(16, 17, 24, .82);
  color: var(--muted);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.quartz-card.playable {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .32), 0 12px 24px rgba(0, 0, 0, .36), 0 0 0 2px rgba(224, 186, 89, .34);
}

.quartz-card.playable .card-state-chip {
  border-color: rgba(224, 186, 89, .68);
  background: rgba(224, 186, 89, .2);
  color: #ffe6a5;
}

.quartz-card.muted:not(.defense) {
  filter: saturate(.72) brightness(.9);
}

.quartz-card.defense .card-state-chip {
  border-color: rgba(220, 112, 181, .48);
  background: rgba(82, 28, 100, .72);
  color: #f2c6ea;
}

.actions button:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(224, 186, 89, .12), 0 8px 18px rgba(0, 0, 0, .24);
}

.actions button:not(:disabled):first-child {
  border-color: rgba(224, 186, 89, .52);
  background: linear-gradient(180deg, #574326, #3b3022);
}

.log-view li:first-child {
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(224, 186, 89, .08);
}

@media (max-width: 920px) {
  .turn-beacon {
    left: 12px;
    bottom: 12px;
    width: min(300px, calc(100% - 24px));
  }

  .score-card {
    min-height: 74px;
  }
}

.choice-drawing.hidden-crystal-mark span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 6px 6px 9px 9px;
  background: linear-gradient(145deg, #39352f, #11100e);
  border: 1px solid rgba(244, 234, 211, .18);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, .08), 0 5px 14px rgba(0, 0, 0, .42);
  transform: rotate(45deg);
}

.choice-option:has(.hidden-crystal-mark) {
  background: linear-gradient(180deg, rgba(62, 52, 37, .96), rgba(31, 27, 21, .96));
}

/* Mine-cart player seats */
.player-seat {
  border: 0;
  border-radius: 8px 8px 18px 18px;
  padding: 12px 14px 18px;
  background:
    linear-gradient(180deg, #243c55 0 12px, transparent 12px),
    linear-gradient(165deg, rgba(111, 63, 34, .96), rgba(64, 38, 24, .96) 65%, rgba(36, 27, 22, .98));
  box-shadow: inset 0 -8px 0 rgba(23, 32, 43, .95), inset 0 0 0 1px rgba(244, 234, 211, .08), 0 18px 34px rgba(0, 0, 0, .42);
  clip-path: polygon(5% 8%, 95% 0, 89% 82%, 12% 92%);
}

.player-seat::before,
.player-seat::after {
  content: "";
  position: absolute;
  bottom: -5px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 42%, #26384a 0 32%, #101820 34% 62%, #050607 64%);
  border: 3px solid rgba(22, 27, 33, .95);
  box-shadow: inset 0 0 0 2px rgba(94, 167, 216, .16), 0 6px 14px rgba(0, 0, 0, .38);
  clip-path: none;
}

.player-seat::before { left: 18%; }
.player-seat::after { right: 18%; }

.player-head,
.player-stats,
.cart {
  position: relative;
  z-index: 2;
}

.player-head {
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(244, 234, 211, .16);
}

.player-seat .badge {
  background: rgba(20, 26, 34, .72);
}

.player-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  color: #f0dec0;
}

.player-seat .cart {
  min-height: 78px;
  border-color: rgba(16, 19, 24, .52);
  border-radius: 7px;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 9px),
    rgba(34, 24, 18, .78);
  box-shadow: inset 0 0 0 1px rgba(244, 234, 211, .06);
}

.player-seat.active {
  filter: brightness(1.1);
}

.player-seat.has-unstable:not(.accident) {
  background:
    linear-gradient(180deg, #243c55 0 12px, transparent 12px),
    linear-gradient(165deg, rgba(121, 72, 33, .98), rgba(72, 42, 23, .98) 65%, rgba(38, 27, 21, .98));
}

.player-seat.accident {
  background:
    linear-gradient(180deg, #30323a 0 12px, transparent 12px),
    linear-gradient(165deg, rgba(91, 33, 30, .98), rgba(48, 25, 23, .98));
}

/* Better sale table */
.refined-sale {
  max-width: none;
}

.sale-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 14px;
  align-items: start;
}

.sale-pickers,
.sale-combos {
  min-width: 0;
}

.sale-combos {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(244, 234, 211, .12);
  border-radius: 10px;
  background: rgba(12, 12, 14, .32);
}

.sale-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(244, 234, 211, .11);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
}

.sale-combo.best {
  border-color: rgba(224, 186, 89, .72);
  background: rgba(224, 186, 89, .12);
}

.sale-combo strong,
.sale-combo em {
  color: var(--white);
  font-weight: 950;
}

.sale-combo.best strong,
.sale-combo.best em {
  color: var(--gold);
}

.sale-combo span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.sale-combo em {
  font-style: normal;
  font-size: 20px;
}

@media (max-width: 860px) {
  .sale-layout {
    grid-template-columns: 1fr;
  }

  .player-seat {
    clip-path: polygon(4% 6%, 96% 0, 92% 86%, 10% 94%);
  }
}

/* Mine-cart v2: explicit body, rim and wheels */
.player-seat.mine-cart-seat {
  width: min(300px, 25vw);
  min-width: 230px;
  padding: 0 0 30px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  clip-path: none !important;
  overflow: visible;
  filter: none;
}

.player-seat.mine-cart-seat::before,
.player-seat.mine-cart-seat::after {
  content: none;
}

.mine-cart-body {
  position: relative;
  min-height: 156px;
  padding: 22px 18px 18px;
  border-radius: 8px 8px 18px 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 24px),
    linear-gradient(165deg, #7a4324 0%, #5b321d 56%, #332219 100%);
  box-shadow: inset 0 -10px 0 rgba(18, 27, 36, .92), inset 0 0 0 2px rgba(35, 22, 15, .75), 0 16px 30px rgba(0, 0, 0, .42);
  clip-path: polygon(3% 10%, 98% 0, 91% 86%, 11% 98%);
}

.mine-cart-body::before,
.mine-cart-body::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.mine-cart-body::before {
  left: 8%;
  right: 9%;
  top: 47px;
  height: 2px;
  background: rgba(20, 12, 8, .44);
  box-shadow: 0 27px 0 rgba(20, 12, 8, .32), 0 54px 0 rgba(20, 12, 8, .28);
}

.mine-cart-body::after {
  left: 13%;
  right: 16%;
  bottom: 12px;
  height: 7px;
  border-radius: 999px;
  background: rgba(17, 24, 31, .86);
}

.mine-cart-rim {
  position: absolute;
  z-index: 4;
  left: 2%;
  right: 0;
  top: 0;
  height: 15px;
  border-radius: 3px;
  background: linear-gradient(180deg, #315a7f, #162d43);
  box-shadow: 0 3px 0 rgba(6, 10, 13, .6), inset 0 1px 0 rgba(255, 255, 255, .18);
  transform: skewX(-7deg);
}

.mine-cart-seat .player-head,
.mine-cart-seat .player-stats,
.mine-cart-seat .cart {
  position: relative;
  z-index: 5;
}

.mine-cart-seat .player-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 0 2px 7px;
  border-bottom: 1px solid rgba(244, 234, 211, .22);
  color: #fff0d0;
  text-shadow: 0 2px 2px rgba(0, 0, 0, .45);
}

.mine-cart-seat .player-head > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mine-cart-seat .player-head strong {
  color: var(--gold);
  font-size: 18px;
}

.mine-cart-seat .badge {
  align-self: center;
  background: rgba(21, 30, 38, .88);
  border: 1px solid rgba(94, 167, 216, .25);
}

.mine-cart-seat .player-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  color: #f5deb7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .48);
}

.mine-cart-seat .cart {
  min-height: 64px;
  margin-top: 8px;
  border: 1px solid rgba(31, 18, 11, .58);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .34)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 10px);
  box-shadow: inset 0 0 0 1px rgba(244, 234, 211, .045);
}

.mine-cart-axle {
  position: absolute;
  z-index: 1;
  left: 16%;
  right: 16%;
  bottom: 19px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1d2e3d, #0b1218);
  box-shadow: 0 4px 9px rgba(0, 0, 0, .45);
}

.mine-cart-wheel {
  position: absolute;
  z-index: 2;
  bottom: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #457195 0 15%, #152431 17% 36%, #263b4c 38% 54%, #07090b 57% 100%);
  border: 5px solid #111820;
  box-shadow: inset 0 0 0 2px rgba(94, 167, 216, .2), 0 7px 12px rgba(0, 0, 0, .5);
}

.mine-cart-wheel::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #0d1319;
  box-shadow: 0 0 0 2px rgba(94, 167, 216, .28);
}

.mine-cart-wheel.wheel-left { left: 18%; }
.mine-cart-wheel.wheel-right { right: 18%; }

.mine-cart-seat.active .mine-cart-body {
  box-shadow: inset 0 -10px 0 rgba(18, 27, 36, .92), inset 0 0 0 2px rgba(35, 22, 15, .75), 0 18px 36px rgba(0, 0, 0, .48), 0 0 0 2px rgba(224, 186, 89, .5), 0 0 24px rgba(224, 186, 89, .16);
}

.mine-cart-seat.has-unstable:not(.accident) .mine-cart-body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 24px),
    linear-gradient(165deg, #854a24 0%, #663818 56%, #342017 100%);
}

.mine-cart-seat.accident .mine-cart-body {
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 24px),
    linear-gradient(165deg, #692d2b 0%, #40201e 60%, #211514 100%);
}

.mine-cart-seat.out-seat {
  opacity: .72;
}

@media (max-width: 920px) {
  .player-seat.mine-cart-seat {
    width: 44vw;
    min-width: 210px;
  }

  .mine-cart-body {
    min-height: 150px;
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Mine-cart size fix */
.player-seat.mine-cart-seat {
  width: min(340px, 29vw);
  min-width: 270px;
  padding-bottom: 42px;
}

.mine-cart-body {
  min-height: 190px;
  padding: 26px 22px 24px;
}

.mine-cart-seat .cart {
  min-height: 88px;
}

.mine-cart-axle {
  bottom: 27px;
  left: 15%;
  right: 15%;
}

.mine-cart-wheel {
  bottom: 4px;
  width: 54px;
  height: 54px;
}

.mine-cart-wheel.wheel-left { left: 17%; }
.mine-cart-wheel.wheel-right { right: 17%; }

@media (max-width: 920px) {
  .player-seat.mine-cart-seat {
    width: min(360px, 48vw);
    min-width: 250px;
    padding-bottom: 38px;
  }

  .mine-cart-body {
    min-height: 178px;
  }
}

/* Mine-cart compact tuning */
.player-seat.mine-cart-seat {
  width: min(305px, 26vw);
  min-width: 238px;
  padding-bottom: 34px;
}

.mine-cart-body {
  min-height: 162px;
  padding: 22px 17px 18px;
}

.mine-cart-seat .player-head {
  gap: 7px;
  padding-bottom: 5px;
}

.mine-cart-seat .player-head strong {
  font-size: 16px;
}

.mine-cart-seat .badge {
  padding: 2px 7px;
  font-size: 11px;
}

.mine-cart-seat .player-stats {
  gap: 3px;
  margin-top: 5px;
  font-size: 10px;
}

.mine-cart-seat .cart {
  min-height: 66px;
  margin-top: 6px;
  padding: 6px;
}

.mine-cart-seat .crystal-row,
.mine-cart-seat .chest-row {
  min-height: 20px;
  gap: 4px;
}

.mine-cart-seat .chest-row {
  margin-top: 5px;
  padding-top: 5px;
}

.mine-cart-seat .crystal {
  width: 18px;
  height: 18px;
}

.mine-cart-seat .crystal::after {
  width: 6px;
  height: 6px;
  margin: 3px;
}

.mine-cart-axle {
  bottom: 22px;
}

.mine-cart-wheel {
  bottom: 2px;
  width: 44px;
  height: 44px;
}

.mine-cart-wheel::after {
  inset: 12px;
}

@media (max-width: 920px) {
  .player-seat.mine-cart-seat {
    width: min(318px, 45vw);
    min-width: 230px;
    padding-bottom: 32px;
  }

  .mine-cart-body {
    min-height: 158px;
    padding: 21px 15px 17px;
  }
}

/* Mine-cart width tuning */
.player-seat.mine-cart-seat {
  width: min(340px, 30vw);
  min-width: 278px;
}

@media (max-width: 920px) {
  .player-seat.mine-cart-seat {
    width: min(350px, 50vw);
    min-width: 260px;
  }
}

/* Mine-cart inner side padding */
.mine-cart-body {
  padding-left: 26px;
  padding-right: 26px;
}

@media (max-width: 920px) {
  .mine-cart-body {
    padding-left: 22px;
    padding-right: 22px;
  }
}

/* Mine-cart extra inner side padding */
.mine-cart-body {
  padding-left: 34px;
  padding-right: 34px;
}

@media (max-width: 920px) {
  .mine-cart-body {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* Active mine-cart glow and sale UX overhaul */
.player-seat.mine-cart-seat.active {
  outline: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

.player-seat.mine-cart-seat.active::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 48%;
  width: 112%;
  height: 96%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(224, 186, 89, .34), rgba(224, 186, 89, .14) 34%, transparent 72%);
  transform: translate(-50%, -50%);
  filter: blur(10px);
  pointer-events: none;
}

.player-seat.mine-cart-seat.active .mine-cart-body {
  box-shadow: inset 0 -10px 0 rgba(18, 27, 36, .92), inset 0 0 0 2px rgba(35, 22, 15, .75), 0 18px 36px rgba(0, 0, 0, .5), 0 0 34px rgba(224, 186, 89, .24);
}

.control-deck:has(.sale-panel) {
  grid-template-columns: minmax(0, 1fr);
}

.control-deck:has(.sale-panel) .log-panel {
  display: none;
}

.human-panel:has(.sale-panel) {
  padding: 16px;
}

.hand:has(.sale-panel) {
  display: block;
  max-height: none;
  overflow: visible;
  padding: 0;
}

.sale-panel.refined-sale {
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(224, 186, 89, .26);
  border-radius: 12px;
  background:
    radial-gradient(circle at 18% 0, rgba(224, 186, 89, .13), transparent 28%),
    linear-gradient(180deg, rgba(37, 31, 22, .96), rgba(22, 19, 15, .98));
  box-shadow: inset 0 0 0 1px rgba(244, 234, 211, .05), 0 20px 50px rgba(0, 0, 0, .32);
}

.sale-panel.refined-sale .sale-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(244, 234, 211, .12);
}

.sale-panel.refined-sale .sale-head h3 {
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
}

.sale-panel.refined-sale .sale-head p {
  max-width: 680px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}

.sale-panel.refined-sale .sale-preview {
  min-width: 138px;
  padding: 12px 14px;
  border: 1px solid rgba(224, 186, 89, .55);
  border-radius: 10px;
  background: rgba(224, 186, 89, .1);
  text-align: center;
}

.sale-panel.refined-sale .sale-preview strong {
  display: block;
  color: var(--gold);
  font-size: 32px;
  line-height: 1;
}

.sale-panel.refined-sale .sale-preview span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.sale-panel.refined-sale .sale-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr);
  gap: 18px;
  align-items: stretch;
}

.sale-panel.refined-sale .sale-pickers,
.sale-panel.refined-sale .sale-combos {
  padding: 14px;
  border: 1px solid rgba(244, 234, 211, .11);
  border-radius: 10px;
  background: rgba(12, 12, 14, .28);
}

.sale-panel.refined-sale .sale-section-title {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sale-panel.refined-sale .sale-crystals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sale-panel.refined-sale .sale-crystal {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 3px 10px;
  align-items: center;
  min-height: 70px;
  padding: 10px 11px;
  border-radius: 9px;
  text-align: left;
}

.sale-panel.refined-sale .sale-crystal .crystal {
  grid-row: 1 / 3;
  width: 22px;
  height: 22px;
}

.sale-panel.refined-sale .sale-crystal strong {
  overflow: hidden;
  color: var(--white);
  font-size: 14px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-panel.refined-sale .sale-crystal small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.sale-panel.refined-sale .sale-combos {
  align-content: start;
  gap: 9px;
}

.sale-panel.refined-sale .sale-combo {
  min-height: 68px;
  padding: 11px 12px;
  border-radius: 9px;
}

.sale-panel.refined-sale .sale-combo.best {
  position: relative;
  border-color: rgba(224, 186, 89, .75);
  background: linear-gradient(180deg, rgba(224, 186, 89, .17), rgba(224, 186, 89, .08));
}

.sale-panel.refined-sale .sale-combo.best::before {
  content: "Melhor";
  position: absolute;
  right: 10px;
  top: -9px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: #2a2114;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.sale-panel.refined-sale .sale-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(244, 234, 211, .12);
}

.sale-panel.refined-sale .sale-foot button {
  min-width: 180px;
  border-color: rgba(224, 186, 89, .6);
  background: linear-gradient(180deg, #8b6427, #5b3d18);
}

@media (max-width: 860px) {
  .sale-panel.refined-sale .sale-head,
  .sale-panel.refined-sale .sale-layout,
  .sale-panel.refined-sale .sale-foot {
    grid-template-columns: 1fr;
  }

  .sale-panel.refined-sale .sale-preview,
  .sale-panel.refined-sale .sale-foot button {
    width: 100%;
  }
}
