:root {
  --bg-deep: #0b1612;
  --bg-card: rgba(19, 36, 29, 0.88);
  --bg-card-light: rgba(29, 54, 43, 0.75);
  --border-gold: rgba(245, 196, 81, 0.28);
  --gold: #f5c451;
  --gold-bright: #ffe07d;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --wood-light: #e8cfa6;
  --wood-dark: #5c3a21;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #173628 0%, #09130f 65%, #050a08 100%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 84px;
}

.app-container {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top Header Bar */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(10, 22, 17, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-gold);
  position: sticky;
  top: 0;
  z-index: 50;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  box-shadow: 0 0 12px rgba(245, 196, 81, 0.35);
}

.profile-meta {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.profile-elo {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

.header-balances {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bal-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-gold);
  padding: 5px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.bal-chip.gold {
  color: var(--gold-bright);
}

.bal-chip.stars {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
}

.lang-btn {
  background: rgba(245, 196, 81, 0.14);
  border: 1px solid var(--border-gold);
  color: var(--text-main);
  padding: 5px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Views & Sections */
.view-section {
  display: none;
  padding: 14px;
  animation: fadeIn 0.2s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Daily Streak Banner */
.daily-banner {
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.2), rgba(16, 185, 129, 0.18));
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.daily-info h4 {
  font-size: 14px;
  color: var(--gold-bright);
  margin-bottom: 2px;
}

.daily-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-gold-sm {
  background: linear-gradient(180deg, #ffd86b 0%, #d89b1c 100%);
  color: #1a1204;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(245, 196, 81, 0.35);
}

.btn-gold-sm:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Game Mode Cards (Shashka & Shaxmat) */
.game-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.game-mode-card {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.game-mode-card.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.18) 0%, rgba(19, 36, 29, 0.92) 100%);
  box-shadow: 0 0 20px rgba(245, 196, 81, 0.25);
}

.game-icon-big {
  font-size: 42px;
  margin-bottom: 8px;
  display: block;
}

.game-mode-card h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}

.game-mode-card p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Stake Selector */
.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.stakes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stake-card {
  background: var(--bg-card);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 11px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stake-card.selected {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.18);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.stake-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-bright);
}

.stake-prize {
  font-size: 10px;
  color: #6ee7b7;
  margin-top: 3px;
}

/* Big Wooden/Gold Play Button */
.btn-play-main {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 2px solid #fde08d;
  background: linear-gradient(180deg, #f5c451 0%, #c88719 100%);
  color: #1f1200;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 196, 81, 0.35), inset 0 2px 2px rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease;
}

.btn-play-main:active {
  transform: scale(0.98);
}

.security-footer-badge {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 7px 10px;
  border-radius: 10px;
}

/* Active Game Board Screen */
.match-container {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.match-container.active {
  display: flex;
}

.match-prize-pill {
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--gold-bright);
  background: rgba(245, 196, 81, 0.14);
  border: 1px solid var(--border-gold);
  padding: 6px 16px;
  border-radius: 999px;
  align-self: center;
}

.player-bar {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-bar.active-turn {
  border-color: var(--emerald);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.28);
}

.timer-box {
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 11px;
  border-radius: 10px;
  font-weight: 800;
  font-family: monospace;
  font-size: 16px;
  color: var(--gold-bright);
}

/* Interactive 8x8 Board */
.board-frame {
  background: linear-gradient(145deg, #3c2211, #241308);
  padding: 10px;
  border-radius: 18px;
  border: 3px solid #85522b;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 410px;
  margin: 0 auto;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #1e0f06;
}

.board-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.board-cell.light {
  background: var(--wood-light);
}

.board-cell.dark {
  background: var(--wood-dark);
}

.board-cell.selected {
  background: rgba(245, 196, 81, 0.68) !important;
}

.board-cell.last-move {
  box-shadow: inset 0 0 0 3px rgba(59, 130, 246, 0.7);
}

.legal-dot {
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.85);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.9);
  pointer-events: none;
}

/* Checkers 3D Piece */
.checker-piece {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.15s ease;
}

.checker-piece.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #d6d3cb 70%, #9e998e 100%);
  border: 2px solid #b5b0a4;
  box-shadow: 0 4px 7px rgba(0, 0, 0, 0.5), inset 0 2px 4px #fff;
  color: #854d0e;
}

.checker-piece.black {
  background: radial-gradient(circle at 35% 30%, #475569, #1e293b 70%, #090d16 100%);
  border: 2px solid #334155;
  box-shadow: 0 4px 7px rgba(0, 0, 0, 0.65), inset 0 2px 3px rgba(255, 255, 255, 0.25);
  color: var(--gold);
}

/* Chess Piece (SVG) */
.chess-piece {
  width: 82%;
  height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}

.chess-piece svg {
  width: 100%;
  height: 100%;
  display: block;
}

.turn-badge {
  align-self: center;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid var(--emerald);
  color: #6ee7b7;
}

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

.emoji-bar {
  display: flex;
  gap: 6px;
}

.emoji-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 16px;
  cursor: pointer;
}

.btn-resign {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Cards for Tournaments, Tasks, Convert, Rating */
.glass-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.glass-card.gold-border {
  border-color: var(--border-gold);
}

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.tour-title {
  font-weight: 800;
  font-size: 15px;
}

.tour-prize {
  background: rgba(245, 196, 81, 0.18);
  color: var(--gold-bright);
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.tour-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Convert Section */
.dual-balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.bal-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 11px;
}

.bal-box .lbl {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.bal-box .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-bright);
}

.sub-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.sub-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.sub-tab-btn.active {
  background: var(--emerald-dark);
  color: #fff;
}

.target-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}

.target-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.target-pill.selected {
  border-color: var(--gold);
  background: rgba(245, 196, 81, 0.16);
  color: var(--gold-bright);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  padding: 11px 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.form-input:focus {
  border-color: var(--gold);
}

.receive-preview {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 10px 12px;
  border-radius: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  background: rgba(9, 20, 15, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-gold);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 6px 10px;
  z-index: 60;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.nav-item .ico {
  font-size: 20px;
}

.nav-item.active {
  color: var(--gold-bright);
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #12241c;
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 22px 18px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
}

.lang-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.lang-choice-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-gold);
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.lang-choice-btn:hover {
  background: rgba(245, 196, 81, 0.2);
}

.toast-msg {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 200;
  display: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
