@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: #1a2c38;
  color: #b1bad3;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 15px;
}

.balance-amount {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.add-funds-btn {
  background: #00e701;
  color: #000;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.add-funds-btn:hover {
  opacity: 0.9;
}

.main-content {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  gap: 20px;
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  .right-panel {
    display: none;
  }
}

.control-panel {
  background: #213743;
  border-radius: 8px;
  padding: 20px;
}

.mode-toggle-wrapper {
  display: flex;
  background: #2f4553;
  border-radius: 24px;
  padding: 4px;
  margin-bottom: 20px;
}

.mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #b1bad3;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.mode-tab.active {
  background: #3c5564;
  color: #fff;
}

.control-group {
  margin-bottom: 16px;
}

.advanced-toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.advanced-toggle-group .control-label {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #b1bad3;
  margin-bottom: 8px;
  font-weight: 500;
}

.label-value {
  color: #7a8a9e;
}

.control-input {
  width: 100%;
  background: #2f4553;
  border: 1px solid #2f4553;
  border-radius: 6px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.control-input:focus {
  outline: none;
  border-color: #557086;
}

.control-select {
  width: 100%;
  background: #2f4553;
  border: 1px solid #2f4553;
  border-radius: 6px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23b1bad3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.control-select:focus {
  outline: none;
  border-color: #557086;
}

.control-display {
  background: #2f4553;
  border: 1px solid #2f4553;
  border-radius: 6px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.input-with-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-with-actions .control-input {
  flex: 1;
  padding-right: 40px;
}

.input-icon-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #f7931a;
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-with-actions {
  position: relative;
  display: flex;
  gap: 6px;
}

.bet-action-btn {
  background: #2f4553;
  border: 1px solid #2f4553;
  color: #b1bad3;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 48px;
}

.bet-action-btn:hover {
  background: #3c5564;
}

.action-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.start-btn {
  background: #00e701;
  color: #000;
}

.start-btn:hover {
  opacity: 0.9;
}

.cashout-btn {
  background: #fbbf24;
  color: #000;
}

.cashout-btn:hover {
  opacity: 0.9;
}

.stop-btn {
  background: #ef4444;
  color: #fff;
}

.random-pick-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: #7a8a9e;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.random-pick-btn:hover {
  color: #b1bad3;
  background: #2f4553;
}

.profit-display {
  background: #2f4553;
  border-radius: 6px;
  padding: 14px;
  margin-top: 16px;
}

.profit-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #b1bad3;
  margin-bottom: 10px;
  font-weight: 500;
}

.profit-value {
  color: #7a8a9e;
}

.profit-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.profit-amount span {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2f4553;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #7a8a9e;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #00e701;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background: #fff;
}

.button-group {
  display: flex;
  gap: 6px;
}

.group-btn {
  flex: 1;
  background: #2f4553;
  border: 1px solid #2f4553;
  color: #b1bad3;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}

.group-btn.active {
  background: #3c5564;
  color: #fff;
  border-color: #3c5564;
}

.group-btn:hover {
  background: #3c5564;
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix .control-input {
  padding-right: 35px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8a9e;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.hidden {
  display: none !important;
}

.game-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.stat-card {
  background: #213743;
  padding: 18px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: #7a8a9e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 8px;
  color: #fff;
}

.game-board {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  background: #213743;
  padding: 20px;
  border-radius: 8px;
}

.tile {
  aspect-ratio: 1;
  background: #2f4553;
  border: 2px solid #2f4553;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tile:hover:not(.revealed):not(:disabled):not(.auto-selected) {
  background: #3c5564;
  border-color: #557086;
}

.tile.auto-selected {
  background: #3c5564;
  border: 2px solid #00e701;
  box-shadow: 0 0 15px rgba(0, 231, 1, 0.3);
}

.tile.auto-selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  color: #00e701;
  font-size: 16px;
  font-weight: bold;
}

.tile.revealed {
  cursor: default;
}

.tile.gem {
  background: #00e701;
  border-color: #00e701;
  animation: reveal 0.3s ease;
}

.tile.mine {
  background: #ef4444;
  border-color: #ef4444;
  animation: explode 0.4s ease;
}

@keyframes reveal {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes flipBack {
  0% { transform: rotateY(0deg); opacity: 1; }
  50% { transform: rotateY(90deg); opacity: 0.5; }
  100% { transform: rotateY(0deg); opacity: 1; }
}

.tile.resetting {
  animation: flipBack 0.4s ease;
}

@keyframes explode {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.fairness-btn {
  width: 100%;
  background: #2f4553;
  border: 1px solid #2f4553;
  color: #b1bad3;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  margin-top: 20px;
  font-weight: 600;
  font-size: 13px;
}

.fairness-btn:hover {
  background: #3c5564;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-card {
  background: #213743;
  border-radius: 8px;
  padding: 20px;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 15px;
  color: #fff;
}

.history-list {
  max-height: none;
}

.history-list.collapsed {
  max-height: none;
}

.view-all-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #2f4553;
  color: #b1bad3;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s;
  margin-top: 10px;
  text-transform: uppercase;
}

.view-all-btn:hover {
  background: #2f4553;
  border-color: #00e701;
  color: #00e701;
}

.history-item {
  padding: 12px;
  background: #2f4553;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.history-item:hover {
  background: #3c5564;
  border-color: #00e701;
  transform: translateX(2px);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-id {
  font-size: 10px;
  color: #7a8a9e;
  font-family: monospace;
}

.history-mode {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 231, 1, 0.1);
  color: #00e701;
  text-transform: uppercase;
  font-weight: 600;
}

.history-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-info {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #7a8a9e;
}

.history-result {
  font-weight: 700;
  font-size: 13px;
}

.history-result.win {
  color: #00e701;
}

.history-result.loss {
  color: #ef4444;
}

.round-modal {
  background: #213743;
  border-radius: 8px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.round-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2f4553;
}

.round-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.round-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 15px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.round-tile {
  aspect-ratio: 1;
  background: #2f4553;
  border: 2px solid #2f4553;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.round-tile.mine {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.round-tile.safe {
  background: rgba(0, 231, 1, 0.2);
  border-color: #00e701;
}

.round-tile.revealed {
  box-shadow: 0 0 15px rgba(0, 231, 1, 0.4);
  border-width: 3px;
}

.round-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.round-info-item {
  background: #2f4553;
  padding: 10px;
  border-radius: 6px;
}

.round-info-label {
  font-size: 10px;
  color: #7a8a9e;
  margin-bottom: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.round-info-value {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
}

.round-seeds {
  background: #2f4553;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.round-seed-item {
  margin-bottom: 8px;
}

.round-seed-item:last-child {
  margin-bottom: 0;
}

.round-seed-label {
  font-size: 10px;
  color: #7a8a9e;
  margin-bottom: 3px;
  font-weight: 600;
}

.round-seed-value {
  font-size: 10px;
  color: #00e701;
  font-family: monospace;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 4px;
}

.info-text {
  font-size: 13px;
  color: #7a8a9e;
  text-align: center;
  margin-top: 15px;
}

.info-text-small {
  font-size: 11px;
  color: #7a8a9e;
  margin-top: 4px;
  line-height: 1.4;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #213743;
  color: #fff;
  padding: 16px 22px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
  z-index: 2000;
  font-weight: 500;
  font-size: 14px;
}

@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  border-left: 4px solid #00e701;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: #213743;
  border-radius: 8px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.close-btn {
  background: #2f4553;
  border: none;
  color: #b1bad3;
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #3c5564;
}

.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid #2f4553;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #7a8a9e;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: #b1bad3;
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: #00e701;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.seed-section {
  background: #2f4553;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.seed-section h3 {
  font-size: 16px;
  margin-bottom: 15px;
  color: #fff;
  font-weight: 600;
}

.seed-item {
  margin-bottom: 15px;
  position: relative;
}

.seed-label {
  font-size: 12px;
  color: #7a8a9e;
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}

.seed-value {
  background: #1a2c38;
  padding: 12px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  color: #fff;
}

.seed-input {
  width: 100%;
  background: #1a2c38;
  border: 1px solid #2f4553;
  border-radius: 6px;
  padding: 12px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.seed-input:focus {
  outline: none;
  border-color: #557086;
}

.copy-btn {
  position: absolute;
  right: 8px;
  top: 32px;
  background: #3c5564;
  border: none;
  color: #b1bad3;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: #557086;
}

.info-box, .warning-box {
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 15px;
}

.info-box {
  background: #2f4553;
  color: #b1bad3;
}

.warning-box {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.revealed-seed {
  background: rgba(0, 231, 1, 0.1);
  padding: 15px;
  border-radius: 6px;
  margin-top: 15px;
}

.revealed-seed-label {
  font-size: 12px;
  color: #00e701;
  font-weight: 700;
  margin-bottom: 10px;
}
