/* Mines Ton 1-to-1 UI & Full Menus Theme */
:root {
  --bg-app: #131c27;
  --card-bg: #1a2636;
  --tile-bg: #2b3b4f;
  --tile-border: #35475e;
  --tile-bevel: #1e2a3a;
  --accent-cyan: #00c3ff;
  --accent-cyan-hover: #00b0e6;
  --accent-wallet: #0f8bbf;
  --accent-green: #00e65c;
  --danger-red: #ff3366;
  --input-bg: #162230;
  --control-bg: #233144;
  --text-white: #ffffff;
  --text-muted: #8294a8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-app);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 10px;
}

.app-container {
  width: 100%;
  max-width: 410px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.app-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.logo-mines {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1;
}

.logo-ton {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1;
}

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

/* Balance Box & Currency Dropdown */
.balance-container {
  position: relative;
}

.balance-box {
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.balance-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.5px;
}

.ton-icon { font-size: 12px; }
.chevron-down { font-size: 10px; color: var(--text-muted); }

.currency-dropdown {
  position: absolute;
  top: 36px;
  left: 0;
  background: #141f2d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 6px 0;
  width: 155px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 95;
  display: none;
  flex-direction: column;
}

.currency-dropdown.open {
  display: flex;
}

.curr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-white);
  cursor: pointer;
}

.curr-item:hover, .curr-item.active {
  background: rgba(255, 255, 255, 0.06);
}

.curr-icon {
  font-size: 13px;
}

.icon-btn {
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.wallet-btn { background: var(--accent-wallet); color: #fff; }
.profile-btn { background: transparent; color: var(--text-white); }

/* Floating Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  background: #15202e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 6px 0;
  width: 170px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 95;
  display: none;
  flex-direction: column;
}

.profile-dropdown.open {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-white);
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item .item-icon { font-size: 14px; }

/* Game Wrapper */
.game-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* 5x5 Grid Card */
.grid-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #141e2b;
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.grid-5x5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  height: 100%;
}

.tile {
  background: var(--tile-bg);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 -3px 0 var(--tile-bevel);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tile.revealed-star {
  background: linear-gradient(135deg, #00c3ff, #0088cc);
  box-shadow: 0 0 12px rgba(0, 195, 255, 0.5);
  animation: revealAnimation 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.tile.revealed-star::after {
  content: '💎';
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

@keyframes revealAnimation {
  0% { transform: scale(0.7) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.scan-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  box-shadow: 0 0 12px var(--accent-cyan);
  opacity: 0;
  z-index: 10;
  pointer-events: none;
}

.scan-laser.active {
  opacity: 1;
  animation: laserScan 1.4s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 3%; }
  100% { top: 97%; }
}

/* Controls Section */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bet-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.usd-equiv {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.bet-input-container {
  display: flex;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-field-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.input-field-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-white);
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

.input-ton-icon { font-size: 12px; margin-left: 4px; }

.quick-multiplier-btns {
  display: flex;
  background: var(--control-bg);
}

.quick-btn {
  background: transparent;
  border: none;
  color: var(--text-white);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-bet {
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #051622;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-bet:disabled {
  background: #243447;
  color: #617387;
  cursor: not-allowed;
}

.bombs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.bombs-select-box {
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bombs-select-box select {
  background: transparent;
  border: none;
  color: var(--text-white);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 12px;
  cursor: pointer;
}

.full-width {
  width: 100%;
  justify-content: space-between;
}

/* Bonus Button & Bonus Modal Styles */
.bonus-badge-btn {
  background: linear-gradient(135deg, #ff9900 0%, #ff5500 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  padding: 6px 10px !important;
  width: auto !important;
  border-radius: 20px !important;
  box-shadow: 0 2px 10px rgba(255, 120, 0, 0.4) !important;
}

.bonus-badge-btn:hover {
  transform: scale(1.05);
}

.bonus-card {
  max-width: 420px;
  background: linear-gradient(180deg, #182333 0%, #0d1522 100%);
  border: 1px solid rgba(255, 170, 0, 0.3);
}

.bonus-stages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.bonus-stage-item {
  background: #141f2d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bonus-stage-item.active {
  background: linear-gradient(135deg, rgba(255, 150, 0, 0.15) 0%, rgba(255, 80, 0, 0.15) 100%);
  border-color: #ff9900;
}

.stage-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.stage-val {
  font-size: 18px;
  font-weight: 800;
  color: #ffaa00;
}

.daily-reward-box {
  background: rgba(0, 195, 255, 0.08);
  border: 1px solid rgba(0, 195, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.reward-info {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: 12px;
}

.reward-info strong {
  color: var(--cyan-glow);
  font-size: 14px;
}

.btn-claim-daily {
  background: var(--primary-cyan);
  color: #000;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-apply-promo {
  background: var(--btn-blue);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 13px;
  padding: 0 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
}

/* Mode Switcher */
.mode-tabs-container {
  display: flex;
  background: var(--input-bg);
  border-radius: 30px;
  padding: 4px;
  margin-top: 4px;
}

.mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 24px;
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.mode-tab.active {
  background: var(--control-bg);
  color: var(--text-white);
}

/* Auto Settings Box */
.auto-settings-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.auto-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.reset-btn {
  background: var(--control-bg);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-white);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}

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

.pct-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.pct-input-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-white);
  font-size: 13px;
  outline: none;
}

.auto-input-wrap input {
  width: 100%;
  background: var(--input-bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-white);
  font-size: 13px;
  outline: none;
}

/* Sub Nav Container & Settings Dropdown */
.sub-nav-container {
  position: relative;
}

.sub-nav-bar {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  justify-content: space-between;
}

.icons-group { display: flex; gap: 12px; }

.sub-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.vertical-divider { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.1); }

.fairness-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Settings Menu Popup (Light Blue theme matching screenshot) */
.settings-menu-popup {
  position: absolute;
  bottom: 40px;
  left: 0;
  background: #dbe8f5;
  border-radius: var(--radius-md);
  padding: 6px 0;
  width: 200px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  z-index: 95;
  display: none;
  flex-direction: column;
}

.settings-menu-popup.open {
  display: flex;
}

.settings-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #1a2736;
  cursor: pointer;
}

.settings-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.settings-item.active-blue {
  color: #007acc;
}

/* Stats Overlay Popup */
.stats-overlay-popup {
  position: absolute;
  bottom: 40px;
  left: 0;
  background: #141e2b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  width: 260px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 95;
  display: none;
}

.stats-overlay-popup.open {
  display: block;
}

.stats-grid {
  display: flex;
  gap: 16px;
}

.stat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
}

.stat-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.green-text { color: #00ff88; }
.red-text { color: #ff3366; }
.mt-8 { margin-top: 8px; }

/* History Section */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.history-tabs-container {
  display: flex;
  background: var(--input-bg);
  border-radius: 30px;
  padding: 4px;
}

.history-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 24px;
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.history-tab.active {
  background: var(--control-bg);
  color: var(--text-white);
}

.history-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 8px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-table td {
  font-size: 12px;
  font-weight: 600;
  padding: 10px 8px;
}

.history-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

.win-pos { color: #00ff88; }
.win-neg { color: #ff3366; }

.empty-table-msg { text-align: center; color: var(--text-muted); padding: 20px !important; }

/* Game Information Modal Content */
.gameinfo-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-white);
  padding: 6px 0;
}

/* Modal Overlay Base */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 16, 24, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid rgba(0, 195, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.modal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-top-bar h2 { font-size: 20px; color: var(--text-white); }
.close-x { background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
