:root {
  --bg: #111819;
  --bg-2: #172223;
  --panel: #1d2a2b;
  --panel-2: #223233;
  --felt: #126447;
  --felt-deep: #0a3e31;
  --wood: #5b3423;
  --gold: #d3a64f;
  --cream: #f7efd9;
  --cream-2: #eadfc4;
  --text: #f5f0e5;
  --muted: #a8b7b4;
  --line: rgba(255, 255, 255, 0.13);
  --shadow: rgba(0, 0, 0, 0.32);
  --danger: #dc4f4f;
  --blue: #2e75db;
  --red: #cf3d35;
  --yellow: #c99413;
  --black-tile: #171b1c;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(211, 166, 79, 0.1), transparent 28%),
    linear-gradient(135deg, #0f1718 0%, #192526 52%, #101718 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 24, 25, 0.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(211, 166, 79, 0.45);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #1d6b50, #0d3d33);
  display: grid;
  place-items: center;
  color: var(--cream);
  box-shadow: 0 10px 24px var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
}

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

.room-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.connection {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  line-height: 1;
}

.connection::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b9694;
}

.connection.online::before {
  background: #35d48b;
  box-shadow: 0 0 0 4px rgba(53, 212, 139, 0.12);
}

.connection.offline::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 79, 79, 0.12);
}

.room-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  min-height: 30px;
  border: 1px solid rgba(211, 166, 79, 0.28);
  border-radius: var(--radius);
  background: rgba(211, 166, 79, 0.08);
  color: var(--cream);
  font-weight: 700;
  font-size: 13px;
}

.icon-button,
.primary-button,
.ghost-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.primary-button {
  background: linear-gradient(180deg, #dbb65e, #b98228);
  color: #1b1308;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(211, 166, 79, 0.22);
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 700;
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.icon-button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
  transform: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.join-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(8, 18, 18, 0.76), rgba(8, 18, 18, 0.78)),
    url("/assets/table-felt.png") center / cover no-repeat;
}

.join-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(26, 38, 39, 0.92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  padding: 28px;
}

.join-panel h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.05;
}

.join-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field label,
.score-writer label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.score-writer input,
.score-writer select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.field input:focus,
.score-writer input:focus,
.score-writer select:focus {
  border-color: rgba(211, 166, 79, 0.72);
  box-shadow: 0 0 0 3px rgba(211, 166, 79, 0.12);
}

.join-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.join-actions .primary-button {
  flex: 1;
}

.game-layout {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
  padding: 18px;
}

.table-zone {
  position: relative;
  min-width: 0;
  min-height: 510px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(12, 20, 21, 0.76);
  overflow: hidden;
}

.table-surface {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background:
    linear-gradient(rgba(14, 54, 43, 0.2), rgba(10, 42, 35, 0.4)),
    url("/assets/table-felt.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 12px rgba(83, 47, 29, 0.7),
    inset 0 0 0 16px rgba(211, 166, 79, 0.15),
    0 24px 70px rgba(0, 0, 0, 0.34);
}

.table-surface::after {
  content: "";
  position: absolute;
  inset: 72px 96px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  pointer-events: none;
}

.seat {
  position: absolute;
  min-width: 154px;
  max-width: 210px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(13, 25, 26, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.seat.active {
  border-color: rgba(211, 166, 79, 0.78);
  box-shadow: 0 0 0 3px rgba(211, 166, 79, 0.13), 0 18px 34px rgba(0, 0, 0, 0.28);
}

.seat.bottom {
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
}

.seat.top {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.seat.left {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.seat.right {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.seat.empty {
  border-style: dashed;
  color: var(--muted);
}

.seat-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

.seat-name span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-score {
  color: var(--gold);
  white-space: nowrap;
}

.seat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.seat-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.seat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6f7d7a;
}

.seat-status.online::before {
  background: #35d48b;
}

.backs {
  display: flex;
  align-items: center;
  height: 28px;
  margin-top: 8px;
}

.tile-back {
  width: 19px;
  height: 26px;
  border-radius: 4px;
  margin-right: -9px;
  border: 1px solid rgba(247, 239, 217, 0.32);
  background: linear-gradient(145deg, #224f42, #0e2e2b);
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.26);
}

.center-stacks {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 58%);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
}

.stack-card {
  min-height: 122px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(4, 20, 18, 0.46);
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
}

.stack-card strong {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.wall-stack {
  width: 58px;
  height: 76px;
  border-radius: 7px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 7px),
    linear-gradient(145deg, #245444, #0b2f2c);
  border: 1px solid rgba(247, 239, 217, 0.38);
  display: grid;
  place-items: center;
  color: var(--cream);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.table-message {
  position: absolute;
  left: 50%;
  bottom: 105px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(211, 166, 79, 0.32);
  border-radius: var(--radius);
  background: rgba(17, 24, 25, 0.84);
  color: var(--text);
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.table-message span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.score-panel {
  min-height: 0;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel-section {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(29, 42, 43, 0.82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  padding: 14px;
}

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

.panel-title h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

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

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.score-row:first-of-type {
  border-top: 0;
}

.score-player {
  min-width: 0;
}

.score-player strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.score-player span {
  color: var(--muted);
  font-size: 12px;
}

.score-value {
  min-width: 54px;
  text-align: right;
  color: var(--gold);
  font-size: 20px;
  font-weight: 900;
}

.score-writer {
  display: grid;
  gap: 10px;
}

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

.event-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.event-list li {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.event-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.rack-dock {
  min-width: 0;
  padding: 0 18px 18px;
}

.rack-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(16, 25, 26, 0.92);
  box-shadow: 0 -8px 38px rgba(0, 0, 0, 0.28);
}

.rack-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.turn-label {
  min-width: 0;
}

.turn-label strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.turn-label span {
  color: var(--muted);
  font-size: 12px;
}

.sort-tools,
.action-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-tools .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.sort-tools .ghost-button.active {
  border-color: rgba(211, 166, 79, 0.58);
  background: rgba(211, 166, 79, 0.12);
}

.rack {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  min-height: 108px;
  overflow-x: auto;
  padding: 16px 14px 18px;
  scrollbar-color: rgba(211, 166, 79, 0.45) rgba(255, 255, 255, 0.06);
}

.rack::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 9px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #7d4b2f, #442718);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.14);
}

.tile {
  --tile-accent: var(--black-tile);
  position: relative;
  width: 48px;
  height: 70px;
  flex: 0 0 48px;
  border: 1px solid rgba(69, 48, 22, 0.24);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 36%),
    linear-gradient(180deg, var(--cream), var(--cream-2));
  color: var(--tile-accent);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 7px 5px 6px;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  z-index: 1;
}

.tile:hover {
  transform: translateY(-4px);
}

.tile.selected {
  transform: translateY(-13px);
  border-color: rgba(211, 166, 79, 0.9);
  box-shadow: 0 0 0 3px rgba(211, 166, 79, 0.18), 0 16px 26px rgba(0, 0, 0, 0.32);
}

.tile.small {
  width: 42px;
  height: 60px;
  flex-basis: 42px;
  cursor: default;
  transform: none;
}

.tile-number {
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
}

.tile.small .tile-number {
  font-size: 21px;
}

.tile-color {
  width: 20px;
  height: 4px;
  border-radius: 99px;
  background: var(--tile-accent);
}

.tile-red {
  --tile-accent: var(--red);
}

.tile-blue {
  --tile-accent: var(--blue);
}

.tile-yellow {
  --tile-accent: var(--yellow);
}

.tile-black {
  --tile-accent: var(--black-tile);
}

.tile.is-fake .tile-number {
  font-size: 20px;
}

.tile.is-okey::after,
.tile.is-fake::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(211, 166, 79, 0.18);
  content: "";
}

.tile.is-fake::after {
  background: #3f8cff;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.action-tools .primary-button,
.action-tools .ghost-button {
  min-height: 38px;
}

.action-tools .danger {
  border-color: rgba(220, 79, 79, 0.42);
  color: #ffc8c8;
}

.selected-readout {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  background: rgba(21, 31, 32, 0.96);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36);
  color: var(--text);
  z-index: 50;
}

.toast.error {
  border-color: rgba(220, 79, 79, 0.45);
}

.empty-rack {
  width: 100%;
  color: var(--muted);
  text-align: center;
  padding: 26px 10px;
  z-index: 1;
}

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

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

@media (max-width: 760px) {
  .topbar,
  .rack-toolbar,
  .action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .room-tools,
  .sort-tools,
  .action-tools {
    justify-content: flex-start;
  }

  .game-layout {
    padding: 12px;
  }

  .table-zone {
    min-height: 500px;
  }

  .table-surface {
    inset: 10px;
    border-radius: 22px;
  }

  .table-surface::after {
    inset: 94px 32px;
  }

  .seat {
    min-width: 132px;
    max-width: 164px;
  }

  .seat.left {
    left: 10px;
  }

  .seat.right {
    right: 10px;
  }

  .center-stacks {
    width: calc(100% - 44px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stack-card {
    min-height: 96px;
    padding: 7px;
  }

  .wall-stack {
    width: 48px;
    height: 66px;
    font-size: 17px;
  }

  .score-panel {
    grid-template-columns: 1fr;
  }

  .rack-dock {
    padding: 0 12px 12px;
  }

  .tile {
    width: 44px;
    height: 66px;
    flex-basis: 44px;
  }

  .tile-number {
    font-size: 23px;
  }
}

@media (max-width: 520px) {
  .join-panel {
    padding: 20px;
  }

  .join-panel h1 {
    font-size: 26px;
  }

  .seat {
    min-width: 112px;
    max-width: 128px;
    padding: 8px;
  }

  .seat.left,
  .seat.right {
    top: 70%;
  }

  .seat-name {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .seat-meta {
    font-size: 11px;
  }

  .backs {
    display: none;
  }

  .center-stacks {
    top: 44%;
  }

  .stack-card {
    min-height: 76px;
  }

  .stack-card strong {
    margin-top: 5px;
  }

  .table-message {
    bottom: 126px;
  }

  .action-tools .primary-button,
  .action-tools .ghost-button,
  .sort-tools .ghost-button {
    flex: 1 1 auto;
  }
}

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

/* PHP hosting build: finaloyun.png-inspired table */
.site-preview,
.php-game {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(31, 72, 67, 0.35), transparent 36%),
    linear-gradient(180deg, #0e1717 0%, #111c1c 54%, #0a1111 100%);
}

.final-topbar {
  min-height: 66px;
  padding: 10px 18px 10px 10px;
  background: #0d1718;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.final-brand {
  gap: 10px;
}

.menu-button {
  width: 46px;
  height: 46px;
  color: #d8c9a4;
  background: #112528;
}

.tile-logo {
  color: #e0ad49;
  font-weight: 900;
  font-size: 18px;
  background: radial-gradient(circle at 40% 35%, #193c38, #081415);
}

.top-join {
  display: grid;
  grid-template-columns: 180px 130px auto;
  gap: 10px;
  align-items: end;
}

.top-join label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.top-join input {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 10px;
}

.primary-button.compact {
  min-height: 34px;
  padding: 0 20px;
}

.final-room-tools .leave-button {
  min-height: 40px;
  padding-inline: 16px;
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--cream);
}

.php-join {
  min-height: calc(100vh - 66px);
  background:
    linear-gradient(rgba(8, 18, 18, 0.62), rgba(8, 18, 18, 0.8)),
    url("assets/table-felt.png") center / cover no-repeat;
}

.php-join-panel {
  width: min(760px, 100%);
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.mode-option input {
  margin-top: 3px;
  accent-color: var(--gold);
}

.mode-option strong,
.mode-option small {
  display: block;
}

.mode-option small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.php-game-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 18px 18px 0 10px;
}

.php-table-zone {
  min-height: 585px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.php-table-surface {
  inset: 20px 18px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(28, 117, 76, 0.18), rgba(2, 20, 17, 0.18) 67%, rgba(0, 0, 0, 0.45) 100%),
    url("assets/table-felt.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 11px rgba(71, 43, 25, 0.78),
    inset 0 0 0 15px rgba(198, 153, 64, 0.13),
    inset 0 22px 40px rgba(255, 255, 255, 0.07),
    0 26px 80px rgba(0, 0, 0, 0.45);
}

.php-table-surface::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 1px solid rgba(205, 168, 92, 0.12);
  pointer-events: none;
}

.php-center-stacks {
  width: min(420px, 38%);
}

.discard-drop {
  outline: 0 solid transparent;
}

.discard-drop:hover {
  outline: 2px solid rgba(211, 166, 79, 0.46);
}

.final-seat {
  min-width: 156px;
  background: rgba(6, 18, 19, 0.84);
  border-color: rgba(211, 166, 79, 0.22);
}

.final-seat.left,
.final-seat.right {
  top: 52%;
}

.final-seat.bottom {
  bottom: 18px;
}

.score-card-final .panel-title h2,
.ornate-title h2 {
  color: #f2c66c;
}

.php-side-panel {
  gap: 14px;
}

.mode-summary .panel-title span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-list {
  display: grid;
  gap: 8px;
}

.mode-badge {
  padding: 9px 10px;
  border: 1px solid rgba(211, 166, 79, 0.2);
  border-radius: var(--radius);
  background: rgba(211, 166, 79, 0.065);
}

.mode-badge strong,
.mode-badge span {
  display: block;
}

.mode-badge span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.final-rack-dock {
  padding: 18px;
}

.final-rack-panel {
  background: rgba(9, 20, 20, 0.92);
}

.final-rack {
  display: grid;
  grid-template-rows: repeat(2, 74px);
  gap: 6px;
  align-content: end;
  min-height: 166px;
  padding: 15px 14px 18px;
  overflow-x: auto;
  background:
    linear-gradient(180deg, transparent 0 47%, rgba(112, 65, 37, 0.65) 47% 53%, transparent 53%),
    rgba(4, 14, 14, 0.35);
}

.final-rack::before {
  left: 14px;
  right: 14px;
  bottom: 17px;
}

.rack-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: end;
  min-width: max-content;
}

.final-rack .tile {
  cursor: grab;
}

.final-rack .tile:active {
  cursor: grabbing;
}

.final-score-row {
  min-height: 41px;
}

@media (max-width: 1120px) {
  .top-join {
    grid-template-columns: minmax(120px, 1fr) minmax(90px, 120px) auto;
  }

  .php-game-layout {
    grid-template-columns: 1fr;
    padding-right: 10px;
  }
}

@media (max-width: 760px) {
  .final-topbar {
    align-items: stretch;
  }

  .top-join {
    grid-template-columns: 1fr;
  }

  .mode-picker {
    grid-template-columns: 1fr;
  }

  .php-table-zone {
    min-height: 520px;
  }

  .php-table-surface {
    inset: 10px;
    border-radius: 22px;
  }

  .php-center-stacks {
    width: calc(100% - 44px);
  }

  .final-rack {
    grid-template-rows: repeat(2, 70px);
  }
}

@media (max-width: 520px) {
  .final-seat {
    min-width: 112px;
    max-width: 128px;
  }

  .php-center-stacks {
    top: 42%;
  }

  .final-seat.left,
  .final-seat.right {
    top: 70%;
  }
}
