:root {
  --bg-dark: #08090f;
  --bg-card: rgba(22, 24, 35, 0.7);
  --bg-card-solid: #161823;
  --tiktok-pink: #fe2c55;
  --tiktok-cyan: #25f4ee;
  --gold: #fac710;
  --text-main: #f1f1f2;
  --text-muted: #8a8b91;
  --success: #39ff14;
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 15px rgba(37, 244, 238, 0.35);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(254, 44, 85, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(37, 244, 238, 0.08) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  overflow-x: hidden;
}

/* Header style */
.app-header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  width: 100%;
  max-width: 1200px;
}

.header-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.lang-switch button[aria-pressed="true"] {
  background: linear-gradient(90deg, var(--tiktok-pink), #e01b44);
  color: #fff;
}

.app-header a {
  color: inherit;
  text-decoration: underline;
}

/* i18n — same pattern as guide.html */
html[lang="en"] [data-lang="vi"],
html:not([lang="vi"]) [data-lang="vi"] {
  display: none !important;
}

html[lang="vi"] [data-lang="en"] {
  display: none !important;
}

.app-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.35;
  padding: 0.06em 0 0.16em;
  overflow: visible;
  background: linear-gradient(135deg, var(--tiktok-pink) 20%, #ffffff 50%, var(--tiktok-cyan) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.app-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Main Sandbox Layout */
.sandbox-container {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 40px;
  width: 100%;
  max-width: 1200px;
  align-items: start;
}

@media (max-width: 960px) {
  .sandbox-container {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 30px;
  }
}

/* ==========================================================================
   PHONE EMULATOR FRAME STYLES
   ========================================================================== */
.emulator-section {
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-frame {
  width: 375px;
  height: 720px;
  background-color: #000000;
  border: 12px solid #1a1a1a;
  border-radius: 40px;
  box-shadow: 
    0 25px 60px -15px rgba(0, 0, 0, 0.8),
    0 0 0 2px rgba(255, 255, 255, 0.05),
    0 0 30px rgba(254, 44, 85, 0.15);
  position: relative;
  overflow: hidden;
}

/* Screen Notch */
.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 22px;
  background-color: #1a1a1a;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  z-index: 1000;
}

.phone-screen {
  width: 100%;
  height: 100%;
  position: relative;
  background-color: #111216;
  display: flex;
  flex-direction: column;
}

/* Mobile Status Bar */
.phone-status-bar {
  height: 28px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  z-index: 999;
  user-select: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.phone-status-bar .signals {
  display: flex;
  gap: 5px;
}

/* TikTok Game Header Overlay */
.tiktok-header-overlay {
  height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  z-index: 998;
  background: linear-gradient(to bottom, rgba(17, 18, 22, 0.8), rgba(17, 18, 22, 0));
  pointer-events: auto;
}

.tt-profile-mini {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tt-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tiktok-pink), var(--tiktok-cyan));
  color: #000;
  font-weight: 900;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tt-title-group {
  display: flex;
  flex-direction: column;
}

.tt-title-group .game-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.1;
}

.tt-title-group .game-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.tt-actions {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 4px 10px;
  gap: 8px;
}

.tt-btn-more,
.tt-btn-close {
  background: none;
  border: none;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-btn-close {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
}

.tt-divider {
  width: 1px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   GAME CANVAS STYLES
   ========================================================================== */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: pointer;
}

/* ==========================================================================
   GAME HUD & OVERLAYS STYLES
   ========================================================================== */
.game-hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: rgba(22, 24, 35, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  z-index: 100;
  padding-bottom: 5px;
}

.hud-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.hud-tab:hover {
  color: var(--text-main);
}

.hud-tab.active {
  color: var(--tiktok-cyan);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(37, 244, 238, 0.3);
}

/* Generic Overlay Styling */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 11, 16, 0.92);
  backdrop-filter: blur(25px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.game-overlay.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.overlay-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.close-overlay {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.close-overlay:hover {
  color: white;
}

/* Welcome Overlay */
.welcome-box {
  width: 90%;
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-logo {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--tiktok-pink), var(--tiktok-cyan));
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  box-shadow: 0 10px 25px rgba(254, 44, 85, 0.4);
  animation: logoGlow 2s infinite alternate;
}

@keyframes logoGlow {
  0% { box-shadow: 0 5px 15px rgba(254, 44, 85, 0.3); }
  100% { box-shadow: 0 15px 30px rgba(37, 244, 238, 0.6); }
}

.welcome-box h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--tiktok-pink), var(--tiktok-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-box .subtitle {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 24px;
}

.welcome-box .desc {
  font-size: 0.8rem;
  color: #b0b0b8;
  line-height: 1.5;
  margin-bottom: 30px;
}

.welcome-box .guest-action {
  font-size: 0.75rem;
  color: var(--tiktok-cyan);
  text-decoration: underline;
  cursor: pointer;
  margin-top: 15px;
}

/* Shop Overlay */
.shop-box {
  width: 90%;
  height: 80%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.shop-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.shop-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
}

.shop-items::-webkit-scrollbar {
  width: 4px;
}

.shop-items::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.shop-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.shop-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.item-visual {
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.item-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.item-info .pkg-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-buy {
  padding: 8px 12px !important;
  font-size: 0.78rem !important;
  background: linear-gradient(90deg, var(--tiktok-pink), #e01b44) !important;
  box-shadow: 0 4px 10px rgba(254, 44, 85, 0.25) !important;
}

/* Profile Overlay */
.profile-box {
  width: 90%;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.prof-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--tiktok-cyan);
  object-fit: cover;
  box-shadow: 0 0 10px rgba(37, 244, 238, 0.2);
}

.prof-meta h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.prof-meta p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-details {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-row .label {
  color: var(--text-muted);
}

.detail-row .value {
  color: var(--text-main);
  font-weight: 500;
}

.detail-row .value.highlighted {
  color: var(--tiktok-cyan);
  font-weight: 700;
}

/* ==========================================================================
   DEVELOPER DASHBOARD STYLES (RIGHT PANEL)
   ========================================================================== */
.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

@media (max-width: 960px) {
  .dashboard-section {
    height: auto;
    width: 375px;
  }
}

.dash-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dash-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-left: 3px solid var(--tiktok-cyan);
  padding-left: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  transition: var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--tiktok-cyan);
  box-shadow: var(--shadow-glow);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #c5c6ca;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.checkbox-group input {
  cursor: pointer;
}

.checkbox-group code {
  color: var(--tiktok-pink);
  font-family: 'JetBrains Mono', monospace;
}

/* Console logs */
.console-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}

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

.btn-clear {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear:hover {
  background-color: rgba(255,255,255,0.05);
  color: white;
  border-color: rgba(255,255,255,0.3);
}

.console-logs {
  background: #040508;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
}

.log-row {
  display: flex;
  gap: 8px;
  word-break: break-all;
}

.log-time {
  color: #4a4d5e;
  flex-shrink: 0;
}

.log-row.info .log-message { color: #58a6ff; }
.log-row.success .log-message { color: var(--success); }
.log-row.error .log-message { color: var(--tiktok-pink); }
.log-row.warn .log-message { color: var(--gold); }

/* Cheats grid */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   BUTTONS AND UTILITIES
   ========================================================================== */
.btn {
  background: linear-gradient(90deg, var(--tiktok-pink), #e01b44);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(254, 44, 85, 0.25);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 44, 85, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  width: 100%;
}

.btn-success {
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  border-color: rgba(255,255,255,0.15);
}

.btn-danger {
  background: #2b0c10;
  border: 1px solid rgba(254, 44, 85, 0.2);
  color: var(--tiktok-pink);
  box-shadow: none;
  width: 100%;
}

.btn-danger:hover {
  background: #3d0f14;
  border-color: var(--tiktok-pink);
  box-shadow: none;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.72rem;
}
