/* ============================================
   Digital Eden 2048 x TON - Cyberpunk Theme
   Shards/TON Economy UI
   ============================================ */

/* === CSS Variables === */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3e;
  --bg-cell: rgba(30, 30, 70, 0.6);
  --border-color: rgba(0, 255, 200, 0.15);
  --border-glow: rgba(0, 255, 200, 0.3);
  --text-primary: #e0e8ff;
  --text-secondary: #8892b0;
  --text-muted: #4a5568;
  --accent: #00ffc8;
  --accent-secondary: #7b61ff;
  --accent-tertiary: #ff6b9d;
  --ton-blue: #0098ea;
  --gradient-primary: linear-gradient(135deg, #00ffc8, #7b61ff);
  --gradient-accent: linear-gradient(135deg, #7b61ff, #ff6b9d);
  --gradient-ton: linear-gradient(135deg, #0098ea, #00d4ff);
  --gradient-warm: linear-gradient(135deg, #ff6b9d, #ffa726);
  --shadow-glow: 0 0 20px rgba(0, 255, 200, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --board-size: 420px;
  --cell-gap: 10px;
  --cell-size: calc((var(--board-size) - var(--cell-gap) * 5) / 4);
  --font-main: 'Orbitron', -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'Orbitron', monospace;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
  --bg-primary: #f0f2ff;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-cell: rgba(200, 210, 240, 0.4);
  --border-color: rgba(123, 97, 255, 0.15);
  --border-glow: rgba(123, 97, 255, 0.25);
  --text-primary: #1a1a3e;
  --text-secondary: #4a5568;
  --text-muted: #8892b0;
  --shadow-glow: 0 0 20px rgba(123, 97, 255, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: var(--transition);
}

/* Background */
.de-bg-particles {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.de-bg-particles::before {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,255,200,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,152,234,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(123,97,255,0.03) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}
@keyframes bgFloat {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  33% { transform: translate(2%,-2%) rotate(1deg); }
  66% { transform: translate(-1%,1%) rotate(-0.5deg); }
}

/* Wrapper */
.de-wrapper {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto; padding: 16px;
  min-height: 100vh; display: flex; flex-direction: column;
}

/* Header */
.de-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 8px;
}
.de-brand { display: flex; align-items: baseline; gap: 6px; }
.de-brand-icon {
  color: var(--accent); font-size: 20px;
  text-shadow: 0 0 10px rgba(0,255,200,0.5);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }
.de-brand-text {
  font-size: 18px; font-weight: 900; letter-spacing: 3px;
}
.de-brand-text .accent {
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.de-brand-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 4px; margin-left: 4px; }
.de-header-right { display: flex; align-items: center; gap: 10px; }

/* Language Toggle */
.de-lang-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-color); background: var(--bg-card);
  color: var(--accent); font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.de-lang-toggle:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); transform: scale(1.1); }
.de-lang-badge {
  font-family: var(--font-num); font-weight: 900; letter-spacing: 1px; font-size: 10px;
}

/* Theme Toggle */
.de-theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-color); background: var(--bg-card);
  color: var(--accent); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.de-theme-toggle:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); transform: rotate(30deg); }

/* ============================================
   Shards Progress Section
   ============================================ */
.de-shards-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: var(--transition);
}
.de-shards-section:hover { border-color: var(--border-glow); }

.de-shards-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.de-shards-info {
  display: flex; align-items: center; gap: 8px;
}
.de-shards-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--gradient-warm);
  border-radius: 6px; font-size: 14px; color: #0a0a1a;
  animation: pulse 2.5s ease-in-out infinite;
}
.de-shards-label {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.de-shards-ton-info {
  display: flex; align-items: center; gap: 6px;
}
.de-ton-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px;
  background: var(--gradient-ton);
  border-radius: 20px; font-size: 10px; font-weight: 900;
  color: #fff; letter-spacing: 1px;
}
.de-ton-value {
  font-family: var(--font-num); font-size: 16px;
  font-weight: 700; color: #00d4ff;
  text-shadow: 0 0 8px rgba(0,152,234,0.3);
}

/* Shards Progress Bar */
.de-shards-bar-track {
  position: relative; height: 24px;
  background: rgba(0,152,234,0.08);
  border-radius: 12px; border: 1px solid rgba(0,152,234,0.15);
  overflow: hidden; margin-bottom: 12px;
}
.de-shards-bar-fill {
  height: 100%;
  background: var(--gradient-ton);
  border-radius: 12px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-width: 0;
}
.de-shards-bar-fill::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15));
  border-radius: 0 12px 12px 0;
}
.de-shards-bar-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-num); font-size: 10px;
  font-weight: 700; color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap;
}

/* Shards Action Buttons */
.de-shards-actions {
  display: flex; gap: 6px;
}
.de-shards-actions .de-btn { flex: 1; }

/* ============================================
   Score Bar
   ============================================ */
.de-score-bar {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px; margin-bottom: 10px; align-items: center;
}
.de-score-item {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 8px 12px;
  text-align: center; position: relative; overflow: hidden;
  transition: var(--transition);
}
.de-score-item::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--gradient-primary); opacity: 0.6;
}
.de-score-shards::before { background: var(--gradient-warm); }
.de-score-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px;
}
.de-score-value {
  font-family: var(--font-num); font-size: 18px;
  font-weight: 700; color: var(--text-primary);
}
.de-score-add {
  position: absolute; top: 50%; right: 10px;
  transform: translateY(-50%); color: var(--accent);
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none;
}
.de-score-add.show { animation: scoreUp 0.8s ease-out forwards; }
@keyframes scoreUp {
  0% { opacity:1; transform: translateY(-50%); }
  100% { opacity:0; transform: translateY(-100%); }
}
.de-score-actions { display: flex; flex-direction: column; gap: 6px; }

/* ============================================
   Buttons
   ============================================ */
.de-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-primary);
  font-family: var(--font-main); font-size: 11px; font-weight: 600;
  letter-spacing: 1px; cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.de-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.de-btn:active { transform: translateY(0); }
.de-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.de-btn-sm { padding: 5px 12px; font-size: 10px; }

.de-btn-new { background: var(--gradient-primary); border: none; color: #0a0a1a; font-weight: 700; }
.de-btn-new:hover { box-shadow: 0 0 20px rgba(0,255,200,0.3); }
.de-btn-undo {
  background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary);
}
.de-btn-undo.ad-required { border-color: rgba(255,167,38,0.4); color: #ffa726; }
.de-btn-shards { background: var(--gradient-ton); border: none; color: #fff; font-weight: 700; }
.de-btn-shards:hover { box-shadow: 0 0 20px rgba(0,152,234,0.3); }
.de-btn-ton { background: var(--gradient-accent); border: none; color: #fff; font-weight: 700; }
.de-btn-ton:hover { box-shadow: 0 0 20px rgba(123,97,255,0.3); }
.de-btn-invite {
  background: var(--gradient-warm); border: none; color: #0a0a1a; font-weight: 700;
}
.de-btn-invite:hover { box-shadow: 0 0 20px rgba(255,107,157,0.3); }

/* ============================================
   Game Board
   ============================================ */
.de-game-area { display: flex; justify-content: center; margin-bottom: 10px; }
.de-game-board {
  position: relative;
  width: var(--board-size); height: var(--board-size);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--cell-gap);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  touch-action: none; overflow: hidden;
}
.de-game-board::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at top left, rgba(0,255,200,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(0,152,234,0.05) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* Grid */
.de-grid {
  position: absolute;
  top: var(--cell-gap); left: var(--cell-gap); right: var(--cell-gap); bottom: var(--cell-gap);
  display: grid; grid-template-columns: repeat(4,1fr); grid-template-rows: repeat(4,1fr);
  gap: var(--cell-gap); z-index: 1;
}
.de-grid-cell {
  background: var(--bg-cell);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.03);
}
.de-tiles {
  position: absolute;
  top: var(--cell-gap); left: var(--cell-gap); right: var(--cell-gap); bottom: var(--cell-gap);
  z-index: 2;
}

/* Tiles */
.de-tile {
  position: absolute;
  width: var(--cell-size); height: var(--cell-size);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-weight: 900;
  transition: top 120ms ease, left 120ms ease;
  z-index: 10;
}
.de-tile-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.de-tile-new { animation: tileAppear 200ms ease 80ms; animation-fill-mode: backwards; }
@keyframes tileAppear {
  0% { opacity:0; transform: scale(0); }
  100% { opacity:1; transform: scale(1); }
}
.de-tile-merged { z-index: 20; animation: tilePop 200ms ease 80ms; animation-fill-mode: backwards; }
@keyframes tilePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Tile Colors */
.de-tile-2 .de-tile-inner { background: rgba(0,255,200,0.08); border: 1px solid rgba(0,255,200,0.2); color: var(--accent); font-size: calc(var(--cell-size) * 0.4); }
.de-tile-4 .de-tile-inner { background: rgba(0,255,200,0.12); border: 1px solid rgba(0,255,200,0.25); color: var(--accent); font-size: calc(var(--cell-size) * 0.4); }
.de-tile-8 .de-tile-inner { background: rgba(0,200,255,0.15); border: 1px solid rgba(0,200,255,0.3); color: #00c8ff; font-size: calc(var(--cell-size) * 0.4); text-shadow: 0 0 10px rgba(0,200,255,0.3); }
.de-tile-16 .de-tile-inner { background: rgba(123,97,255,0.15); border: 1px solid rgba(123,97,255,0.3); color: #7b61ff; font-size: calc(var(--cell-size) * 0.38); text-shadow: 0 0 10px rgba(123,97,255,0.3); }
.de-tile-32 .de-tile-inner { background: rgba(255,107,157,0.15); border: 1px solid rgba(255,107,157,0.3); color: #ff6b9d; font-size: calc(var(--cell-size) * 0.38); text-shadow: 0 0 10px rgba(255,107,157,0.3); }
.de-tile-64 .de-tile-inner { background: rgba(255,167,38,0.15); border: 1px solid rgba(255,167,38,0.35); color: #ffa726; font-size: calc(var(--cell-size) * 0.38); text-shadow: 0 0 12px rgba(255,167,38,0.4); box-shadow: 0 0 20px rgba(255,167,38,0.1); }
.de-tile-128 .de-tile-inner { background: linear-gradient(135deg, rgba(0,255,200,0.15), rgba(0,200,255,0.15)); border: 1px solid rgba(0,255,200,0.35); color: #00ffc8; font-size: calc(var(--cell-size) * 0.32); text-shadow: 0 0 15px rgba(0,255,200,0.5); box-shadow: 0 0 25px rgba(0,255,200,0.15); }
.de-tile-256 .de-tile-inner { background: linear-gradient(135deg, rgba(123,97,255,0.2), rgba(255,107,157,0.15)); border: 1px solid rgba(123,97,255,0.4); color: #a78bfa; font-size: calc(var(--cell-size) * 0.32); text-shadow: 0 0 15px rgba(167,139,250,0.5); box-shadow: 0 0 25px rgba(123,97,255,0.15); }
.de-tile-512 .de-tile-inner { background: linear-gradient(135deg, rgba(255,107,157,0.2), rgba(255,167,38,0.15)); border: 1px solid rgba(255,107,157,0.4); color: #ff6b9d; font-size: calc(var(--cell-size) * 0.32); text-shadow: 0 0 15px rgba(255,107,157,0.5); box-shadow: 0 0 25px rgba(255,107,157,0.15); }
.de-tile-1024 .de-tile-inner { background: linear-gradient(135deg, rgba(255,200,0,0.15), rgba(255,107,157,0.15)); border: 1px solid rgba(255,215,0,0.4); color: #ffd700; font-size: calc(var(--cell-size) * 0.26); text-shadow: 0 0 15px rgba(255,215,0,0.5); box-shadow: 0 0 30px rgba(255,215,0,0.15); }
.de-tile-2048 .de-tile-inner {
  background: linear-gradient(135deg, rgba(0,255,200,0.25), rgba(0,152,234,0.25), rgba(123,97,255,0.2));
  border: 1px solid rgba(0,255,200,0.5); color: #fff;
  font-size: calc(var(--cell-size) * 0.26);
  text-shadow: 0 0 20px rgba(0,255,200,0.6);
  box-shadow: 0 0 40px rgba(0,255,200,0.2), 0 0 80px rgba(0,152,234,0.1);
  animation: tile2048Glow 2s ease-in-out infinite;
}
@keyframes tile2048Glow {
  0%,100% { box-shadow: 0 0 40px rgba(0,255,200,0.2), 0 0 80px rgba(0,152,234,0.1); }
  50% { box-shadow: 0 0 50px rgba(0,255,200,0.3), 0 0 100px rgba(0,152,234,0.15); }
}
.de-tile-super .de-tile-inner {
  background: linear-gradient(135deg, rgba(255,215,0,0.25), rgba(255,107,157,0.2), rgba(123,97,255,0.2));
  border: 1px solid rgba(255,215,0,0.5); color: #ffd700;
  font-size: calc(var(--cell-size) * 0.22);
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
  box-shadow: 0 0 40px rgba(255,215,0,0.2);
}

/* Light Theme Tile Override */
body.light-theme .de-tile-2 .de-tile-inner { background: rgba(0,180,150,0.12); border-color: rgba(0,180,150,0.3); color: #008b73; }
body.light-theme .de-tile-4 .de-tile-inner { background: rgba(0,180,150,0.18); border-color: rgba(0,180,150,0.35); color: #008b73; }
body.light-theme .de-tile-8 .de-tile-inner { background: rgba(0,150,200,0.15); border-color: rgba(0,150,200,0.3); color: #0096c8; text-shadow: none; }
body.light-theme .de-tile-16 .de-tile-inner { background: rgba(100,70,200,0.12); border-color: rgba(100,70,200,0.3); color: #5a3fd6; text-shadow: none; }
body.light-theme .de-tile-32 .de-tile-inner { background: rgba(200,80,130,0.12); border-color: rgba(200,80,130,0.3); color: #c8507e; text-shadow: none; }
body.light-theme .de-tile-64 .de-tile-inner { background: rgba(220,130,0,0.12); border-color: rgba(220,130,0,0.3); color: #c87800; text-shadow: none; box-shadow: none; }
body.light-theme .de-tile-128 .de-tile-inner,
body.light-theme .de-tile-256 .de-tile-inner,
body.light-theme .de-tile-512 .de-tile-inner,
body.light-theme .de-tile-1024 .de-tile-inner,
body.light-theme .de-tile-2048 .de-tile-inner,
body.light-theme .de-tile-super .de-tile-inner { text-shadow: none; box-shadow: none; }
body.light-theme .de-tile-2048 .de-tile-inner { animation: none; }

/* Game Overlay */
.de-game-overlay {
  display: none; position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,26,0.85); backdrop-filter: blur(4px);
  z-index: 100; border-radius: var(--radius-lg);
  animation: fadeIn 0.5s ease;
}
.de-game-overlay.show { display: flex; align-items: center; justify-content: center; }
@keyframes fadeIn { 0%{opacity:0;} 100%{opacity:1;} }
.de-overlay-content { text-align: center; padding: 20px; }
.de-overlay-title { font-size: 28px; font-weight: 900; letter-spacing: 3px; margin-bottom: 20px; }
.de-overlay-title.win {
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.de-overlay-title.lose { color: var(--accent-tertiary); }
.de-overlay-score, .de-overlay-reward {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 8px; font-size: 14px; color: var(--text-secondary);
}
.de-overlay-score-val { font-family: var(--font-num); font-size: 24px; font-weight: 900; color: var(--text-primary); }
.de-overlay-reward-val { font-family: var(--font-num); font-size: 24px; font-weight: 900; color: #ffd700; }
.de-overlay-reward-val.miss { color: var(--text-muted); font-size: 16px; }
.de-overlay-reward-val.claimed { color: var(--text-muted); font-size: 16px; }
.de-overlay-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: center; }
.de-btn-retry { background: var(--gradient-primary); border: none; color: #0a0a1a; font-weight: 700; padding: 12px 28px; font-size: 14px; }
.de-btn-continue { background: transparent; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; padding: 12px 28px; font-size: 14px; }
.de-btn-revive { background: linear-gradient(135deg, #ff6b35, #ff2d55); border: none; color: #fff; font-weight: 700; padding: 12px 28px; font-size: 14px; }
.de-btn-revive:hover { opacity: 0.9; }

/* Tips */
.de-tips { text-align: center; color: var(--text-muted); font-size: 12px; letter-spacing: 0.5px; padding: 8px 0; }
.de-tips-key {
  display: inline-block; padding: 2px 8px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 4px; font-family: var(--font-num); font-size: 11px; color: var(--text-secondary);
}
.de-tips strong { color: var(--accent); }
.de-tips-shard-reward { font-size: 13px; font-weight: 600; padding: 4px 0 10px; }
.de-tips-shard-reward strong { color: var(--accent); }

/* ============================================
   Modal Base
   ============================================ */
.de-modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,26,0.9); backdrop-filter: blur(8px);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.de-modal-overlay.show { display: flex; animation: fadeIn 0.3s ease; }
.de-modal {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); width: 100%; max-width: 440px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,255,200,0.08);
}
.de-modal-sm { max-width: 380px; }
.de-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 12px; border-bottom: 1px solid var(--border-color);
}
.de-modal-title { font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.de-modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-color); background: transparent;
  color: var(--text-secondary); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.de-modal-close:hover { border-color: var(--accent-tertiary); color: var(--accent-tertiary); background: rgba(255,107,157,0.1); }

/* ============================================
   Refine Modal
   ============================================ */
.de-refine-body { padding: 20px 24px; }
.de-refine-balance {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.de-refine-bal-item {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  font-size: 12px; color: var(--text-secondary);
}
.de-refine-bal-item strong { color: var(--text-primary); font-family: var(--font-num); }
.de-refine-bal-icon { color: #ffd700; font-size: 16px; }

.de-refine-rate {
  text-align: center; font-size: 14px; color: var(--accent);
  margin-bottom: 20px; padding: 10px;
  background: rgba(0,255,200,0.05); border-radius: var(--radius-md);
  border: 1px dashed rgba(0,255,200,0.15);
}

.de-refine-slider-section {
  margin-bottom: 16px;
}
.de-refine-slider-section label {
  display: block; font-size: 12px; color: var(--text-secondary);
  margin-bottom: 10px; font-weight: 600;
}
.de-refine-slider-row {
  display: flex; align-items: center; gap: 12px;
}
.de-refine-slider-min, .de-refine-slider-max {
  font-family: var(--font-num); font-size: 11px; color: var(--text-muted);
  min-width: 40px; text-align: center;
}
.de-refine-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  outline: none;
}
.de-refine-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gradient-ton); border: 2px solid #fff;
  cursor: pointer; box-shadow: 0 0 10px rgba(0,152,234,0.3);
}
.de-refine-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gradient-ton); border: 2px solid #fff;
  cursor: pointer;
}
.de-refine-controls { text-align: right; margin-top: 6px; }

.de-refine-preview {
  text-align: center; padding: 14px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); margin-bottom: 16px;
}
.de-refine-preview-text {
  font-family: var(--font-num); font-size: 18px;
  font-weight: 700; color: var(--text-primary); margin-bottom: 4px;
}
.de-refine-preview-rate { font-size: 11px; color: var(--text-muted); }

.de-refine-note {
  font-size: 11px; color: #ffa726; text-align: center;
  margin-bottom: 14px; line-height: 1.5;
}
.de-btn-refine {
  width: 100%; padding: 14px;
  background: var(--gradient-ton); border: none; border-radius: var(--radius-md);
  color: #fff; font-family: var(--font-main); font-size: 14px;
  font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: var(--transition);
}
.de-btn-refine:hover { box-shadow: 0 0 25px rgba(0,152,234,0.3); transform: translateY(-1px); }
.de-btn-refine:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }

/* Button loading state */
.de-btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}
.de-btn-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: de-spin 0.6s linear infinite;
}
@keyframes de-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Ad Modal
   ============================================ */
.de-ad-body {
  padding: 30px 24px; text-align: center;
}
.de-ad-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,152,234,0.1); border-radius: 50%;
  font-size: 28px; color: #00d4ff;
  animation: adPulse 1.5s ease-in-out infinite;
}
@keyframes adPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.de-ad-desc {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6;
}
.de-btn-ad {
  padding: 14px 32px;
  background: var(--gradient-ton); border: none; border-radius: var(--radius-md);
  color: #fff; font-family: var(--font-main); font-size: 14px;
  font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: var(--transition);
}
.de-btn-ad:hover { box-shadow: 0 0 25px rgba(0,152,234,0.3); transform: translateY(-1px); }
.de-ad-note { font-size: 10px; color: var(--text-muted); margin-top: 12px; }

/* ============================================
   Invite Modal
   ============================================ */
.de-invite-body { padding: 20px 24px; }
.de-invite-code-section { margin-bottom: 20px; }
.de-invite-code-label {
  font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 1px;
}
.de-invite-code-row {
  display: flex; gap: 10px; align-items: center;
}
.de-invite-code {
  flex: 1; padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-num); font-size: 16px; font-weight: 700;
  color: var(--accent); letter-spacing: 2px;
}

.de-invite-stats {
  display: flex; gap: 12px; margin-bottom: 20px;
}
.de-invite-stat {
  flex: 1; text-align: center; padding: 14px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.de-invite-stat-val {
  font-family: var(--font-num); font-size: 20px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}
.de-invite-stat-label { font-size: 11px; color: var(--text-muted); }

.de-invite-rules {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px;
}
.de-invite-rules h3 {
  font-size: 13px; color: var(--text-primary); margin-bottom: 10px;
  letter-spacing: 1px;
}
.de-invite-rules ul {
  list-style: none; padding: 0;
}
.de-invite-rules li {
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
  margin-bottom: 6px; padding-left: 16px; position: relative;
}
.de-invite-rules li::before {
  content: '▸'; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}
.de-invite-rules li strong { color: #ffd700; }

/* ============================================
   Withdraw Modal
   ============================================ */
.de-withdraw-body { padding: 24px; text-align: center; }
.de-withdraw-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.de-withdraw-amount {
  font-family: var(--font-num); font-size: 28px; font-weight: 700;
  color: #00d4ff; margin-bottom: 20px;
  text-shadow: 0 0 12px rgba(0,152,234,0.3);
}
.de-withdraw-info {
  margin-bottom: 20px;
}
.de-withdraw-info-item {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 6px; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}
.de-btn-withdraw {
  width: 100%; padding: 14px;
  background: var(--gradient-ton); border: none; border-radius: var(--radius-md);
  color: #fff; font-family: var(--font-main); font-size: 14px;
  font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: var(--transition);
}
.de-btn-withdraw:hover { box-shadow: 0 0 25px rgba(0,152,234,0.3); transform: translateY(-1px); }
.de-btn-withdraw:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }
.de-withdraw-note { font-size: 10px; color: var(--text-muted); margin-top: 12px; }

/* ============================================
   Toast
   ============================================ */
.de-toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
  padding: 12px 24px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-xl);
  color: var(--text-primary); font-size: 13px; font-weight: 600;
  z-index: 2000; opacity: 0; pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  max-width: 90vw;
}
.de-toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
}
.de-toast.success { border-color: var(--accent); }
.de-toast.error { border-color: var(--accent-tertiary); }
.de-toast.info { border-color: var(--accent-secondary); }

/* ============================================
   Responsive
   ============================================ */
@media screen and (max-width: 520px) {
  :root {
    --board-size: calc(100vw - 32px);
    --cell-gap: 8px;
  }
  .de-wrapper { padding: 8px; }
  .de-brand-text { font-size: 14px; letter-spacing: 2px; }
  .de-brand-sub { font-size: 10px; letter-spacing: 2px; }
  .de-score-bar { grid-template-columns: 1fr 1fr; }
  .de-score-actions { grid-column: span 2; flex-direction: row; justify-content: center; }
  .de-score-value { font-size: 15px; }
  .de-shards-actions { flex-wrap: wrap; }
  .de-shards-actions .de-btn { font-size: 10px; padding: 6px 10px; }
  .de-overlay-title { font-size: 22px; }
  .de-overlay-score-val, .de-overlay-reward-val { font-size: 18px; }
  .de-modal { max-height: 90vh; margin: 0 8px; }
  .de-ton-value { font-size: 14px; }
}

@media screen and (max-width: 360px) {
  :root { --cell-gap: 6px; }
  .de-brand-sub { display: none; }
  .de-tips { font-size: 10px; }
}
