:root {
  --bg: #100906;
  --panel: rgba(255, 255, 255, 0.09);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.2);
  --text: #fff8ef;
  --muted: #ffd9b0;
  --orange: #ff8a1f;
  --orange-hot: #ff5f1f;
  --accent-rgb: 255, 138, 31;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(var(--accent-rgb), 0.26), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(var(--accent-rgb), 0.18), transparent 30%),
    linear-gradient(135deg, #160b07 0%, #0a0708 52%, #1b0d06 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.casino-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.home-link,
.admin-toggle,
.secondary-button,
.primary-button,
.card-tools button {
  min-height: 42px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.home-link:hover,
.admin-toggle:hover,
.secondary-button:hover,
.card-tools button:hover {
  transform: translateY(-2px);
  background: var(--panel-strong);
  border-color: rgba(255, 138, 31, 0.55);
}

h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(2.45rem, 7vw, 5.35rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.style-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.style-button span {
  font-size: 1.05rem;
}

.casino-layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.glass-panel,
.mini-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 90% 12%, rgba(var(--accent-rgb), 0.16), transparent 34%),
    rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.glass-panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-heading h2,
.mini-panel-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
}

.panel-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.color-control,
.inline-form,
.reward-grid {
  display: grid;
  gap: 10px;
}

.color-control {
  grid-template-columns: 1fr auto;
  align-items: center;
  color: #ffe9d2;
  font-weight: 800;
}

.color-control input[type="color"] {
  width: 58px;
  height: 42px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.inline-form {
  grid-template-columns: 1fr auto;
}

.inline-form.compact {
  grid-template-columns: 1fr auto;
  margin-top: 10px;
}

.inline-form input,
.reward-grid input {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 12px;
  outline: none;
}

.inline-form input:focus,
.reward-grid input:focus {
  border-color: rgba(var(--accent-rgb), 0.72);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.13);
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.player-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: #ffe7ce;
  font-weight: 800;
}

.player-pill i {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
}

.player-pill i img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.player-pill button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.25);
  cursor: pointer;
}

.reward-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reward-grid label {
  display: grid;
  gap: 8px;
  color: #ffe9d2;
  font-size: 0.82rem;
  font-weight: 900;
}

.leaderboard-panel {
  position: sticky;
  top: 18px;
}

.leaderboard-heading {
  align-items: center;
}

.leaderboard-list {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(82px, 110px) 30px;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 17px;
  background: rgba(0, 0, 0, 0.16);
}

.leaderboard-row div {
  display: grid;
  gap: 3px;
}

.leaderboard-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.leaderboard-edit {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px;
  color: #fff1dc;
  font-weight: 900;
}

.leaderboard-edit input {
  width: 100%;
  min-height: 34px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  padding: 6px 7px;
  font-weight: 800;
}

.leaderboard-delete {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #ffe9d2;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.leaderboard-delete-spacer {
  width: 30px;
  height: 30px;
}

.leaderboard-delete:hover,
.leaderboard-delete:focus-visible {
  border-color: rgba(255, 138, 31, 0.62);
  background: rgba(255, 138, 31, 0.18);
  outline: none;
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.admin-panel {
  margin-bottom: 28px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 138, 31, 0.09));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.admin-panel[hidden] {
  display: none;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-panel h2,
.admin-panel p {
  margin: 0;
}

.admin-panel h2 {
  font-size: 1.35rem;
}

.admin-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.password-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-form label {
  display: grid;
  gap: 8px;
  color: #ffe9d2;
  font-size: 0.88rem;
  font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.admin-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.admin-form textarea {
  min-height: 220px;
  resize: vertical;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: rgba(255, 138, 31, 0.78);
  box-shadow: 0 0 0 4px rgba(255, 138, 31, 0.14);
  background: rgba(0, 0, 0, 0.3);
}

.wide-field,
.icon-picker,
.code-field,
.admin-actions {
  grid-column: 1 / -1;
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.14);
}

.icon-picker legend {
  padding: 0 8px;
  color: #ffe9d2;
  font-size: 0.88rem;
  font-weight: 800;
}

.icon-picker button {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #ffe9d2;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.45rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.icon-picker button:hover,
.icon-picker button.active {
  transform: translateY(-2px);
  border-color: rgba(255, 138, 31, 0.8);
  background: linear-gradient(135deg, rgba(255, 138, 31, 0.28), rgba(255, 95, 31, 0.14));
  box-shadow: 0 12px 28px rgba(255, 95, 31, 0.16);
}

.login-form {
  grid-template-columns: minmax(0, 420px);
}

.form-status {
  grid-column: 1 / -1;
  min-height: 1.3em;
  margin: 0;
  color: #ffd3c7;
  font-weight: 800;
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--orange), var(--orange-hot));
  box-shadow: 0 14px 34px rgba(255, 95, 31, 0.25);
}

.primary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 210px));
  gap: 18px;
  justify-content: center;
  align-items: start;
}

.game-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 82% 14%, rgba(255, 138, 31, 0.26), transparent 38%),
    rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 165, 75, 0.72);
  background:
    radial-gradient(circle at 82% 14%, rgba(255, 138, 31, 0.38), transparent 40%),
    rgba(255, 255, 255, 0.13);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.34), 0 0 34px rgba(255, 138, 31, 0.12);
}

.game-launch {
  flex: 1;
  width: 100%;
  padding: 15px;
  text-align: left;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.game-launch:focus-visible {
  outline: 3px solid rgba(255, 138, 31, 0.56);
  outline-offset: -3px;
}

.game-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #ffe9d2;
  font-size: 1.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(255, 180, 80, 0.34), rgba(255, 95, 31, 0.18));
  border: 1px solid rgba(255, 218, 176, 0.34);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.game-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-icon[data-preset="cards"] {
  border-radius: 16px;
}

.game-icon[data-preset="chip"] {
  border-radius: 50%;
  border-style: dashed;
}

.game-icon[data-preset="rocket"] {
  background: linear-gradient(135deg, rgba(255, 138, 31, 0.4), rgba(255, 255, 255, 0.1));
}

.game-icon[data-preset="gem"] {
  transform: rotate(45deg) scale(0.82);
}

.game-icon[data-preset="gem"]::first-letter {
  transform: rotate(-45deg);
}

.game-title {
  font-size: 1.06rem;
  font-weight: 800;
}

.game-description {
  color: #ffe0bd;
  font-size: 0.78rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tools {
  display: none;
  gap: 8px;
  padding: 0 16px 16px;
}

.admin-open .card-tools {
  display: flex;
}

.card-tools button {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.78rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

.style-menu-wrap {
  position: relative;
}

.style-menu {
  width: 280px;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 14px;
}

.style-menu[hidden] {
  display: none;
}

.modal {
  min-height: 0;
  position: relative;
  padding: 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.game-panel {
  height: 100%;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(255, 138, 31, 0.3);
  transform: rotate(8deg);
  outline: none;
}

.modal h2 {
  margin: 0;
  padding-right: 46px;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.arena-layout {
  width: min(1500px, 100%);
  height: min(860px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(250px, 320px);
  gap: 14px;
  min-height: 0;
}

.mini-panel {
  padding: 16px;
}

.arena-side {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.arena-right {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.compact-list {
  max-height: none;
  overflow: visible;
}

.modal-content {
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

.arena-left,
.player-side-panel {
  display: flex;
  flex-direction: column;
}

.arena-left .mini-panel-title {
  width: 100%;
  margin-bottom: 16px;
  text-align: center;
}

.arena-left .leaderboard-list,
.player-side-panel .player-list {
  flex: 1;
  align-content: flex-start;
}

.arena-left .leaderboard-row {
  padding: 10px 11px;
  gap: 8px;
}

.arena-left .leaderboard-row span {
  display: none;
}

.player-side-panel .player-pill {
  padding: 6px 7px 6px 10px;
  font-size: 0.86rem;
}

.coming-soon {
  display: grid;
  min-height: 250px;
  margin: 0;
  place-items: center;
  color: #ffe4c6;
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
}

.game-frame {
  width: 100%;
  min-height: 560px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: transparent;
}

.game-helper {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
  font-size: 0.85rem;
  line-height: 1.45;
}

.play-surface {
  min-height: 100%;
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 30px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.22), transparent 42%),
    rgba(0, 0, 0, 0.17);
}

.crash-game {
  align-content: center;
  grid-template-rows: auto minmax(260px, auto) auto auto;
  overflow: hidden;
}

.play-surface h3,
.play-surface p {
  margin: 0;
}

.play-surface p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.55;
}

.game-symbol {
  min-width: 94px;
  min-height: 94px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.32), rgba(255, 255, 255, 0.08));
  font-size: 2.4rem;
  font-weight: 900;
}

.game-result {
  min-width: min(100%, 420px);
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.2);
  color: #ffe8d0;
}

.game-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-controls label,
.choice-grid label {
  display: grid;
  gap: 8px;
  color: #ffe9d2;
  font-weight: 800;
}

.game-controls input,
.choice-grid select {
  min-height: 40px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 8px 10px;
}

.coin-stage {
  display: grid;
  place-items: center;
  perspective: 900px;
}

.coin-toss-coin {
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform-style: preserve-3d;
  will-change: transform;
  text-shadow: 0 1px 2px rgba(0,0,0,0.22);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.coin-toss-coin:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: scale(1.02);
}

.coin-toss-coin.heads-bg {
  color: #2c2416;
  background: radial-gradient(circle at 35% 35%, #ffe68f, #d4af37);
  box-shadow: 0 20px 34px -10px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 215, 100, 0.34), inset 0 -3px 8px rgba(0,0,0,0.2), inset 0 5px 12px rgba(255,245,160,0.8);
}

.coin-toss-coin.tails-bg {
  color: #1f2a3a;
  background: radial-gradient(circle at 35% 35%, #eeeeee, #a8a8a8);
  box-shadow: 0 20px 34px -10px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(220, 220, 240, 0.34), inset 0 -3px 8px rgba(0,0,0,0.2), inset 0 5px 12px rgba(255,255,255,0.9);
}

.coin-toss-coin.flip {
  animation: flipCoin3D 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.flip-lock {
  pointer-events: none;
}

@keyframes flipCoin3D {
  0% { transform: rotateY(0deg) rotateX(0deg); }
  25% { transform: rotateY(360deg) rotateX(12deg); }
  50% { transform: rotateY(540deg) rotateX(-8deg); }
  75% { transform: rotateY(720deg) rotateX(6deg); }
  100% { transform: rotateY(1080deg) rotateX(0deg); }
}

.coin-stats-panel {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.18);
}

.coin-stats-panel div {
  display: grid;
  gap: 4px;
  text-align: center;
}

.coin-stats-panel span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.coin-stats-panel strong {
  color: #fff5dc;
  font-size: 1.6rem;
}

.coin-player-grid {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 10px;
  max-height: 190px;
  overflow: auto;
  padding-right: 4px;
}

.coin-player-card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.17);
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  justify-items: center;
  gap: 10px;
  align-items: start;
}

.coin-active-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  justify-items: center;
  align-items: center;
  color: #ffe9d2;
  font-weight: 900;
  min-width: 0;
}

.coin-active-toggle span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--player-color);
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.coin-active-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.coin-winner-button {
  min-height: 34px;
  width: 100%;
  max-width: 64px;
  padding: 6px 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.roulette-wheel {
  width: min(52vw, 360px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 10px solid rgba(255, 255, 255, 0.15);
  background: conic-gradient(from 0deg, rgba(var(--accent-rgb), 0.8), #333, rgba(var(--accent-rgb), 0.8));
  transition: transform 1.2s cubic-bezier(.2,.8,.2,1);
}

.roulette-wheel span {
  width: 42%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  font-weight: 900;
}

.roulette-ball {
  position: absolute;
  top: 10%;
  left: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 18px white;
}

.wheel-slots {
  max-width: 680px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.wheel-slots span {
  padding: 6px 10px;
  border: 1px solid;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  font-size: 0.8rem;
  font-weight: 800;
}

.crash-picker {
  width: min(100%, 820px);
  display: grid;
  gap: 9px;
  text-align: left;
}

.crash-picker > span {
  color: var(--muted);
  font-weight: 900;
}

.crash-picker div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crash-picker label {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #ffe9d2;
  font-size: 0.85rem;
  font-weight: 800;
}

.duration-control {
  width: max-content;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: auto 90px auto;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.duration-control input {
  min-height: 38px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.22);
  padding: 7px 9px;
}

.race-track {
  --race-width: min(600px, max(240px, calc(100vw - 800px)));
  width: min(100%, 760px);
  min-width: 0;
  position: relative;
  display: grid;
  gap: 12px;
  padding: 12px 48px 12px 0;
  overflow: hidden;
}

.vertical-finish {
  position: absolute;
  top: 0;
  right: 22px;
  bottom: 0;
  width: 12px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(to bottom, #fff 0 10px, #111 10px 20px);
  box-shadow: 0 0 18px rgba(255,255,255,0.25);
  z-index: 1;
}

.race-lane {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
  transition: opacity 0.2s ease;
}

.race-lane.inactive-racer {
  opacity: 0.32;
}

.race-lane > span {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffe9d2;
  font-weight: 900;
}

.race-lane div {
  height: 44px;
  position: relative;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04)),
    repeating-linear-gradient(90deg, transparent 0 9%, rgba(255,255,255,0.08) 9% 9.6%, transparent 9.6% 18%);
}

.racer-dot {
  width: 34px;
  height: 34px;
  position: absolute;
  top: 50%;
  left: 0;
  border: 3px solid rgba(255,255,255,0.75);
  border-radius: 50%;
  background: var(--racer-color);
  transform: translate(0, -50%);
  box-shadow: 0 0 18px var(--racer-color);
  z-index: 2;
  overflow: hidden;
}

.racer-dot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 1;
}

.racer-dot.racing {
  box-shadow: 0 0 24px var(--racer-color), 0 0 38px rgba(255,255,255,0.12);
}

.race-start-button {
  background: linear-gradient(135deg, #20c96f, #109e50);
}

.carousel-game {
  overflow: hidden;
}

.carousel-pointer {
  width: 4px;
  height: 86px;
  position: relative;
  z-index: 2;
  margin-bottom: -98px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 0 18px white;
}

.color-carousel {
  width: min(100%, 760px);
  display: flex;
  gap: 10px;
  padding: 18px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.18);
  transition: transform 1s cubic-bezier(.2,.8,.2,1), border-color 0.2s ease;
}

.color-carousel span {
  min-width: 110px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: white;
  font-weight: 900;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.mines-grid {
  width: min(100%, 640px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 8px;
}

.mines-grid button {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.mines-grid button.revealed {
  background: var(--tile-color);
  color: white;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.game-result strong {
  font-size: 1.5rem;
}

.game-notice {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
  font-weight: 800;
}

.gold-star {
  color: #ffd76a;
}

.leaderboard-gold {
  border-color: rgba(255, 215, 106, 0.75);
  background: rgba(255, 215, 106, 0.16);
}

.leaderboard-gold strong {
  color: #ffe28a;
}

.leaderboard-silver {
  border-color: rgba(210, 220, 235, 0.7);
  background: rgba(210, 220, 235, 0.13);
}

.leaderboard-silver strong {
  color: #edf3ff;
}

.leaderboard-bronze {
  border-color: rgba(205, 132, 72, 0.7);
  background: rgba(205, 132, 72, 0.14);
}

.leaderboard-bronze strong {
  color: #f2b37d;
}

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

  .leaderboard-panel {
    position: static;
  }

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

  .game-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 210px));
  }
}

@media (max-width: 760px) {
  .casino-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 22px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .home-link {
    justify-self: start;
  }

  h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .admin-panel-header,
  .admin-actions {
    flex-direction: column;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .casino-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .arena-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .arena-side {
    height: auto;
    overflow: visible;
  }

  .leaderboard-panel {
    position: static;
  }

  .inline-form,
  .inline-form.compact {
    grid-template-columns: 1fr;
  }

  .reward-grid {
    grid-template-columns: 1fr;
  }

  .race-track {
    --race-width: min(500px, calc(100vw - 190px));
  }

  .game-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 12px;
    justify-content: center;
  }

  .game-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
  }

  .game-launch {
    padding: 12px;
    gap: 7px;
  }

  .game-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1rem;
  }

  .game-title {
    font-size: 0.95rem;
    line-height: 1.12;
  }

  .game-description {
    font-size: 0.72rem;
    line-height: 1.25;
    -webkit-line-clamp: 3;
  }

  .modal {
    padding: 22px;
  }

  .game-frame {
    min-height: 460px;
  }
}
